mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
fix: update model config and improve version fallback handling
- Changed `DEFAULT_MODEL` from `"o1"` to `"gpt-4o"` in `etc/tool/commit.py` - Replaced `FALLBACK_MODELS` list with an empty list in `etc/tool/commit.py` - Moved spinner stop logic inside content-checking block in `generate_commit_message` in `etc/tool/commit.py` - Trimmed trailing characters "` \n" from returned content in `generate_commit_message` in `etc/tool/commit.py` - Wrapped cache check in `g4f/gui/server/api.py` in a `try` block to catch `RuntimeError` - Ensured fallback to `version.utils.latest_version` if cache access fails in `g4f/gui/server/api.py
This commit is contained in:
parent
99b02eed6e
commit
e9c75e99fa
2 changed files with 14 additions and 11 deletions
|
|
@ -31,8 +31,8 @@ from g4f import debug
|
|||
debug.logging = True
|
||||
|
||||
# Constants
|
||||
DEFAULT_MODEL = "o1"
|
||||
FALLBACK_MODELS = ["o1", "o3-mini", "gpt-4o"]
|
||||
DEFAULT_MODEL = "gpt-4o"
|
||||
FALLBACK_MODELS = []
|
||||
MAX_DIFF_SIZE = None # Set to None to disable truncation, or a number for character limit
|
||||
MAX_RETRIES = 3
|
||||
RETRY_DELAY = 2 # Seconds
|
||||
|
|
@ -193,15 +193,15 @@ def generate_commit_message(diff_text: str, model: str = DEFAULT_MODEL) -> Optio
|
|||
)
|
||||
content = []
|
||||
for chunk in response:
|
||||
# Stop spinner and clear line
|
||||
if spinner:
|
||||
spinner.set()
|
||||
print(" " * 50 + "\n", flush=True)
|
||||
spinner = None
|
||||
if isinstance(chunk.choices[0].delta.content, str):
|
||||
# Stop spinner and clear line
|
||||
if spinner:
|
||||
spinner.set()
|
||||
print(" " * 50 + "\n", flush=True)
|
||||
spinner = None
|
||||
content.append(chunk.choices[0].delta.content)
|
||||
print(chunk.choices[0].delta.content, end="", flush=True)
|
||||
return "".join(content).strip()
|
||||
return "".join(content).strip().strip("`")
|
||||
except Exception as e:
|
||||
# Stop spinner if it's running
|
||||
if 'spinner' in locals() and spinner:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue