mirror of
https://github.com/morgan9e/chatgpt-web
synced 2026-04-13 16:04:05 +09:00
Fix
This commit is contained in:
@@ -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
|
||||
}, {}),
|
||||
|
||||
@@ -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 <a target="_blank" href="https://help.openai.com/en/articles/5247780-using-logit-bias-to-define-token-probability">this article</a> 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<string, number>) => {
|
||||
// console.log('logit_bias', val, getChatSettings(chatId).logit_bias)
|
||||
if (!val) return null
|
||||
const tokenized:Record<number, number> = 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<number, number>)
|
||||
return tokenized
|
||||
}
|
||||
},
|
||||
// Enable?
|
||||
{
|
||||
key: 'user',
|
||||
name: 'User?',
|
||||
title: 'Name of user?',
|
||||
type: 'text',
|
||||
hide: () => true
|
||||
}
|
||||
]
|
||||
|
||||
const chatSettingLookup:Record<string, ChatSetting> = chatSettingsList.reduce((a, v) => {
|
||||
|
||||
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user