feat: Add max output tokens configuration to Config page
This commit adds the configuration option for setting the maximum number of tokens output in the Config page. It includes the necessary changes to the Config.tsx file and the ConfigStore.ts file to handle the new "max_tokens" property in the models. This enhancement allows users to customize the maximum number of tokens generated by the chat models.
This commit is contained in:
parent
270b55e5de
commit
00f6abc1d6
@ -356,6 +356,15 @@ const Config = observer(() => {
|
||||
value={form.values?.models[current]?.max_input_tokens}
|
||||
onChange={(value) => changeModelDetail("max_input_tokens", value)}
|
||||
/>
|
||||
<NumberInput
|
||||
label={t("Max output tokens")}
|
||||
description={t(
|
||||
"the maximum number of tokens output"
|
||||
)}
|
||||
styles={commonInputStyle}
|
||||
value={form.values?.models[current]?.max_tokens}
|
||||
onChange={(value) => changeModelDetail("max_tokens", value)}
|
||||
/>
|
||||
{showProvider && (
|
||||
<Select
|
||||
label={t("Provider")}
|
||||
|
@ -32,6 +32,10 @@ export const Model = types.model({
|
||||
stream: types.boolean,
|
||||
max_input_tokens: types.number,
|
||||
category: types.string,
|
||||
context_size: types.number,
|
||||
temperature: types.number,
|
||||
max_tokens: types.number,
|
||||
json_mode: types.boolean,
|
||||
});
|
||||
|
||||
export const ConfigStore = types
|
||||
@ -55,6 +59,10 @@ export const ConfigStore = types
|
||||
provider: provider,
|
||||
stream: true,
|
||||
category: item.category ?? "chat",
|
||||
context_size: item.context_size ?? 8000,
|
||||
temperature: item.temperature ?? 0.3,
|
||||
max_tokens: item.max_tokens ?? 2000,
|
||||
json_mode: item.json_mode ?? false,
|
||||
};
|
||||
});
|
||||
self.modelNames = value
|
||||
|
Loading…
x
Reference in New Issue
Block a user