diff --git a/src/components/Common/Playground/Message.tsx b/src/components/Common/Playground/Message.tsx index 57f2ac9..17fb6bd 100644 --- a/src/components/Common/Playground/Message.tsx +++ b/src/components/Common/Playground/Message.tsx @@ -1,6 +1,7 @@ import { CheckIcon, ClipboardIcon } from "@heroicons/react/24/outline" import Markdown from "../../Common/Markdown" import React from "react" +import { Image } from "antd" type Props = { message: string @@ -55,19 +56,21 @@ export const PlaygroundMessage = (props: Props) => { {/* source if aviable */} {props.images && (
- {props.images - .filter((image) => image.length > 0) - .map((image, index) => ( -
- Uploaded -
- ))} + {props.images && ( +
+ {props.images + .filter((image) => image.length > 0) + .map((image, index) => ( + Uploaded Image + ))} +
+ )}
)} diff --git a/src/components/Option/Playground/PlaygroundMessage.tsx b/src/components/Option/Playground/PlaygroundMessage.tsx index f5efd1f..1882558 100644 --- a/src/components/Option/Playground/PlaygroundMessage.tsx +++ b/src/components/Option/Playground/PlaygroundMessage.tsx @@ -60,6 +60,7 @@ export const PlaygroundMessage = (props: Props) => { .filter((image) => image.length > 0) .map((image, index) => ( Uploaded Image { saveOllamaURL(ollamaURL) refetch() }} - className="bg-pink-500 mt-4 hover:bg-pink-600 text-white px-4 py-2 rounded-md dark:bg-pink-600 dark:hover:bg-pink-700"> + className="inline-flex mt-4 items-center rounded-md border border-transparent bg-black px-2 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:bg-white dark:text-gray-800 dark:hover:bg-gray-100 dark:focus:ring-gray-500 dark:focus:ring-offset-gray-100 disabled:opacity-50 "> + Retry diff --git a/src/components/Sidepanel/Chat/form.tsx b/src/components/Sidepanel/Chat/form.tsx index d2e62db..de02f13 100644 --- a/src/components/Sidepanel/Chat/form.tsx +++ b/src/components/Sidepanel/Chat/form.tsx @@ -6,6 +6,9 @@ import { useMessage } from "~hooks/useMessage" import PhotoIcon from "@heroicons/react/24/outline/PhotoIcon" import XMarkIcon from "@heroicons/react/24/outline/XMarkIcon" import { toBase64 } from "~libs/to-base64" +import { MicIcon } from "lucide-react" +import { Image, Tooltip } from "antd" +import { useSpeechRecognition } from "~hooks/useSpeechRecognition" type Props = { dropedFile: File | undefined @@ -50,33 +53,52 @@ export const SidepanelForm = ({ dropedFile }: Props) => { useDynamicTextareaSize(textareaRef, form.values.message, 120) - const { onSubmit, selectedModel, chatMode } = useMessage() + const { onSubmit, selectedModel, chatMode, speechToTextLanguage } = + useMessage() + const { isListening, start, stop, transcript } = useSpeechRecognition() + React.useEffect(() => { + if (isListening) { + form.setFieldValue("message", transcript) + } + }, [transcript]) const { mutateAsync: sendMessage, isPending: isSending } = useMutation({ mutationFn: onSubmit }) return ( -
-
- {chatMode === "normal" && form.values.image && ( -
-
- Uploaded - -
-
- )} +
+
+
+ Uploaded Image + +
+
+ {/*
+ + + +
*/} +
{ @@ -91,29 +113,18 @@ export const SidepanelForm = ({ dropedFile }: Props) => { message: value.message.trim() }) })} - className="shrink-0 flex-grow flex items-center "> -
- - - + className="shrink-0 flex-grow flex flex-col items-center "> + +