From 1f1b1824611333f4243dfe47fe4f5242ee2ea4cd Mon Sep 17 00:00:00 2001 From: sabaimran Date: Mon, 28 Oct 2024 15:29:24 -0700 Subject: [PATCH] Automatically carry over research mode from home page to chat - Improve mobile friendliness with new research mode toggle, since chat input area is now taking up more space - Remove clunky title from the suggestion card - Fix fk lookup error for agent.creator --- src/interface/web/app/chat/page.tsx | 6 ++++ .../components/chatHistory/chatHistory.tsx | 8 ++--- .../chatInputArea/chatInputArea.tsx | 32 +++++++++++-------- .../components/suggestions/suggestionCard.tsx | 24 ++++++-------- .../suggestions/suggestions.module.css | 5 +-- .../components/suggestions/suggestionsData.ts | 28 ++++++++-------- src/interface/web/app/page.tsx | 4 +-- src/khoj/database/adapters/__init__.py | 10 ++++-- 8 files changed, 62 insertions(+), 55 deletions(-) diff --git a/src/interface/web/app/chat/page.tsx b/src/interface/web/app/chat/page.tsx index 53c4bd41..deb26105 100644 --- a/src/interface/web/app/chat/page.tsx +++ b/src/interface/web/app/chat/page.tsx @@ -42,6 +42,7 @@ function ChatBodyData(props: ChatBodyDataProps) { const [images, setImages] = useState([]); const [processingMessage, setProcessingMessage] = useState(false); const [agentMetadata, setAgentMetadata] = useState(null); + const [isInResearchMode, setIsInResearchMode] = useState(false); const chatInputRef = useRef(null); const setQueryToProcess = props.setQueryToProcess; @@ -70,6 +71,10 @@ function ChatBodyData(props: ChatBodyDataProps) { if (storedMessage) { setProcessingMessage(true); setQueryToProcess(storedMessage); + + if (storedMessage.trim().startsWith("/research")) { + setIsInResearchMode(true); + } } }, [setQueryToProcess, props.setImages]); @@ -130,6 +135,7 @@ function ChatBodyData(props: ChatBodyDataProps) { isMobileWidth={props.isMobileWidth} setUploadedFiles={props.setUploadedFiles} ref={chatInputRef} + isResearchModeEnabled={isInResearchMode} /> diff --git a/src/interface/web/app/components/chatHistory/chatHistory.tsx b/src/interface/web/app/components/chatHistory/chatHistory.tsx index 6aa61ff6..9e156142 100644 --- a/src/interface/web/app/components/chatHistory/chatHistory.tsx +++ b/src/interface/web/app/components/chatHistory/chatHistory.tsx @@ -71,7 +71,7 @@ function TrainOfThoughtComponent(props: TrainOfThoughtComponentProps) { ) : ( -
+
{imageUploaded && imagePaths.map((path, index) => ( @@ -490,8 +494,8 @@ export const ChatInputArea = forwardRef((pr