fix: broken cohere API response transform

This commit is contained in:
Louis 2024-11-20 21:36:08 +07:00
parent c6e1bb55f9
commit 4820218a11
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2

View File

@ -113,6 +113,8 @@ export default class JanInferenceCohereExtension extends RemoteOAIEngine {
}
transformResponse = (data: any) => {
return typeof data === 'object' ? data.text : JSON.parse(data).text ?? ''
return typeof data === 'object'
? data.text
: (JSON.parse(data.replace('data: ', '').trim()).text ?? '')
}
}