diff --git a/ui/src/components/ModalFileUpload.tsx b/ui/src/components/ModalFileUpload.tsx index 8e9d3c5..3219b55 100644 --- a/ui/src/components/ModalFileUpload.tsx +++ b/ui/src/components/ModalFileUpload.tsx @@ -7,7 +7,7 @@ import { } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; -import { Dispatch, SetStateAction } from "react"; +import { Dispatch, SetStateAction, useState } from "react"; import { Overlay } from "./Overlay"; import { useForm } from "react-hook-form"; import { z } from "zod"; @@ -35,6 +35,7 @@ const formSchema = z.object({ }); export function ModalFileUpload({ setModalVisible, id }: ModalFileUploadProps) { + const [loadingStatus, setLoadingStatus] = useState(null); const form = useForm>({ resolver: zodResolver(formSchema), }); @@ -44,20 +45,21 @@ export function ModalFileUpload({ setModalVisible, id }: ModalFileUploadProps) { } function onSubmit(values: z.infer) { + setLoadingStatus("File loading, please wait..."); uploadMutation.mutate(values.file); } const uploadMutation = useMutation({ mutationFn: async (file: File) => { - knowledgeBaseService.uploadFile(id, file); + return await knowledgeBaseService.uploadFile(id, file); }, - onSuccess: () => { + onSuccess: async () => { + await new Promise((resolve) => setTimeout(resolve, 0)); // Ensures synchronous execution setModalVisible(false); - // You might want to add a success notification here }, onError: (error) => { + setLoadingStatus("Error uploading file"); console.error("Error uploading file:", error); - // You might want to add an error notification here }, }); @@ -100,6 +102,7 @@ export function ModalFileUpload({ setModalVisible, id }: ModalFileUploadProps) { + {loadingStatus &&

{loadingStatus}

} diff --git a/ui/src/components/form_fields/GenerativeModelField.tsx b/ui/src/components/form_fields/GenerativeModelField.tsx index f8c922b..bdc0240 100644 --- a/ui/src/components/form_fields/GenerativeModelField.tsx +++ b/ui/src/components/form_fields/GenerativeModelField.tsx @@ -34,9 +34,9 @@ export function GenerativeModelField({ control }: GenerativeModelFieldProps) { - gpt-3.5-turbo - Option 2 - Option 3 + gpt-4-turbo + gpt-4o-mini + gpt-4o