Skip to content

Commit 16f91b5

Browse files
committed
improve compatibility
1 parent 6a48ba4 commit 16f91b5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/services/apis/custom-api.mjs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,15 @@ export async function generateAnswersWithCustomApi(port, question, session, apiK
6060
console.debug('json error', error)
6161
return
6262
}
63-
64-
answer +=
65-
data.choices[0]?.delta?.content ||
66-
data.choices[0]?.message?.content ||
67-
data.choices[0]?.text ||
68-
data.response ||
69-
''
63+
64+
if (data.response)
65+
answer = data.response
66+
else
67+
answer +=
68+
data.choices[0]?.delta?.content ||
69+
data.choices[0]?.message?.content ||
70+
data.choices[0]?.text ||
71+
''
7072
port.postMessage({ answer: answer, done: false, session: null })
7173
},
7274
async onStart() {},

0 commit comments

Comments
 (0)