增强各厂商思考与采样参数映射,并统一流式推理字段解析。
避免不同接口字段差异导致思考链丢失或采样参数被忽略。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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("称呼 @玩家");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user