Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: fix search issue (#12457)

Arvin Xu616ac9438c12
diff --git a/package.json b/package.json
index 1301dc34e39..15148c32c7a 100644
--- a/package.json
+++ b/package.json
@@ -233,7 +233,7 @@
"@lobehub/market-sdk": "^0.30.3",
"@lobehub/tts": "^4.0.2",
"@lobehub/ui": "^4.38.1",
- "@modelcontextprotocol/sdk": "^1.25.3",
+ "@modelcontextprotocol/sdk": "^1.26.0",
"@napi-rs/canvas": "^0.1.88",
"@neondatabase/serverless": "^1.0.2",
"@next/third-parties": "^16.1.5",
diff --git a/src/features/CommandMenu/SearchResults.tsx b/src/features/CommandMenu/SearchResults.tsx
index bf231c8a166..934e0597ea2 100644
--- a/src/features/CommandMenu/SearchResults.tsx
+++ b/src/features/CommandMenu/SearchResults.tsx
@@ -268,8 +268,8 @@ const SearchResults = memo<SearchResultsProps>(
return (
<CommandItem
- description={subtitle}
forceMount
+ description={subtitle}
icon={getIcon(result.type)}
key={result.id}
title={titleWithPrefix}
@@ -313,70 +313,70 @@ const SearchResults = memo<SearchResultsProps>(
<>
{/* Render search results grouped by type without headers */}
{messageResults.length > 0 && (
- <Command.Group>
+ <Command.Group forceMount>
{messageResults.map((result) => renderResultItem(result))}
{renderSearchMore('message', messageResults.length)}
</Command.Group>
)}
{agentResults.length > 0 && (
- <Command.Group>
+ <Command.Group forceMount>
{agentResults.map((result) => renderResultItem(result))}
{renderSearchMore('agent', agentResults.length)}
</Command.Group>
)}
{topicResults.length > 0 && (
- <Command.Group>
+ <Command.Group forceMount>
{topicResults.map((result) => renderResultItem(result))}
{renderSearchMore('topic', topicResults.length)}
</Command.Group>
)}
{pageResults.length > 0 && (
- <Command.Group>
+ <Command.Group forceMount>
{pageResults.map((result) => renderResultItem(result))}
{renderSearchMore('page', pageResults.length)}
</Command.Group>
)}
{memoryResults.length > 0 && (
- <Command.Group>
+ <Command.Group forceMount>
{memoryResults.map((result) => renderResultItem(result))}
{renderSearchMore('memory', memoryResults.length)}
</Command.Group>
)}
{fileResults.length > 0 && (
- <Command.Group>
+ <Command.Group forceMount>
{fileResults.map((result) => renderResultItem(result))}
{renderSearchMore('file', fileResults.length)}
</Command.Group>
)}
{folderResults.length > 0 && (
- <Command.Group>
+ <Command.Group forceMount>
{folderResults.map((result) => renderResultItem(result))}
{renderSearchMore('folder', folderResults.length)}
</Command.Group>
)}
{mcpResults.length > 0 && (
- <Command.Group>
+ <Command.Group forceMount>
{mcpResults.map((result) => renderResultItem(result))}
{renderSearchMore('mcp', mcpResults.length)}
</Command.Group>
)}
{pluginResults.length > 0 && (
- <Command.Group>
+ <Command.Group forceMount>
{pluginResults.map((result) => renderResultItem(result))}
{renderSearchMore('plugin', pluginResults.length)}
</Command.Group>
)}
{assistantResults.length > 0 && (
- <Command.Group>
+ <Command.Group forceMount>
{assistantResults.map((result) => renderResultItem(result))}
{renderSearchMore('communityAgent', assistantResults.length)}
</Command.Group>
@@ -384,7 +384,7 @@ const SearchResults = memo<SearchResultsProps>(
{/* Show loading skeleton below existing results */}
{isLoading && (
- <Command.Group>
+ <Command.Group forceMount>
{[1, 2, 3].map((i) => (
<Command.Item
disabled
diff --git a/src/features/CommandMenu/index.tsx b/src/features/CommandMenu/index.tsx
index 938d7df9d6e..c3fdfa4beaa 100644
--- a/src/features/CommandMenu/index.tsx
+++ b/src/features/CommandMenu/index.tsx
@@ -114,7 +114,9 @@ const CommandMenuContent = memo<CommandMenuContentProps>(({ isClosing, onClose }
<CommandInput />
<Command.List ref={listRef}>
- <Command.Empty>{t('cmdk.noResults')}</Command.Empty>
+ {!(hasSearch && (isSearching || searchResults.length > 0)) && (
+ <Command.Empty>{t('cmdk.noResults')}</Command.Empty>
+ )}
{/* Show send command when agent is selected */}
{selectedAgent && (
diff --git a/src/server/routers/lambda/__tests__/integration/aiAgent.createClientGroupAgentTaskThread.integration.test.ts b/src/server/routers/lambda/__tests__/integration/aiAgent.createClientGroupAgentTaskThread.integration.test.ts
index 56de76d03f4..e29016511dd 100644
--- a/src/server/routers/lambda/__tests__/integration/aiAgent.createClientGroupAgentTaskThread.integration.test.ts
+++ b/src/server/routers/lambda/__tests__/integration/aiAgent.createClientGroupAgentTaskThread.integration.test.ts
@@ -104,7 +104,7 @@ describe('createClientGroupAgentTaskThread Integration', () => {
testTopicId = topic.id;
// Create parent message from supervisor (simulating supervisor's task message)
- const [parentMsg] = await serverDB
+ const [parentMsg] = (await serverDB
.insert(messages)
.values({
userId,
@@ -114,7 +114,7 @@ describe('createClientGroupAgentTaskThread Integration', () => {
agentId: supervisorAgentId, // Parent message from supervisor
groupId: testGroupId,
})
- .returning();
+ .returning()) as any[];
parentMessageId = parentMsg.id;
});
@@ -249,7 +249,7 @@ describe('createClientGroupAgentTaskThread Integration', () => {
it('should include ancestor messages in thread context', async () => {
// Create a chain of messages with different agentIds
- const [userMsg] = await serverDB
+ const [userMsg] = (await serverDB
.insert(messages)
.values({
userId,
@@ -259,9 +259,9 @@ describe('createClientGroupAgentTaskThread Integration', () => {
agentId: supervisorAgentId,
groupId: testGroupId,
})
- .returning();
+ .returning()) as any[];
- const [supervisorResponse] = await serverDB
+ const [supervisorResponse] = (await serverDB
.insert(messages)
.values({
userId,
@@ -272,7 +272,7 @@ describe('createClientGroupAgentTaskThread Integration', () => {
groupId: testGroupId,
parentId: userMsg.id,
})
- .returning();
+ .returning()) as any[];
const caller = aiAgentRouter.createCaller(createTestContext());