From b543b111bac6900bdc48e123b3c97482fe81e63a Mon Sep 17 00:00:00 2001 From: Morgan Date: Fri, 8 Aug 2025 11:21:10 +0900 Subject: [PATCH] Fix --- src/lib/ChatRequest.svelte | 17 ++++++------ src/lib/Settings.svelte | 57 ++++++++++++++++---------------------- src/lib/api/models.json | 8 +++--- 3 files changed, 36 insertions(+), 46 deletions(-) diff --git a/src/lib/ChatRequest.svelte b/src/lib/ChatRequest.svelte index 076bb13..63b48f8 100644 --- a/src/lib/ChatRequest.svelte +++ b/src/lib/ChatRequest.svelte @@ -191,25 +191,24 @@ export class ChatRequest { if (typeof setting.apiTransform === 'function') { value = setting.apiTransform(chatId, setting, value) } + console.log(key, value); if (key === 'max_tokens') { if (opts.maxTokens) value = opts.maxTokens // only as large as requested if (value > maxAllowed || value < 1) value = null // if over max model, do not define max if (value) value = Math.floor(value) - if (modelDetail.reasoning == true) { - key = 'max_completion_tokens' - } + key = 'max_completion_tokens' } if (key === 'n') { if (opts.streaming || opts.summaryRequest) { - /* - Streaming goes insane with more than one completion. - Doesn't seem like there's any way to separate the jumbled mess of deltas for the - different completions. - Summary should only have one completion - */ value = 1 } } + if ( key === 'reasoning_effort') { + if (modelDetail.extparams != true) return acc + } + if ( key === 'verbosity') { + if (modelDetail.extparams != true) return acc + } if (value !== null) acc[key] = value return acc }, {}), diff --git a/src/lib/Settings.svelte b/src/lib/Settings.svelte index 2358c91..919ffe5 100644 --- a/src/lib/Settings.svelte +++ b/src/lib/Settings.svelte @@ -79,7 +79,8 @@ const gptDefaults = { presence_penalty: 0, frequency_penalty: 0, logit_bias: null, - user: undefined + reasoning_effort: null, + verbosity: null, } // Core set of defaults @@ -634,6 +635,28 @@ const chatSettingsList: ChatSetting[] = [ }, hide: hideModelSetting }, + { + key: 'reasoning_effort', + name: 'Reasoning Effort', + title: 'minimal, low, medium, high', + type: 'text', + placeholder: (chatId) => { + const val = getModelDetail(getChatSettings(chatId).model).systemEnd + return val || '' + }, + hide: () => false + }, + { + key: 'verbosity', + name: 'Verbosity', + title: 'low, medium, high', + type: 'text', + placeholder: (chatId) => { + const val = getModelDetail(getChatSettings(chatId).model).systemEnd + return val || '' + }, + hide: () => false + }, { key: 'leadPrompt', name: 'Completion Lead Sequence', @@ -645,38 +668,6 @@ const chatSettingsList: ChatSetting[] = [ }, hide: hideModelSetting }, - { - // logit bias editor not implemented yet - key: 'logit_bias', - name: 'Logit Bias', - title: 'Allows you to adjust bias of tokens used in completion.', - header: 'Logit Bias. See this article for more details.', - type: 'other', - hide: () => true, - // transform to word->weight pairs to token(s)->weight. - // -- care should be taken to have each word key in the each record formatted in a way where they - // only take one token each else you'll end up with results you probably don't want. - // Generally, leading space plus common lower case word will more often result in a single token - // See: https://platform.openai.com/tokenizer - apiTransform: (chatId, setting, val:Record) => { - // console.log('logit_bias', val, getChatSettings(chatId).logit_bias) - if (!val) return null - const tokenized:Record = Object.entries(val).reduce((a, [k, v]) => { - const tokens:number[] = getTokens(getChatSettings(chatId).model, k) - tokens.forEach(t => { a[t] = v }) - return a - }, {} as Record) - return tokenized - } - }, - // Enable? - { - key: 'user', - name: 'User?', - title: 'Name of user?', - type: 'text', - hide: () => true - } ] const chatSettingLookup:Record = chatSettingsList.reduce((a, v) => { diff --git a/src/lib/api/models.json b/src/lib/api/models.json index f18b013..bf1f2b2 100644 --- a/src/lib/api/models.json +++ b/src/lib/api/models.json @@ -2,10 +2,10 @@ "claude-sonnet-4-20250514": { "prompt": 3.0, "completion": 15.0, "max": 200000 }, "claude-opus-4-20250514": { "prompt": 15.0, "completion": 75.0, "max": 200000 }, "claude-3-7-sonnet-20250219": { "prompt": 3.0, "completion": 15.0, "max": 200000 }, - "gpt-5": { "prompt": 1.25, "completion": 10.0, "max": 131072 }, - "gpt-5-mini": { "prompt": 0.25, "completion": 2.00, "max": 131072 }, - "gpt-5-nano": { "prompt": 0.05, "completion": 0.40, "max": 131072 }, - "gpt-5-chat-latest": { "prompt": 1.25, "completion": 10.0, "max": 131072 }, + "gpt-5": { "prompt": 1.25, "completion": 10.0, "max": 200000, "reasoning": true }, + "gpt-5-mini": { "prompt": 0.25, "completion": 2.00, "max": 200000, "reasoning": true }, + "gpt-5-nano": { "prompt": 0.05, "completion": 0.40, "max": 200000, "reasoning": true }, + "gpt-5-chat-latest": { "prompt": 1.25, "completion": 10.0, "max": 200000, "reasoning": true }, "gpt-4.1": { "prompt": 2.00, "completion": 8.00, "max": 131072 }, "gpt-4.1-mini": { "prompt": 0.40, "completion": 1.60, "max": 131072 }, "gpt-4.1-nano": { "prompt": 0.10, "completion": 0.03, "max": 131072 },