Skip to content

Commit

Permalink
chore: fix multiple error toasts and increase rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
kathleenkhy committed May 10, 2024
1 parent c0e57c7 commit dc20c7a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
5 changes: 1 addition & 4 deletions frontend/src/features/admin-form/assistance/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ export const useAssistanceMutations = () => {
try {
formFields = JSON.parse(parseModelOutput(data.content))
} catch (e) {
toast({
description: `Error creating form. Reason: ${e}`,
status: 'warning',
})
console.error(e)
throw e
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const MagicFormBuilderPdfDetailsScreen = (): JSX.Element => {
} = formMethods

pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker
// pdfjs.GlobalWorkerOptions.isEvalSupported = false

const [pdfFile, setPdfFile] = useState<File>()
const [pdfFileText, setPdfFileText] = useState<string>('')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,8 @@ const useMagicFormBuilderWizardContext = (
description: 'Successfully created form',
})
},
onError: () => {
toast({
description: 'Error creating form. Please try again.',
status: 'warning',
})
onError: (error) => {
console.error(error)
},
})
}
Expand All @@ -104,11 +101,8 @@ const useMagicFormBuilderWizardContext = (
description: 'Successfully created form',
})
},
onError: () => {
toast({
description: 'Error creating form. Please try again.',
status: 'warning',
})
onError: (error) => {
console.error(error)
},
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const generateQuestions = ({
function: getExpectedQuestionsListTool,
},
],
topP: 0.1,
} as GetChatCompletionsOptions

return ResultAsync.fromPromise(
Expand Down
4 changes: 2 additions & 2 deletions src/app/routes/api/v3/admin/assistance/assistance.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export const AssistanceRouter = Router()

AssistanceRouter.post(
'/questions',
limitRate({ windowMs: 60 * 1000 * 60, max: 20 }),
limitRate({ windowMs: 60 * 1000 * 60, max: 100 }),
handleGenerateQuestions,
)
AssistanceRouter.post(
'/form-fields',
limitRate({ windowMs: 60 * 1000 * 60, max: 20 }),
limitRate({ windowMs: 60 * 1000 * 60, max: 100 }),
handleGenerateFormFields,
)

0 comments on commit dc20c7a

Please sign in to comment.