feat: add maxTokens option to newChatStore

This commit is contained in:
2025-01-21 09:51:39 +08:00
parent edcdc70a2b
commit 6b78308bb5
2 changed files with 5 additions and 2 deletions

View File

@@ -205,7 +205,7 @@ class Chat {
this.top_p = top_p; this.top_p = top_p;
this.enable_top_p = enable_top_p; this.enable_top_p = enable_top_p;
this.presence_penalty = presence_penalty; this.presence_penalty = presence_penalty;
this.presence_penalty_enabled = presence_penalty_enabled this.presence_penalty_enabled = presence_penalty_enabled;
this.frequency_penalty = frequency_penalty; this.frequency_penalty = frequency_penalty;
this.frequency_penalty_enabled = frequency_penalty_enabled; this.frequency_penalty_enabled = frequency_penalty_enabled;
this.json_mode = json_mode; this.json_mode = json_mode;

View File

@@ -35,6 +35,7 @@ interface NewChatStoreOptions {
image_gen_key?: string; image_gen_key?: string;
json_mode?: boolean; json_mode?: boolean;
logprobs?: boolean; logprobs?: boolean;
maxTokens?: number;
} }
export const newChatStore = (options: NewChatStoreOptions): ChatStore => { export const newChatStore = (options: NewChatStoreOptions): ChatStore => {
@@ -52,7 +53,9 @@ export const newChatStore = (options: NewChatStoreOptions): ChatStore => {
maxTokens: getDefaultParams( maxTokens: getDefaultParams(
"max", "max",
models[getDefaultParams("model", options.model ?? DefaultModel)] models[getDefaultParams("model", options.model ?? DefaultModel)]
?.maxToken ?? 2048 ?.maxToken ??
options.maxTokens ??
2048
), ),
maxGenTokens: 2048, maxGenTokens: 2048,
maxGenTokens_enabled: false, maxGenTokens_enabled: false,