Skip to content

Commit

Permalink
fix outi bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mluukkai committed Sep 28, 2024
1 parent c6b3bf9 commit db75e1e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/server/routes/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ openaiRouter.post('/stream', upload.single('file'), async (r, res) => {
(tokenCount / DEFAULT_TOKEN_LIMIT) * 100
)

if (tokenCount > 0.1 * DEFAULT_TOKEN_LIMIT && !userConsent) {
if (
model !== FREE_MODEL &&
tokenCount > 0.1 * DEFAULT_TOKEN_LIMIT &&
!userConsent
) {
return res.status(201).json({
tokenConsumtionWarning: true,
message: `You are about to use ${tokenUsagePercentage}% of your monthly CurreChat usage`,
Expand Down Expand Up @@ -132,7 +136,7 @@ openaiRouter.post('/stream', upload.single('file'), async (r, res) => {

if (courseId) {
await incrementCourseUsage(userToCharge, courseId, tokenCount)
} else if (model === 'gpt-4') {
} else if (model !== FREE_MODEL) {
await incrementUsage(userToCharge, tokenCount)
}

Expand Down

0 comments on commit db75e1e

Please sign in to comment.