浏览代码

fix(openai_api_compatible): fixing the error when converting chunk to json (#3570)

tags/0.6.4
aniaan 1年前
父节点
当前提交
aa6d2e3035
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2
    1
      api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py

+ 2
- 1
api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py 查看文件

@@ -154,7 +154,7 @@ class OAIAPICompatLargeLanguageModel(_CommonOAI_API_Compat, LargeLanguageModel):
json_result['object'] = 'chat.completion'
elif (completion_type is LLMMode.COMPLETION and json_result['object'] == ''):
json_result['object'] = 'text_completion'
if (completion_type is LLMMode.CHAT
and ('object' not in json_result or json_result['object'] != 'chat.completion')):
raise CredentialsValidateFailedError(
@@ -425,6 +425,7 @@ class OAIAPICompatLargeLanguageModel(_CommonOAI_API_Compat, LargeLanguageModel):
finish_reason = 'Unknown'

for chunk in response.iter_lines(decode_unicode=True, delimiter=delimiter):
chunk = chunk.strip()
if chunk:
# ignore sse comments
if chunk.startswith(':'):

正在加载...
取消
保存