4e247c112e
Enumerate evidence kinds so education cannot be proposed as a kind, and stream Chinese thinking on a separate channel that collapses when the reply arrives. Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
/**
|
|
* Visible-answer generation settings shared by consultation and rectification.
|
|
*
|
|
* DeepSeek V4 Flash thinks by default, and those hidden tokens share
|
|
* `max_tokens` with the spoken answer. Consultation and rectification may
|
|
* enable a separate Chinese thinking channel; the spoken answer still uses
|
|
* this visible token budget. Default remains disabled for other callers.
|
|
*/
|
|
export const AGENT_MAX_OUTPUT_TOKENS = 8192;
|
|
|
|
type ThinkingMode = "enabled" | "disabled";
|
|
|
|
export function agentGenerationSettings(
|
|
model?: unknown,
|
|
options: { thinking?: ThinkingMode } = {},
|
|
) {
|
|
const thinking = { thinking: { type: (options.thinking ?? "disabled") as ThinkingMode } };
|
|
const providerId = typeof model === "string"
|
|
? model
|
|
: model && typeof model === "object" && "providerId" in model && typeof model.providerId === "string"
|
|
? model.providerId
|
|
: undefined;
|
|
const providerOptions: Record<string, typeof thinking> = {
|
|
openai: thinking,
|
|
};
|
|
if (providerId) providerOptions[providerId] = thinking;
|
|
return {
|
|
modelSettings: { maxOutputTokens: AGENT_MAX_OUTPUT_TOKENS },
|
|
providerOptions,
|
|
};
|
|
}
|