From ecff789f5b07f9d39abc9461f77169d6bc754505 Mon Sep 17 00:00:00 2001 From: Paul Ccari <46382556+paulclindo@users.noreply.github.com> Date: Wed, 30 Oct 2024 19:37:43 -0500 Subject: [PATCH] Misc fixes (#516) * fix: textarea input * fix: create/update drawer modal ui * fix: tooltip in message inbox to show full title * fix: implement edit/remove when search prompts * fix: ui ollama models --- .../components/chat/conversation-footer.tsx | 13 +- .../context/prompt-selection-context.tsx | 50 +++- .../components/ollama-models-repository.tsx | 15 +- .../shinkai-desktop/src/pages/chat/layout.tsx | 238 +++++++++--------- .../src/components/chat/chat-input-area.tsx | 83 +++--- .../src/components/chat/chat-input.tsx | 6 +- .../shinkai-ui/src/hooks/use-combined-refs.ts | 22 ++ 7 files changed, 254 insertions(+), 173 deletions(-) create mode 100644 libs/shinkai-ui/src/hooks/use-combined-refs.ts diff --git a/apps/shinkai-desktop/src/components/chat/conversation-footer.tsx b/apps/shinkai-desktop/src/components/chat/conversation-footer.tsx index b6ae2fe25..6ca0d2fee 100644 --- a/apps/shinkai-desktop/src/components/chat/conversation-footer.tsx +++ b/apps/shinkai-desktop/src/components/chat/conversation-footer.tsx @@ -56,7 +56,7 @@ import { cn } from '@shinkai_network/shinkai-ui/utils'; import { partial } from 'filesize'; import { AnimatePresence, motion } from 'framer-motion'; import { Paperclip, X, XIcon } from 'lucide-react'; -import { useEffect, useMemo, useState } from 'react'; +import { useEffect, useMemo, useRef, useState } from 'react'; import { useDropzone } from 'react-dropzone'; import { useForm, useWatch } from 'react-hook-form'; import { useLocation, useNavigate, useParams } from 'react-router-dom'; @@ -571,6 +571,7 @@ function ConversationChatFooter({ inboxId }: { inboxId: string }) { (state) => state.setWorkflowSelected, ); + const textareaRef = useRef(null); const auth = useAuth((state) => state.auth); const { captureAnalyticEvent } = useAnalytics(); @@ -732,6 +733,11 @@ function ConversationChatFooter({ inboxId }: { inboxId: string }) { useEffect(() => { if (promptSelected) { chatForm.setValue('message', promptSelected.prompt); + setTimeout(() => { + if (!textareaRef.current) return; + textareaRef.current.scrollTop = textareaRef.current.scrollHeight; + textareaRef.current.focus(); + }, 10); } }, [chatForm, promptSelected]); @@ -744,9 +750,7 @@ function ConversationChatFooter({ inboxId }: { inboxId: string }) {
{workflowSelected && ( diff --git a/apps/shinkai-desktop/src/components/prompt/context/prompt-selection-context.tsx b/apps/shinkai-desktop/src/components/prompt/context/prompt-selection-context.tsx index 8c0dba752..9c84bf804 100644 --- a/apps/shinkai-desktop/src/components/prompt/context/prompt-selection-context.tsx +++ b/apps/shinkai-desktop/src/components/prompt/context/prompt-selection-context.tsx @@ -28,7 +28,6 @@ import { Textarea, TextField, } from '@shinkai_network/shinkai-ui'; -import { formatText } from '@shinkai_network/shinkai-ui/helpers'; import { cn } from '@shinkai_network/shinkai-ui/utils'; import { Edit3Icon, @@ -223,22 +222,47 @@ const PromptSearchDrawer = () => { {searchQuery && isSearchQuerySynced && searchPromptList?.map((prompt) => ( - +
+ + + +
+ {prompt.name} +
))} {searchQuery && isSearchQuerySynced && @@ -333,7 +357,7 @@ export function CreatePromptDrawer({ )} - + Create custom prompt
@@ -359,7 +383,7 @@ export function CreatePromptDrawer({