Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 兼容 Web Search 原始 action 类型

DavidShen96a0b354f46d
diff --git a/apps/desktop/src/main/__tests__/codexTranslator.test.ts b/apps/desktop/src/main/__tests__/codexTranslator.test.ts
index bdfa045c03..c65d5667d1 100644
--- a/apps/desktop/src/main/__tests__/codexTranslator.test.ts
+++ b/apps/desktop/src/main/__tests__/codexTranslator.test.ts
@@ -268,7 +268,7 @@ describe('webSearch', () => {
});
});
- it('多查询、打开页面和页内查找都生成可读摘要', () => {
+ it('兼容 app-server snake_case 与历史 camelCase action 并生成可读摘要', () => {
feedItem('started', {
type: 'webSearch',
id: 'ws-many',
@@ -279,13 +279,13 @@ describe('webSearch', () => {
type: 'webSearch',
id: 'ws-open',
query: '',
- action: { type: 'openPage', url: 'https://example.com/page' },
+ action: { type: 'open_page', url: 'https://example.com/page' },
});
feedItem('started', {
type: 'webSearch',
id: 'ws-find',
query: '',
- action: { type: 'findInPage', url: 'https://example.com/page', pattern: 'needle' },
+ action: { type: 'find_in_page', url: 'https://example.com/page', pattern: 'needle' },
});
feedItem('started', {
type: 'webSearch',
@@ -348,7 +348,7 @@ describe('webSearch', () => {
type: 'webSearch',
id: 'ws-final-action',
query: '',
- action: { type: 'openPage', url: 'https://example.com/final' },
+ action: { type: 'open_page', url: 'https://example.com/final' },
});
expect(coll.events.map((event) => event.type)).toEqual([
@@ -371,7 +371,7 @@ describe('webSearch', () => {
toolName: 'web_search',
input: {
query: 'https://example.com/final',
- action: { type: 'openPage', url: 'https://example.com/final' },
+ action: { type: 'open_page', url: 'https://example.com/final' },
},
},
]);
diff --git a/packages/maker-core/src/agents/codex/translator.ts b/packages/maker-core/src/agents/codex/translator.ts
index 9663092d60..a889c6b073 100644
--- a/packages/maker-core/src/agents/codex/translator.ts
+++ b/packages/maker-core/src/agents/codex/translator.ts
@@ -426,8 +426,8 @@ interface McpToolCallItem {
type WebSearchAction =
| { type: 'search'; query?: string | null; queries?: string[] | null }
- | { type: 'openPage'; url?: string | null }
- | { type: 'findInPage'; url?: string | null; pattern?: string | null }
+ | { type: 'open_page' | 'openPage'; url?: string | null }
+ | { type: 'find_in_page' | 'findInPage'; url?: string | null; pattern?: string | null }
| { type: string; [k: string]: unknown };
interface WebSearchItem {
@@ -905,8 +905,10 @@ function webSearchActionDetail(action: WebSearchAction | null | undefined): stri
if (queries.length === 0) return '';
return queries.length > 1 ? `${queries[0]} ...` : queries[0];
}
+ case 'open_page':
case 'openPage':
return nonEmptyWebSearchText(action.url);
+ case 'find_in_page':
case 'findInPage': {
const url = nonEmptyWebSearchText(action.url);
const pattern = nonEmptyWebSearchText(action.pattern);