mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-21 00:36:53 +08:00
fix: the object field is empty string in some openAI api compatible model (#3506)
This commit is contained in:
@@ -150,6 +150,8 @@ class OAIAPICompatLargeLanguageModel(_CommonOAI_API_Compat, LargeLanguageModel):
|
|||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
raise CredentialsValidateFailedError('Credentials validation failed: JSON decode error')
|
raise CredentialsValidateFailedError('Credentials validation failed: JSON decode error')
|
||||||
|
|
||||||
|
if (completion_type is LLMMode.CHAT and json_result['object'] == ''):
|
||||||
|
json_result['object'] = 'chat.completion'
|
||||||
if (completion_type is LLMMode.CHAT
|
if (completion_type is LLMMode.CHAT
|
||||||
and ('object' not in json_result or json_result['object'] != 'chat.completion')):
|
and ('object' not in json_result or json_result['object'] != 'chat.completion')):
|
||||||
raise CredentialsValidateFailedError(
|
raise CredentialsValidateFailedError(
|
||||||
|
|||||||
Reference in New Issue
Block a user