mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
fix: remove unused tool_calls and debug logging, fix file ops
- Removed default `tool_calls` assignment from `Api.__call__` in `api.py` - Removed `debug.error()` logging in two exception blocks in `api.py` - Fixed malformed URL in `CohereForAI_C4AI_Command.url` by removing leading tab in `CohereForAI_C4AI_Command.py` - Replaced incorrect `result.text_content` access with just `result` in `Backend_Api.upload_bucket` in `backend_api.py` - Replaced `shutil.copyfile` with `os.rename`, and added fallback to `shutil.copyfile` on failure in `Backend_Api.upload_bucket` in `backend_api.py
This commit is contained in:
parent
8f63f656a2
commit
ba20b2f302
3 changed files with 7 additions and 12 deletions
|
|
@ -107,12 +107,6 @@ class Api:
|
|||
model = json_data.get('model')
|
||||
provider = json_data.get('provider')
|
||||
messages = json_data.get('messages')
|
||||
kwargs["tool_calls"] = [{
|
||||
"function": {
|
||||
"name": "bucket_tool"
|
||||
},
|
||||
"type": "function"
|
||||
}]
|
||||
action = json_data.get('action')
|
||||
if action == "continue":
|
||||
kwargs["tool_calls"].append({
|
||||
|
|
@ -186,7 +180,6 @@ class Api:
|
|||
yield self._format_json("conversation_id", conversation_id)
|
||||
elif isinstance(chunk, Exception):
|
||||
logger.exception(chunk)
|
||||
debug.error(chunk)
|
||||
yield self._format_json('message', get_error_message(chunk), error=type(chunk).__name__)
|
||||
elif isinstance(chunk, RequestLogin):
|
||||
yield self._format_json("preview", chunk.to_string())
|
||||
|
|
@ -232,7 +225,6 @@ class Api:
|
|||
yield self._format_json('auth', type(e).__name__, message=get_error_message(e))
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
debug.error(e)
|
||||
yield self._format_json('error', type(e).__name__, message=get_error_message(e))
|
||||
finally:
|
||||
yield from self._yield_logs()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue