update model options settings

This commit is contained in:
duanfuxiang
2025-04-10 19:57:25 +08:00
parent f83e5b5a66
commit 49d52a5ffa
3 changed files with 107 additions and 27 deletions

View File

@@ -6,10 +6,10 @@ export const MIN_MAX_CHAR_LIMIT = 100;
export const MAX_MAX_CHAR_LIMIT = 10000;
export const MIN_MAX_TOKENS = 128;
export const MAX_MAX_TOKENS = 8192;
export const MIN_TEMPERATURE = 0;
export const MAX_TEMPERATURE = 1;
export const MIN_TOP_P = 0;
export const MAX_TOP_P = 1;
export const MIN_TEMPERATURE = 0.0;
export const MAX_TEMPERATURE = 1.0;
export const MIN_TOP_P = 0.0;
export const MAX_TOP_P = 1.0;
export const MIN_FREQUENCY_PENALTY = 0;
export const MAX_FREQUENCY_PENALTY = 2;
export const MIN_PRESENCE_PENALTY = 0;
@@ -34,17 +34,18 @@ export const ollamaApiSettingsSchema = z.object({
export const modelOptionsSchema = z.object({
temperature: z.number()
.min(0, { message: `Temperature must be at least ${MIN_TEMPERATURE}` })
.max(1, { message: `Temperature must be at most ${MAX_TEMPERATURE}` }),
.min(MIN_TEMPERATURE, { message: `Temperature must be at least ${MIN_TEMPERATURE}` }),
top_p: z.number()
.min(0, { message: `top_p must be greater than ${MIN_TOP_P}` })
.max(1, { message: `top_p must be at most ${MAX_TOP_P}` }),
.min(MIN_TOP_P, { message: `top_p must be greater than ${MIN_TOP_P}` })
.max(MAX_TOP_P, { message: `top_p must be at most ${MAX_TOP_P}` }),
frequency_penalty: z.number()
.min(0, { message: `Frequency penalty must be at least ${MIN_FREQUENCY_PENALTY}` })
.max(2, { message: `Frequency penalty must be at most ${MAX_FREQUENCY_PENALTY}` }),
presence_penalty: z.number().min(MIN_PRESENCE_PENALTY, { message: `Presence penalty must be at least ${MIN_PRESENCE_PENALTY}` }).max(MAX_PRESENCE_PENALTY, { message: `Presence penalty must be at most ${MAX_PRESENCE_PENALTY}` }),
.min(MIN_FREQUENCY_PENALTY, { message: `Frequency penalty must be at least ${MIN_FREQUENCY_PENALTY}` })
.max(MAX_FREQUENCY_PENALTY, { message: `Frequency penalty must be at most ${MAX_FREQUENCY_PENALTY}` }),
presence_penalty: z.number()
.min(MIN_PRESENCE_PENALTY, { message: `Presence penalty must be at least ${MIN_PRESENCE_PENALTY}` })
.max(MAX_PRESENCE_PENALTY, { message: `Presence penalty must be at most ${MAX_PRESENCE_PENALTY}` }),
max_tokens: z.number().int()
.min(MIN_MAX_TOKENS, { message: `max_tokens must be at least than ${MIN_MAX_TOKENS}` }).max(MAX_MAX_TOKENS, { message: `max_tokens must be at most ${MAX_MAX_TOKENS}` }),
.min(MIN_MAX_TOKENS, { message: `max_tokens must be at least than ${MIN_MAX_TOKENS}` }),
}).strict();
export const fewShotExampleSchema = z.object({