enzostvs HF Staff commited on
Commit
e9d4f5a
·
1 Parent(s): c62951c

hide uploader

Browse files
Files changed (1) hide show
  1. src/components/ask-ai/ask-ai-new.tsx +19 -29
src/components/ask-ai/ask-ai-new.tsx CHANGED
@@ -3,7 +3,7 @@ import { useState, useRef } from "react";
3
  import classNames from "classnames";
4
  import { toast } from "sonner";
5
  import { useLocalStorage, useUpdateEffect } from "react-use";
6
- import { ArrowUp, ChevronDown, ImagePlus, X } from "lucide-react";
7
  import { FaStopCircle } from "react-icons/fa";
8
 
9
  import Login from "../login/login";
@@ -15,7 +15,6 @@ import { Button } from "../ui/button";
15
  // @ts-expect-error not needed
16
  import { MODELS } from "../../../utils/providers";
17
  import Loading from "../loading/loading";
18
- import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
19
  import { HtmlHistory } from "../../../utils/types";
20
 
21
  function AskAI({
@@ -38,7 +37,7 @@ function AskAI({
38
  onSuccess: (h: string, p: string, n?: number[][]) => void;
39
  }) {
40
  const refThink = useRef<HTMLDivElement | null>(null);
41
- const uploadInputRef = useRef<HTMLInputElement | null>(null);
42
 
43
  const [open, setOpen] = useState(false);
44
  const [prompt, setPrompt] = useState("");
@@ -253,16 +252,16 @@ function AskAI({
253
  }
254
  };
255
 
256
- const handleUploadFile = (event: React.ChangeEvent<HTMLInputElement>) => {
257
- const filesList = event.target.files;
258
- if (filesList && filesList.length > 0) {
259
- // add files to the state to show them in the UI
260
- const newFiles = Array.from(filesList);
261
- setFiles((prevFiles) => [...prevFiles, ...newFiles]);
262
- // clear the input value to allow re-uploading the same file
263
- event.target.value = "";
264
- }
265
- };
266
 
267
  useUpdateEffect(() => {
268
  if (refThink.current) {
@@ -378,27 +377,18 @@ function AskAI({
378
  </div>
379
  <div className="flex items-center justify-between gap-2 px-4 pb-3">
380
  <div className="flex-1">
381
- <Tooltip>
382
- <TooltipTrigger asChild>
383
- <Button
384
  size="iconXs"
385
  variant="outline"
386
  className="!border-neutral-600 !text-neutral-400 !hover:!border-neutral-500 hover:!text-neutral-300"
387
- // onClick={() => {
388
- // if (uploadInputRef.current) {
389
- // uploadInputRef.current.click();
390
- // }
391
- // }}
392
  >
393
  <ImagePlus className="size-4" />
394
  </Button>
395
- </TooltipTrigger>
396
- <TooltipContent>
397
- <p>
398
- Attach files <span className="italic">(coming soon)</span>
399
- </p>
400
- </TooltipContent>
401
- </Tooltip>
402
  <input
403
  ref={uploadInputRef}
404
  type="file"
@@ -407,7 +397,7 @@ function AskAI({
407
  onChange={handleUploadFile}
408
  className="hidden"
409
  id="file-upload"
410
- />
411
  </div>
412
  <div className="flex items-center justify-end gap-2">
413
  <Settings
 
3
  import classNames from "classnames";
4
  import { toast } from "sonner";
5
  import { useLocalStorage, useUpdateEffect } from "react-use";
6
+ import { ArrowUp, ChevronDown, X } from "lucide-react";
7
  import { FaStopCircle } from "react-icons/fa";
8
 
9
  import Login from "../login/login";
 
15
  // @ts-expect-error not needed
16
  import { MODELS } from "../../../utils/providers";
17
  import Loading from "../loading/loading";
 
18
  import { HtmlHistory } from "../../../utils/types";
19
 
20
  function AskAI({
 
37
  onSuccess: (h: string, p: string, n?: number[][]) => void;
38
  }) {
39
  const refThink = useRef<HTMLDivElement | null>(null);
40
+ // const uploadInputRef = useRef<HTMLInputElement | null>(null);
41
 
42
  const [open, setOpen] = useState(false);
43
  const [prompt, setPrompt] = useState("");
 
252
  }
253
  };
254
 
255
+ // const handleUploadFile = (event: React.ChangeEvent<HTMLInputElement>) => {
256
+ // const filesList = event.target.files;
257
+ // if (filesList && filesList.length > 0) {
258
+ // // add files to the state to show them in the UI
259
+ // const newFiles = Array.from(filesList);
260
+ // setFiles((prevFiles) => [...prevFiles, ...newFiles]);
261
+ // // clear the input value to allow re-uploading the same file
262
+ // event.target.value = "";
263
+ // }
264
+ // };
265
 
266
  useUpdateEffect(() => {
267
  if (refThink.current) {
 
377
  </div>
378
  <div className="flex items-center justify-between gap-2 px-4 pb-3">
379
  <div className="flex-1">
380
+ {/* <Button
 
 
381
  size="iconXs"
382
  variant="outline"
383
  className="!border-neutral-600 !text-neutral-400 !hover:!border-neutral-500 hover:!text-neutral-300"
384
+ onClick={() => {
385
+ if (uploadInputRef.current) {
386
+ uploadInputRef.current.click();
387
+ }
388
+ }}
389
  >
390
  <ImagePlus className="size-4" />
391
  </Button>
 
 
 
 
 
 
 
392
  <input
393
  ref={uploadInputRef}
394
  type="file"
 
397
  onChange={handleUploadFile}
398
  className="hidden"
399
  id="file-upload"
400
+ /> */}
401
  </div>
402
  <div className="flex items-center justify-end gap-2">
403
  <Settings