Commit graph

3488 commits

Author SHA1 Message Date
Cursor Agent
b0ffc9e997 Add comprehensive documentation for G4F library
Co-authored-by: fkahdias <fkahdias@gmail.com>
2025-07-01 20:17:16 +00:00
hlohaus
78c0d67d54 refactor: streamline auth handling and CLI structure
- Added `fallback_model = "deepseek"` to `PollinationsAI` class in `PollinationsAI.py`
- Modified `PollinationsAI._agenerate` to safely call `get_model` only if `model` is not None
- Removed unused login loop in `OpenaiChat.synthesize` method in `OpenaiChat.py`
- Replaced full CLI parser and main function implementation in `__main__.py` with import from `.main`
- Added `get_auth_result` method to `AsyncAuthedProvider` in `base_provider.py` for reusable auth retrieval
- Replaced repeated auth loading logic in `create_completion` and `create_streaming_completion` with call to `get_auth_result` in `base_provider.py
2025-07-01 03:10:21 +02:00
H Lohaus
dcbeebd662
Update __init__.py 2025-06-30 10:06:56 +02:00
H Lohaus
05bd5051b1
Update __main__.py 2025-06-30 09:55:15 +02:00
H Lohaus
ba898176bf
Update __init__.py 2025-06-30 09:54:36 +02:00
H Lohaus
33ca1b9b83
Update __init__.py 2025-06-30 09:36:22 +02:00
H Lohaus
ca2695ce45
Create __init__.py 2025-06-30 09:36:13 +02:00
hlohaus
90e30c83ef Support none conversation file 2025-06-30 00:25:02 +02:00
hlohaus
8b2d1afd3e fix: Correct conversation loading and improve file handling
- Modify `ConversationManager.load` to fix conversation loading when `self.provider` is not set.
- Update `ConversationManager.load` to correctly handle `self.provider` and `self.data`.
- Change description in `get_parser` from "GPT CLI client with conversation history" to "G4F CLI client with conversation history".
- Improve error handling in `run_client_args` for file reading.
- Add `UnicodeDecodeError` handling when reading input files as text in `run_client_args`.
- Simplify and correct the construction of `input_text` in `run_client_args`.
2025-06-29 23:58:07 +02:00
hlohaus
5e4b9d9866 fix: improve session handling, message formatting, and content saving
- Added `timeout` parameter support to `LMArenaBeta._create_async_generator` and passed it to `StreamSession`
- Ensured fallback to `default_model` in `LMArenaBeta` if `model` is not provided
- Modified `OpenaiChat._create_completion` to rebuild messages excluding assistant roles if conversation ID exists
- Corrected OpenaiChat `nodriver_auth` to await `browser.get` and replaced page access with reload
- Improved `save_content` in `client.py` with robust content extraction, null checks, and logging for missing content
- Removed premature `input_text.strip()` in `stream_response` and relocated it to `run_client_args`
- Simplified and centralized markdown filtering call in `save_content`
- Replaced raw `print` logging in `__init__.py` with `debug.log` for `nodriver` URL opening message
2025-06-29 21:59:22 +02:00
hlohaus
c1c00eee04 Update CLI client 2025-06-29 14:37:47 +02:00
hlohaus
94d5b486ff Support images input 2025-06-29 13:33:14 +02:00
hlohaus
1a7a1338fb Add custom instrutions to cli client 2025-06-29 12:45:03 +02:00
hlohaus
d64f89a634 Fix empty provider, add output file support 2025-06-29 06:02:59 +02:00
hlohaus
eff8624ed0 Add g4f cli client 2025-06-29 03:57:47 +02:00
hlohaus
634f7d9a39 Update validation 2025-06-28 17:04:41 +02:00
Tekky
45ef06d5df dmca 2025-06-28 14:42:22 +02:00
hlohaus
664b1ce650 Add any_model_map 2025-06-28 06:22:31 +02:00
hlohaus
350a07693a Fix typo inference 2025-06-27 16:49:36 +02:00
hlohaus
c9755196f8 Fix sending images, fix unittests 2025-06-27 16:44:43 +02:00
hlohaus
a30908ae0b Fix stop_browser, update secret validation 2025-06-27 14:10:30 +02:00
hlohaus
6ccdb9d44f Support novita in HuggingFace 2025-06-26 00:42:16 +02:00
hlohaus
315495e199 Support inlineData in GeminiPro 2025-06-26 00:25:53 +02:00
hlohaus
8c4c440829 Improve followups 2025-06-25 22:52:05 +02:00
hlohaus
7b5ecaa4fb Add secret validation 2025-06-25 21:30:58 +02:00
hlohaus
c466d414c9 Add ip 2025-06-25 13:42:37 +02:00
hlohaus
6948ab9b7d Fix upload docx 2025-06-24 23:11:21 +02:00
hlohaus
88d8275f1a Remove submodule 2025-06-24 22:52:34 +02:00
hlohaus
5b4f98c069 Move file functions 2025-06-24 22:32:59 +02:00
hlohaus
744dfeb957 Add ip ban 2025-06-24 22:25:42 +02:00
hlohaus
3ce8edce27 Remove timeout 2025-06-21 16:54:44 +02:00
hlohaus
85aaa84932 Add model aliases to OpenaiChat 2025-06-20 22:08:56 +02:00
hlohaus
ffb1914cbe Improve update script 2025-06-19 21:02:52 +02:00
hlohaus
c37f5c0912 Improve update script 2025-06-19 15:54:01 +02:00
hlohaus
295103f224 Improve update script 2025-06-19 15:24:49 +02:00
hlohaus
1c88f71f05 Improve update script 2025-06-19 15:00:57 +02:00
hlohaus
ce539f755d Secure api 2025-06-19 14:22:58 +02:00
hlohaus
a0babdc3eb Secure api 2025-06-19 14:20:03 +02:00
hlohaus
2c59301013 Secure api 2025-06-19 14:08:41 +02:00
hlohaus
a323981e72 Serve broken images 2025-06-19 13:47:20 +02:00
hlohaus
4485758781 Improve logging 2025-06-19 13:38:32 +02:00
hlohaus
0b2e38e1bd Improve logging 2025-06-19 13:28:08 +02:00
hlohaus
8ebe05499b Improve logging 2025-06-19 13:15:10 +02:00
hlohaus
98c973ca36 Improve logging 2025-06-19 13:07:04 +02:00
hlohaus
a2a1d63836 Improve logging 2025-06-19 12:57:12 +02:00
hlohaus
9f941ae71b Support timeout in backend_api 2025-06-19 12:18:53 +02:00
hlohaus
6f9b9aeb35 Support timeout in backend_api 2025-06-19 11:42:52 +02:00
hlohaus
d0ef02a825 Support timeout in backend_api 2025-06-19 11:32:59 +02:00
hlohaus
c27f0c995e Support timeout in backend_api 2025-06-19 11:29:54 +02:00
hlohaus
90262b1f6a Fix copy image 2025-06-19 10:40:36 +02:00