Commit Graph

26 Commits

Author SHA1 Message Date
hlohaus
ae5d7a193a Update website.py 2025-06-14 00:13:19 +02:00
hlohaus
c3aca8964c refactor: adjust model check, tool calls, and response handling logic
- Updated `thinking_enabled` condition in `DeepSeekAPI.py` to ensure `model` is not None before checking substring
- Removed default `tool_calls` value in `/backend-api/v2/create` route in `backend_api.py`
- Simplified response caching logic by consolidating `cast_str` handling and ensuring `response` is a string before writing
- Adjusted response filtering logic to handle string vs iterable cases more consistently
- Refined safe search tag check in file matching loop to only test the first tag against MIME type in `backend_api.py`
- Changed default filename from "index" to "home" in `_index` method of `website.py
2025-05-21 15:05:43 +02:00
hlohaus
9461949542 feat: improve media handling, file conversion, and error management
- Added UUID-based "x-xai-request-id" header and 403 error handling in Grok.py
- Updated backend_api.py to handle empty media results and unsupported file types with error raising and file cleanup
- Simplified render logic in website.py by removing is_live flag and related code
- Changed "audio/wav" MIME type to "audio/x-wav" in image/__init__.py
- Added is_valid_media and is_valid_audio functions to image/__init__.py for stricter media validation
- Enhanced MarkItDown integration in markitdown/__init__.py with convert_stream method supporting non-seekable streams
- Modified _transcribe_audio.py to use recognize_faster_whisper if available, fallback to recognize_google
- Updated providers/helper.py to prioritize "text" key in to_string function
- Improved stream_read_files in files.py to skip DOWNLOADS_FILE and adjust code block formatting
- Added get_filename_from_url utility in files.py for consistent filename generation from URLs
- Enhanced download_urls in files.py to use MarkItDown for URL conversion and improved error logging
- Improved render_part and related functions in media.py to use new media validation logic and handle more cases
- Adjusted merge_media and render_messages in media.py for stricter part filtering and validation
2025-05-20 22:40:12 +02:00
hlohaus
57cbd55d74 feat: integrate Pollinations AI enhancements and simplify gpt4free references
- Replaced the large GitHub project stats table in `README.md` with summaries and logos for Pollinations AI and MoneyPrinter V2
- Introduced `STATIC_URL` and `DIST_DIR` constants in new `g4f/constants.py` and used them across multiple files
- Updated `PollinationsAI.py` to support conversation title and follow-up generation using tool calls
- Modified `PollinationsAI.py` and `PollinationsImage.py` to use `STATIC_URL` for the `referrer` header
- Enhanced `PollinationsAI.stream_complete` to yield `ToolCalls`, `TitleGeneration`, and `SuggestedFollowups`
- Added `ToolCalls` handling in `client/__init__.py` to support non-stream and stream modes
- Updated `ChatCompletionDelta` model in `client/stubs.py` to support `ToolCalls`
- Modified `HarProvider` to merge `DEFAULT_HEADERS` into request headers
- Improved `OpenaiChat.py` by adding optional chaining to page evaluation expressions for robustness
- Updated `any_provider.py` to force use of `PollinationsAI` if `tools` key is present in kwargs
- Refactored `is_content` into a reusable function in `providers/response.py` and used in `retry_provider.py`
- Updated `gui/server/website.py` to use `STATIC_URL` and simplify `GPT4FREE_URL` handling
- Removed redundant constants from `version.py` and imported them from `constants.py
2025-05-18 01:54:09 +02:00
hlohaus
3775c1e06d fix: improve error handling and add type checks in various providers and API
- Updated error handling in g4f/Provider/DDG.py to raise ResponseError instead of yield error strings
- Replaced yield statements with raises in g4f/Provider/DDG.py for HTTP and response errors
- Added response raising in g4f/Provider/DeepInfraChat.py for image upload responses
- Included model alias validation and error raising in g4f/Provider/hf/HuggingFaceMedia.py
- Corrected model alias dictionary key in g4f/Provider/hf_space/StabilityAI_SD35Large.py
- Ensured referrer parameter default value in g4f/Provider/PollinationsImage.py
- Removed duplicate imports and adjusted get_models method in g4f/Provider/har/__init__.py
- Modified g4f/gui/server/api.py to remove unused conversation parameter in _create_response_stream
- Fixed logic to handle single exception in g4f/providers/retry_provider.py
- Added missing import of JsonConversation in g4f/providers/retry_provider.py
- Corrected stream_read_files to replace extension in return string in g4f/tools/files.py
2025-05-17 10:02:13 +02:00
hlohaus
8c3764dfeb feat: enhance audio model handling and improve image URL resolution
- Updated `PollinationsAI` to exclude "gemini" model from `audio_models`
- Added logic in `PollinationsAI` to expand `audio_models` with voices from `default_audio_model`
- Appended voice names to `text_models` list in `PollinationsAI` if present in `default_audio_model`
- Modified `PollinationsAI._generate_text` to inject `audio` parameters when a voice model is used
- Updated `save_response_media` call to include voice name in model list
- Changed `OpenaiChat.get_generated_image` to support both `file-service://` and `sediment://` URLs using `conversation_id`
- Modified `OpenaiChat.create_messages` to optionally pass `prompt`
- Adjusted `OpenaiChat.run` to determine `prompt` explicitly and set messages accordingly
- Updated `OpenaiChat.iter_messages_line` to handle `None` in `fields.p` safely
- Passed `prompt` and `conversation_id` to `OpenaiChat.get_generated_image` inside image parsing loop
- Fixed redirect logic in `backend_api.py` to safely handle missing `skip` query param
- Enhanced `render` function in `website.py` to support live file serving with `live` query param
- Added new route `/dist/<path:name>` to serve static files from `DIST_DIR` in `website.py`
- Adjusted `render` to include `.live` suffix in cache filename when applicable
- Modified HTML replacements in `render` to preserve local `dist/` path if `add_origion` is True
2025-04-21 08:43:32 +02:00
hlohaus
236d2aa114 Remove client files from main package 2025-04-20 20:44:10 +02:00
hlohaus
d38755b42a Code review changes 2025-03-30 17:57:42 +02:00
hlohaus
a1871dafeb Improve background page
Improve share js functions
Fix photoswipe in UI
Support n parameter in PollinationsAI
2025-03-26 21:39:19 +01:00
hlohaus
13810b8ae0 Use loading icon 2025-03-25 11:55:29 +01:00
hlohaus
142e4876ae Add background page 2025-03-25 04:32:11 +01:00
hlohaus
ae1fae7ef0 Add chat share function 2025-03-25 01:46:57 +01:00
hlohaus
5cbbe2fd3d Fix model and provider in chat completion response
Add login button to HuggingFace demo
Custom conversation ids in chat ui
Remove rate limiter in demo mode
Improve YouTube support in Gemini
2025-02-24 08:53:43 +01:00
hlohaus
31a4812d7a Improve copy_images api
Update share target support
Improve search enabled hightlight
2025-02-05 22:11:19 +01:00
hlohaus
19bf5b7ef6 Fix upload files in demo mode
Updates for memory with mem0
Fix asyncio import in nodriver function
Add provider specific api endpoints
Support for open settings in UI at /chat/settings
2025-01-26 21:56:31 +01:00
hlohaus
595dafd71a Fix some issues in the demo 2025-01-26 17:44:04 +01:00
hlohaus
ab04d1d894 Increase max token in HuggingfaceAPI
Restore browser instance on start up errors in nodriver
Restored instances can be used as usual or to stop the browser
Add demo modus to web ui for HuggingSpace
Add rate limit support to web ui. Simply install flask_limiter
Add home for demo with Access Token input and validation
Add stripped model list for demo
Add ignores for encoding error in web_search and file upload
2025-01-26 02:48:43 +01:00
Heiner Lohaus
486e9a9122 Add login_url to authed providers
Create a home page for the GUI
Fix CopyButton in Code Highlight
2025-01-03 02:40:21 +01:00
Heiner Lohaus
651df0cf82 Add some arguments to chat completion api, update discord links 2024-11-27 14:44:24 +01:00
H Lohaus
804a80bc7c Arm2 (#2414)
* Fix arm v7 build / improve api

* Update stubs.py

* Fix unit tests
2024-11-24 17:43:45 +01:00
kqlio67
078edc6f61 feat(g4f/gui/server/website.py): add redirect for /images/ endpoint 2024-10-25 20:07:24 +03:00
Heiner Lohaus
926ddfd543 Add WhiteRabbitNeo Provider, Many tiny improvments in the gui 2024-04-08 07:24:00 +02:00
Heiner Lohaus
905ced06bd Serverless webview gui 2024-03-16 10:48:37 +01:00
Heiner Lohaus
8cc6000ffb Add Pyinstaller support, Use curl_cffi in You provider 2024-03-15 11:46:06 +01:00
ⲘrṨhส∂ow
3982f39424 'Refactored by Sourcery' (#1125)
Co-authored-by: Sourcery AI <>
2023-10-23 09:46:25 +02:00
abc
7e4e374f62 ~ | new g4f GUI 2023-10-06 19:52:17 +01:00