-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add api rate limit for azure openai
- Loading branch information
1 parent
9311c1f
commit 8decc71
Showing
3 changed files
with
124 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 11 additions & 2 deletions
13
src/app/routes/api/v3/admin/assistance/assistance.routes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
import { Router } from 'express' | ||
|
||
import { limitRate } from '../../../../../../app/utils/limit-rate' | ||
import { | ||
handleGenerateFormFields, | ||
handleGenerateQuestions, | ||
} from '../../../../../modules/form/admin-form/admin-form.assistance.controller' | ||
|
||
export const AssistanceRouter = Router() | ||
|
||
AssistanceRouter.post('/questions', handleGenerateQuestions) | ||
AssistanceRouter.post('/form-fields', handleGenerateFormFields) | ||
AssistanceRouter.post( | ||
'/questions', | ||
limitRate({ windowMs: 60 * 1000 * 60, max: 20 }), | ||
handleGenerateQuestions, | ||
) | ||
AssistanceRouter.post( | ||
'/form-fields', | ||
limitRate({ windowMs: 60 * 1000 * 60, max: 20 }), | ||
handleGenerateFormFields, | ||
) |