From a16fc3ade8e307bbd7cc43b362c7069688f42f10 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Fri, 15 Nov 2024 01:25:13 -0800 Subject: [PATCH] Only add /research prefix when no slash command in message on web app - Explictly adding a slash command is a higher priority intent than research mode being enabled in the background. Respect that for a more intuitive UX flow. - Explicit slash commands do not currently work in research mode. You've to turn research mode off to use other slash commands. This is strange, unnecessary given intent priority is clear. --- .../web/app/components/chatInputArea/chatInputArea.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx index 74be1837..6bc19036 100644 --- a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx +++ b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx @@ -170,7 +170,12 @@ export const ChatInputArea = forwardRef((pr } let messageToSend = message.trim(); - if (useResearchMode && !messageToSend.startsWith("/research")) { + // Check if message starts with an explicit slash command + const startsWithSlashCommand = + props.chatOptionsData && + Object.keys(props.chatOptionsData).some((cmd) => messageToSend.startsWith(`/${cmd}`)); + // Only add /research if useResearchMode is enabled and message doesn't already use a slash command + if (useResearchMode && !startsWithSlashCommand) { messageToSend = `/research ${messageToSend}`; }