From 6e3092afeaacf8ac75ecfaca19cb5f660cba612a Mon Sep 17 00:00:00 2001 From: AlkaidSTART <2595006848@qq.com> Date: Mon, 24 Aug 2026 14:21:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20startServer=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=9B=91=E5=90=AC=E5=9C=B0=E5=9D=80=E6=94=AF=E6=8C=81=20CALL?= =?UTF-8?q?=5FCODE=5FWEB=5FHOST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/server/src/index.ts | 3 ++- tests/server.spec.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 3cbc1a6..5272177 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -66,7 +66,8 @@ export const startServer = async ( const port = config.port ?? Number(process.env.CALL_CODE_WEB_PORT ?? 4173); - const host = config.host ?? "127.0.0.1"; + const host = + config.host ?? process.env.CALL_CODE_WEB_HOST ?? "127.0.0.1"; const clientDir = config.clientDir; const handle = await startWebServer({ diff --git a/tests/server.spec.ts b/tests/server.spec.ts index 3de212e..3ed472d 100644 --- a/tests/server.spec.ts +++ b/tests/server.spec.ts @@ -162,4 +162,14 @@ describe("Server SDK 与集成服务", () => { data.sessions[0].entries.some((entry) => entry.text === "已处理完毕"), ).toBe(true); }); + + it("startServer 默认监听地址读取 CALL_CODE_WEB_HOST", async () => { + process.env.CALL_CODE_WEB_HOST = "0.0.0.0"; + try { + const { server } = await createTestServer(); + expect(server.host).toBe("0.0.0.0"); + } finally { + delete process.env.CALL_CODE_WEB_HOST; + } + }); }); From a037b6ab64d955059e2a8ab5606698fad86b4d73 Mon Sep 17 00:00:00 2001 From: AlkaidSTART <2595006848@qq.com> Date: Mon, 24 Aug 2026 14:27:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E8=BF=87=E6=BB=A4=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E8=BE=93=E5=87=BA=EF=BC=8C=E7=A1=AE=E4=BF=9D=E5=9C=A8?= =?UTF-8?q?=E6=89=80=E6=9C=89=E8=A7=86=E5=9B=BE=E4=B8=AD=E4=B8=8D=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E5=8E=8B=E7=BC=A9=E6=91=98=E8=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/utils.ts | 6 ++++-- tests/client-ui.spec.ts | 32 ++++++++++++++++++++++++++++++++ tests/client-utils.spec.ts | 18 ++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/packages/client/src/utils.ts b/packages/client/src/utils.ts index 2cf552b..c465848 100644 --- a/packages/client/src/utils.ts +++ b/packages/client/src/utils.ts @@ -93,8 +93,10 @@ export const filterSessions = (sessions: WebSession[], query: string): WebSessio sessions.filter((session) => matchesQuery(session, query)); export const filterEntries = (entries: WebEntry[], filter: Filter): WebEntry[] => { + // 压缩摘要等 system 输出只写入历史供上下文使用,不在界面上展示 + const visible = entries.filter((entry) => entryRole(entry) !== 'system'); if (filter === 'all') { - return entries; + return visible; } - return entries.filter((entry) => entryRole(entry) === filter); + return visible.filter((entry) => entryRole(entry) === filter); }; diff --git a/tests/client-ui.spec.ts b/tests/client-ui.spec.ts index c370f5a..9629d78 100644 --- a/tests/client-ui.spec.ts +++ b/tests/client-ui.spec.ts @@ -140,6 +140,38 @@ describe("client MainPanel", () => { expect(html).toContain('aria-label="压缩会话上下文" disabled=""'); }); + it("不渲染 system 输出(压缩摘要)", () => { + const session = makeSession({ + entries: [ + ...makeSession().entries, + { + seq: 3, + id: "e3", + parentId: null, + type: "compaction", + role: "system", + timestamp: "2026-08-05T00:00:00.000Z", + text: "手动压缩摘要", + payload: { summary: "手动压缩摘要" }, + }, + ], + }); + const html = renderToStaticMarkup( + React.createElement(MainPanel, { + session, + filter: "all", + onFilterChange: () => undefined, + onDeleteEntry: () => undefined, + chatStatus: { status: "idle" }, + onSendMessage: () => true, + onCompactSession: () => undefined, + }), + ); + + expect(html).not.toContain("手动压缩摘要"); + expect(html).not.toContain(">系统<"); + }); + it("没有会话时禁用压缩入口", () => { const html = renderToStaticMarkup( React.createElement(MainPanel, { diff --git a/tests/client-utils.spec.ts b/tests/client-utils.spec.ts index cc18525..c01f42f 100644 --- a/tests/client-utils.spec.ts +++ b/tests/client-utils.spec.ts @@ -122,4 +122,22 @@ describe('client utils', () => { expect(filterEntries(entries, 'tool')).toEqual([entries[2]]); expect(filterEntries(entries, 'system')).toEqual([]); }); + + it('全部视图不展示 system 输出', () => { + const entries = [ + makeEntry({ id: 'u1', type: 'user', role: 'user' }), + makeEntry({ + id: 'c1', + type: 'compaction', + role: 'system', + text: '手动压缩摘要', + }), + makeEntry({ id: 'a1', type: 'assistant', role: 'assistant' }), + ]; + + expect(filterEntries(entries, 'all')).toEqual([ + entries[0], + entries[2], + ]); + }); });