fix(chat-params): guard non-positive max output tokens
This commit is contained in:
@@ -253,4 +253,36 @@ describe("createChatParamsHandler", () => {
|
||||
options: {},
|
||||
})
|
||||
})
|
||||
|
||||
test("falls back to default maxOutputTokens when stored and compatibility tokens are non-positive", async () => {
|
||||
//#given
|
||||
setSessionPromptParams("ses_chat_params", {
|
||||
maxOutputTokens: 0,
|
||||
})
|
||||
|
||||
const handler = createChatParamsHandler({
|
||||
anthropicEffort: null,
|
||||
})
|
||||
|
||||
const input = {
|
||||
sessionID: "ses_chat_params",
|
||||
agent: { name: "oracle" },
|
||||
model: { providerID: "custom-provider", modelID: "custom-model" },
|
||||
provider: { id: "custom-provider" },
|
||||
message: {},
|
||||
}
|
||||
|
||||
const output: ChatParamsOutput = {
|
||||
topP: 1,
|
||||
topK: 1,
|
||||
maxOutputTokens: 0,
|
||||
options: {},
|
||||
}
|
||||
|
||||
//#when
|
||||
await handler(input, output)
|
||||
|
||||
//#then
|
||||
expect(output.maxOutputTokens).toBe(4096)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user