增强各厂商思考与采样参数映射,并统一流式推理字段解析。

避免不同接口字段差异导致思考链丢失或采样参数被忽略。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-14 01:14:09 +08:00
co-authored by Cursor
parent e6d79d6a0c
commit 752eaccefa
12 changed files with 392 additions and 49 deletions
+26
View File
@@ -136,4 +136,30 @@ describe("wrapLlmForSession", () => {
);
expect(ctx.pendingContextTrace?.messages).toEqual(received[0].messages);
});
it("uses getPersona so @玩家 stays @玩家 during creation", async () => {
const preset: PresetPackage = {
...samplePreset,
prompts: [
{
id: "sys",
name: "系统",
enabled: true,
role: "system",
content: "称呼 @玩家",
marker: false,
sourceIdentifier: "sys",
},
],
};
const { provider, received } = recordingProvider();
const llm = wrapLlmForSession(
provider,
undefined,
() => preset,
() => ({ name: "@玩家", description: "占位" }),
);
await llm.complete([{ role: "user", content: "TASK" }]);
expect(received[0].messages[0].content).toBe("称呼 @玩家");
});
});