Skip to content

Commit 8b4169a

Browse files
committed
fix maximum token count
1 parent 6def50f commit 8b4169a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

service/src/chatgpt/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ export async function initApi(key: KeyConfig, chatModel: string, maxContextCount
5959
// The token limit includes the token count from both the message array sent and the model response.
6060
// 'gpt-35-turbo' has a limit of 4096 tokens, 'gpt-4' and 'gpt-4-32k' have limits of 8192 and 32768 tokens respectively.
6161
// Check if the model type is GPT-4-turbo
62-
if (model.toLowerCase().includes('1106-preview')) {
63-
// If it's a '1106-preview' model, set the maxModelTokens to 131072
64-
options.maxModelTokens = 131072
62+
if (model.toLowerCase().includes('gpt-4o') || model.toLowerCase().includes('gpt-4-turbo') || model.toLowerCase().includes('1106-preview') || model.toLowerCase().includes('0125-preview')) {
63+
// If it's a 'gpt-4o'/'gpt-4-turbo'/'1106-preview'/'0125-preview' model, set the maxModelTokens to 128000
64+
options.maxModelTokens = 128000
6565
options.maxResponseTokens = 32768
6666
}
6767
// Check if the model type includes '16k'

service/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ router.get('/user-getamtinfo', auth, async (req, res) => {
557557
res.send({ status: 'Fail', message: 'Read Amount Error', data: 0 })
558558
}
559559
})
560+
560561
// 兑换对话额度
561562
router.post('/redeem-card', auth, async (req, res) => {
562563
try {

0 commit comments

Comments
 (0)