Skip to content

Commit 362e5fb

Browse files
author
Felipe Gomide
committed
fix: changed openAI's response format to fix issue strapi#9: Completion error: Cannot read properties of undefined (reading 'trim')
1 parent 39f9b83 commit 362e5fb

File tree

1 file changed

+1
-1
lines changed
  • admin/src/components/CMEditView/RightLinksCompo

1 file changed

+1
-1
lines changed

admin/src/components/CMEditView/RightLinksCompo/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const RightLinksCompo = () => {
131131
completionAPI
132132
.create({ model, messages, temperature, maxTokens })
133133
.then((data) => {
134-
setCompletion(data?.choices[0]?.text.trim());
134+
setCompletion(data?.choices[0]?.message?.content.trim());
135135
setFinishReason(data?.choices[0]?.finish_reason);
136136
})
137137
.finally(() => {

0 commit comments

Comments
 (0)