feat: 添加gemini协议适配 (#125)

* feat: 添加gemini协议适配

* Remove unrelated local files from Gemini PR
This commit is contained in:
SaltedFish555
2026-04-06 09:55:20 +08:00
committed by GitHub
parent 27825293bb
commit 0da5ec09e8
24 changed files with 2257 additions and 38 deletions

View File

@@ -20,6 +20,7 @@ import {
isNotEmptyMessage,
deriveUUID,
normalizeMessages,
normalizeMessagesForAPI,
isClassifierDenial,
buildYoloRejectionMessage,
buildClassifierUnavailableMessage,
@@ -486,3 +487,23 @@ describe("normalizeMessages", () => {
expect(normalized.length).toBe(1);
});
});
describe("normalizeMessagesForAPI", () => {
test("preserves Gemini thought signature metadata on tool_use blocks", () => {
const assistant = makeAssistantMsg([
{
type: "tool_use",
id: "tool-1",
name: "Bash",
input: { command: "pwd" },
_geminiThoughtSignature: "sig-123",
},
]);
const normalized = normalizeMessagesForAPI([assistant]);
const block = (normalized[0] as AssistantMessage).message.content[0] as any;
expect(block.type).toBe("tool_use");
expect(block._geminiThoughtSignature).toBe("sig-123");
});
});