feat: Update web search agent to return top 12 results and enhance message box interactivity

This commit is contained in:
Willie Zutz 2025-06-24 00:10:25 -06:00
parent feec1cd608
commit 190153fbc2
4 changed files with 12 additions and 11 deletions

View file

@ -425,6 +425,7 @@ export const POST = async (req: Request) => {
}),
),
);
writer.close();
cleanupCancelToken(message.messageId);
});

View file

@ -93,7 +93,7 @@ const MessageBox = ({
) : (
<>
<div className="flex items-center">
<h2 className="text-black dark:text-white font-medium text-3xl">
<h2 className="text-black dark:text-white font-medium text-3xl" onClick={startEditMessage}>
{message.content}
</h2>
<button

View file

@ -15,13 +15,13 @@ const OptimizationModes = [
'Prioritize speed and get the quickest possible answer. Minimum effort retrieving web content.',
icon: <Zap size={20} className="text-[#FF9800]" />,
},
{
key: 'balanced',
title: 'Balanced',
description:
'Find the right balance between speed and accuracy. Medium effort retrieving web content.',
icon: <Sliders size={20} className="text-[#4CAF50]" />,
},
// {
// key: 'balanced',
// title: 'Balanced',
// description:
// 'Find the right balance between speed and accuracy. Medium effort retrieving web content.',
// icon: <Sliders size={20} className="text-[#4CAF50]" />,
// },
// {
// key: 'quality',
// title: 'Quality',

View file

@ -175,10 +175,10 @@ export class WebSearchAgent {
}),
);
// Sort by relevance score and take top 8 results
// Sort by relevance score and take top 12 results
const previewContents: PreviewContent[] = resultsWithSimilarity
.sort((a, b) => b.similarity - a.similarity)
.slice(0, 8)
.slice(0, 12)
.map(({ result }) => ({
title: result.title || 'Untitled',
snippet: result.content || '',
@ -301,7 +301,7 @@ export class WebSearchAgent {
// Summarize the top 2 search results
for (const result of resultsWithSimilarity
.slice(0, 8)
.slice(0, 12)
.map((r) => r.result)) {
if (this.signal.aborted) {
console.warn('Search operation aborted by signal');