mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 17:30:16 +01:00
🔧 fix: OpenAIClient Response Handling for Legacy /v1/completions (#4128)
This commit is contained in:
parent
8dc5b320bc
commit
5f28682314
1 changed files with 6 additions and 0 deletions
|
|
@ -644,6 +644,12 @@ class OpenAIClient extends BaseClient {
|
||||||
|
|
||||||
if (completionResult && typeof completionResult === 'string') {
|
if (completionResult && typeof completionResult === 'string') {
|
||||||
reply = completionResult;
|
reply = completionResult;
|
||||||
|
} else if (
|
||||||
|
completionResult &&
|
||||||
|
typeof completionResult === 'object' &&
|
||||||
|
Array.isArray(completionResult.choices)
|
||||||
|
) {
|
||||||
|
reply = completionResult.choices[0]?.text?.replace(this.endToken, '');
|
||||||
}
|
}
|
||||||
} else if (typeof opts.onProgress === 'function' || this.options.useChatCompletion) {
|
} else if (typeof opts.onProgress === 'function' || this.options.useChatCompletion) {
|
||||||
reply = await this.chatCompletion({
|
reply = await this.chatCompletion({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue