feat: update providers, model selection, media handling, and routing

- Added GithubCopilotAPI provider to g4f/Provider/needs_auth and __init__.py
- Fixed typo "GGOGLE_SID_COOKIE" to "GOOGLE_SID_COOKIE" in Gemini.py and updated all references
- Updated PollinationsAI.py:
  - Refined model aliases and removed/commented unused/legacy aliases
  - Updated logic for loading audio and vision models, using swap_models for alias reversals
  - Adjusted get_model and model loading methods for accuracy
  - Changed default model lists for text, image, and vision models
  - Updated conversation title and followup labels for followups tools
- Modified save_content in g4f/cli/client.py to handle url downloads for lists, allow cookies/headers, and removed duplicate HTTP download logic
- Added asyncio sleep after stdout writes in stream_response for smoother streaming
- Changed website.py render default to "home," adjusted chat route to accept any filename, and updated filenames used for rendering
- Updated model selection in g4f/models.py by removing PollinationsAI from best_provider and changing model provider order for specific models
- Enhanced media merging in g4f/tools/media.py to clarify comment about last user message and handle content appending for lists in render_messages
- Updated OpenaiTemplate.py to add an image_url field if media with http(s) URLs is present
- Adjusted test_provider_has_model in etc/unittest/models.py to skip providers requiring auth
This commit is contained in:
hlohaus 2025-07-09 19:36:58 +02:00
parent 78c0d67d54
commit 6c126e468c
11 changed files with 79 additions and 72 deletions

View file

@ -347,7 +347,7 @@ def generate_commit_message(diff_text: str, model: str = DEFAULT_MODEL, max_retr
spinner = None
content.append(chunk.choices[0].delta.content)
print(chunk.choices[0].delta.content, end="", flush=True)
return "".join(content).strip("`").strip()
return "".join(content).strip("`").split("\n---\n")[0].strip()
except Exception as e:
# Stop spinner if it's running
if 'spinner' in locals() and spinner:

View file

@ -12,6 +12,8 @@ class TestProviderHasModel(unittest.TestCase):
def test_provider_has_model(self):
for model, providers in __models__.values():
for provider in providers:
if provider.needs_auth:
continue
if issubclass(provider, ProviderModelMixin):
provider.get_models() # Update models
if model.name in provider.model_aliases: