Skip to content

Commit

Permalink
fix maximum token count (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhujunsan authored Jun 5, 2024
1 parent 6def50f commit 63a0f44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions service/src/chatgpt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export async function initApi(key: KeyConfig, chatModel: string, maxContextCount
// The token limit includes the token count from both the message array sent and the model response.
// 'gpt-35-turbo' has a limit of 4096 tokens, 'gpt-4' and 'gpt-4-32k' have limits of 8192 and 32768 tokens respectively.
// Check if the model type is GPT-4-turbo
if (model.toLowerCase().includes('1106-preview')) {
// If it's a '1106-preview' model, set the maxModelTokens to 131072
options.maxModelTokens = 131072
if (model.toLowerCase().includes('gpt-4o') || model.toLowerCase().includes('gpt-4-turbo') || model.toLowerCase().includes('1106-preview') || model.toLowerCase().includes('0125-preview')) {
// If it's a 'gpt-4o'/'gpt-4-turbo'/'1106-preview'/'0125-preview' model, set the maxModelTokens to 128000
options.maxModelTokens = 128000
options.maxResponseTokens = 32768
}
// Check if the model type includes '16k'
Expand Down
1 change: 1 addition & 0 deletions service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ router.get('/user-getamtinfo', auth, async (req, res) => {
res.send({ status: 'Fail', message: 'Read Amount Error', data: 0 })
}
})

// 兑换对话额度
router.post('/redeem-card', auth, async (req, res) => {
try {
Expand Down

0 comments on commit 63a0f44

Please sign in to comment.