Skip to content

Commit

Permalink
fix: retrieve content from question prompt chatcompletionmessage
Browse files Browse the repository at this point in the history
  • Loading branch information
tshuli committed Jan 31, 2024
1 parent be9a381 commit b67261e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions frontend/src/features/admin-form/assistance/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ export const useAssistanceMutations = () => {

const createFieldsFromPromptMutation = useMutation((prompt: string) =>
generateQuestions(prompt)
.then((questions) =>
generateFormFields(ContentTypes.QUESTIONS, String(questions)),
)
.then((questions) => {
if (!questions.content) {
throw new Error('No content in questions')
}

return generateFormFields(ContentTypes.QUESTIONS, questions.content)
})
.then((data) => {
let formFields
if (data.content) {
Expand Down

0 comments on commit b67261e

Please sign in to comment.