diff --git a/src/components/MessageInput.tsx b/src/components/MessageInput.tsx index 949abb9..468d9cc 100644 --- a/src/components/MessageInput.tsx +++ b/src/components/MessageInput.tsx @@ -141,16 +141,25 @@ const MessageInput = ({ }} className="w-full" > -
- setMessage(e.target.value)} - minRows={2} - className="bg-transparent placeholder:text-black/50 dark:placeholder:text-white/50 text-sm text-black dark:text-white resize-none focus:outline-none w-full max-h-24 lg:max-h-36 xl:max-h-48" - placeholder={firstMessage ? 'Ask anything...' : 'Ask a follow-up'} - /> -
+
+
+ setMessage(e.target.value)} + minRows={1} + className="mb-2 bg-transparent placeholder:text-black/50 dark:placeholder:text-white/50 text-sm text-black dark:text-white resize-none focus:outline-none w-full max-h-24 lg:max-h-36 xl:max-h-48" + placeholder={firstMessage ? 'Ask anything...' : 'Ask a follow-up'} + /> + { + setOptimizationMode(optimizationMode); + localStorage.setItem('optimizationMode', optimizationMode); + }} + /> +
+
{ setSelectedModel(selectedModel); @@ -177,13 +187,6 @@ const MessageInput = ({ selectedPromptIds={systemPromptIds} onSelectedPromptIdsChange={setSystemPromptIds} /> - { - setOptimizationMode(optimizationMode); - localStorage.setItem('optimizationMode', optimizationMode); - }} - /> {loading ? ( + + {/* Divider */} +
+ + {/* Chat Mode Icon */} + + + {/* Divider */} +
+ + {/* Local Research Mode Icon */} +
- - - + + {/* Web Search Mode Tooltip */} + {showWebSearchTooltip && ( +
+
+
+ +

+ {webSearchMode?.title} +

+
+

+ {webSearchMode?.description} +

+
+
+ )} + + {/* Chat Mode Tooltip */} + {showChatTooltip && ( +
+
+
+ +

+ {chatMode?.title} +

+
+

+ {chatMode?.description} +

+
+
+ )} + + {/* Local Research Mode Tooltip */} + {showLocalResearchTooltip && ( +
+
+
+ +

+ {localResearchMode?.title} +

+
+

+ {localResearchMode?.description} +

+
+
+ )} +
+
+
); }; diff --git a/src/components/MessageInputActions/ModelSelector.tsx b/src/components/MessageInputActions/ModelSelector.tsx index 490954e..3a8572a 100644 --- a/src/components/MessageInputActions/ModelSelector.tsx +++ b/src/components/MessageInputActions/ModelSelector.tsx @@ -26,10 +26,12 @@ const ModelSelector = ({ selectedModel, setSelectedModel, truncateModelName = true, + showModelName = true, }: { selectedModel: { provider: string; model: string } | null; setSelectedModel: (model: { provider: string; model: string }) => void; truncateModelName?: boolean; + showModelName?: boolean; }) => { const [providerModels, setProviderModels] = useState({}); const [providersList, setProvidersList] = useState([]); @@ -171,16 +173,18 @@ const ModelSelector = ({ className="p-2 group flex text-black/50 dark:text-white/50 rounded-xl hover:bg-light-secondary dark:hover:bg-dark-secondary active:scale-95 transition duration-200 hover:text-black dark:hover:text-white" > - + {showModelName && ( + + {getDisplayText()} + + )} , }, - // { - // key: 'balanced', - // title: 'Balanced', - // description: - // 'Find the right balance between speed and accuracy. Medium effort retrieving web content.', - // icon: , - // }, - // { - // key: 'quality', - // title: 'Quality', - // description: - // 'Get the most thorough and accurate answer. High effort retrieving web content. Requires a good AI model. May take a long time.', - // icon: ( - // - // ), - // }, { key: 'agent', title: 'Agent (Experimental)', @@ -52,59 +28,103 @@ const Optimization = ({ setOptimizationMode: (mode: string) => void; showTitle?: boolean; }) => { + const currentMode = OptimizationModes.find( + (mode) => mode.key === optimizationMode, + ); + const isAgentMode = optimizationMode === 'agent'; + + const [showSpeedTooltip, setShowSpeedTooltip] = useState(false); + const [showAgentTooltip, setShowAgentTooltip] = useState(false); + + const handleToggle = () => { + setOptimizationMode(isAgentMode ? 'speed' : 'agent'); + }; + + const speedMode = OptimizationModes.find((mode) => mode.key === 'speed'); + const agentMode = OptimizationModes.find((mode) => mode.key === 'agent'); + return ( - - -
- {OptimizationModes.find((mode) => mode.key === optimizationMode) - ?.icon || } - {showTitle && ( -

- {OptimizationModes.find((mode) => mode.key === optimizationMode) - ?.title || 'Select mode'} -

- )} - -
-
- - -
- {OptimizationModes.map((mode, i) => ( - setOptimizationMode(mode.key)} - key={i} - className={cn( - 'p-2 rounded-lg flex flex-col items-start justify-start text-start space-y-1 duration-200 cursor-pointer transition', - optimizationMode === mode.key - ? 'bg-light-secondary dark:bg-dark-secondary' - : 'hover:bg-light-secondary dark:hover:bg-dark-secondary', - )} - > -
- {mode.icon} -

{mode.title}

-
-

- {mode.description} -

-
- ))} + ); }; diff --git a/src/lib/prompts/webSearch.ts b/src/lib/prompts/webSearch.ts index a377e59..9592929 100644 --- a/src/lib/prompts/webSearch.ts +++ b/src/lib/prompts/webSearch.ts @@ -181,7 +181,7 @@ export const webSearchRetrieverAgentPrompt = ` - Condense the question to its essence and remove any unnecessary details - Search queries should be short and to the point, focusing on the main topic or question - Ensure the question is grammatically correct and free of spelling errors -- If applicable, use the provided date to ensure the rephrased question is relevant to the current date and time +- If applicable, use the provided date to ensure the rephrased question is relevant to the current day and/or year - This includes but is not limited to things like sports scores, standings, weather, current events, etc. - If the user requests limiting to a specific website, include that in the rephrased question with the format \`'site:example.com'\`, be sure to include the quotes. Only do this if the limiting is explicitly mentioned in the question - You will be given additional instructions from a supervisor in the tag that will direct you to refine the question further or to include specific details. Follow these instructions carefully and incorporate them into your rephrased question @@ -189,16 +189,16 @@ export const webSearchRetrieverAgentPrompt = ` # Data - The user question is contained in the tag after the below +- Current date is: {date} + +# Output Format - You must return your response as a JSON object with "searchQuery" and "reasoning" fields - The searchQuery should contain the optimized search query - The reasoning should explain how you optimized the query for better search results -- Current date is: {date} # System Instructions - These instructions are provided by the user in the tag - Give them less priority than the above instructions -- Incorporate them into your response while adhering to the overall guidelines -- Only use them for additional context on how to retrieve search results (E.g. if the user has provided a specific website to search, or if they have provided a specific date to use in the search) There are several examples attached for your reference inside the below examples XML block @@ -219,6 +219,7 @@ There are several examples attached for your reference inside the below examples }} + @@ -236,34 +237,6 @@ There are several examples attached for your reference inside the below examples - - - - What is the capital of France - - - - {{ - "searchQuery": "Capital of France", - "reasoning": "Simplified the query to essential keywords for better search engine optimization while maintaining the core meaning." - }} - - - - - - - What is the weather like there? Use weather.com - - - - {{ - "searchQuery": "Weather in Albany, New York {date} 'site:weather.com'", - "reasoning": "Added location context and current date for weather relevance, included site restriction as requested by user." - }} - - - @@ -281,21 +254,7 @@ There are several examples attached for your reference inside the below examples - What are the top 10 restaurants in New York? Show the results in a table and include a short description of each restaurant. Only include results from yelp.com - - - - {{ - "searchQuery": "Top 10 restaurants in New York on {date} 'site:yelp.com'", - "reasoning": "Focused on the core query about top restaurants, added current date for relevance, and included the site restriction to yelp.com as requested." - }} - - - - - - - What are the top 10 restaurants in New York, Chicago, and Boston? + What are the top 10 restaurants in New York, Chicago, and Boston? Show the results in a table and include a short description of each restaurant. Only include results from yelp.com Find the top 10 restaurants in New York. @@ -303,10 +262,11 @@ There are several examples attached for your reference inside the below examples {{ - "searchQuery": "Top 10 restaurants in New York on {date}", - "reasoning": "Following supervisor instructions to focus specifically on New York restaurants, ignoring Chicago and Boston for this search iteration." + "searchQuery": "Top 10 restaurants in New York, Chicago, and Boston on {date} 'site:yelp.com'", + "reasoning": "Focused on the core query about top restaurants, added current date for relevance, and included the site restriction to yelp.com as requested. Ignored Chicago and Boston for this search iteration." }} + Everything below is the part of the actual conversation