mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-10-25 01:00:28 +08:00
Update api.py
This commit is contained in:
@@ -98,9 +98,7 @@ class Api():
|
|||||||
if conversation_id and provider in conversations and conversation_id in conversations[provider]:
|
if conversation_id and provider in conversations and conversation_id in conversations[provider]:
|
||||||
kwargs["conversation"] = conversations[provider][conversation_id]
|
kwargs["conversation"] = conversations[provider][conversation_id]
|
||||||
|
|
||||||
model = json_data.get('model')
|
model = json_data.get('model', models.default)
|
||||||
model = model if model else models.default
|
|
||||||
patch = patch_provider if json_data.get('patch_provider') else None
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"model": model,
|
"model": model,
|
||||||
@@ -108,7 +106,6 @@ class Api():
|
|||||||
"messages": messages,
|
"messages": messages,
|
||||||
"stream": True,
|
"stream": True,
|
||||||
"ignore_stream": True,
|
"ignore_stream": True,
|
||||||
"patch_provider": patch,
|
|
||||||
"return_conversation": True,
|
"return_conversation": True,
|
||||||
**kwargs
|
**kwargs
|
||||||
}
|
}
|
||||||
@@ -161,7 +158,7 @@ class Api():
|
|||||||
'type': response_type,
|
'type': response_type,
|
||||||
response_type: content
|
response_type: content
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_error_message(exception: Exception) -> str:
|
def get_error_message(exception: Exception) -> str:
|
||||||
"""
|
"""
|
||||||
Generates a formatted error message from an exception.
|
Generates a formatted error message from an exception.
|
||||||
|
|||||||
Reference in New Issue
Block a user