浏览代码

Fixed when testing the openai compatible interface model, an error is reported when no object is returned (#7808)

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

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

@@ -150,9 +150,9 @@ class OAIAPICompatLargeLanguageModel(_CommonOAI_API_Compat, LargeLanguageModel):
except json.JSONDecodeError as e:
raise CredentialsValidateFailedError('Credentials validation failed: JSON decode error')

if (completion_type is LLMMode.CHAT and json_result['object'] == ''):
if (completion_type is LLMMode.CHAT and json_result.get('object','') == ''):
json_result['object'] = 'chat.completion'
elif (completion_type is LLMMode.COMPLETION and json_result['object'] == ''):
elif (completion_type is LLMMode.COMPLETION and json_result.get('object','') == ''):
json_result['object'] = 'text_completion'

if (completion_type is LLMMode.CHAT

正在加载...
取消
保存