Commit graph

5 commits

Author SHA1 Message Date
hlohaus
2aa40bb8a8 Fix unittests 2025-08-08 02:20:19 +02:00
hlohaus
9eeafff5e4 fix: improve error handling and response processing in Kimi and PollinationsAI
- In g4f/Provider/Kimi.py, added a try-except block around raise_for_status to catch exceptions containing "匿名聊天使用次数超过" and raise MissingAuthError; also included a yield statement for JsonConversation.
- In g4f/Provider/PollinationsAI.py, added a yield statement for Reasoning before the class definition.
- Updated get_image function in PollinationsAI to remove responses.add for the response URL and streamline response handling.
- In the main loop of PollinationsAI, modified response processing to handle exceptions by cancelling tasks and raising errors if conditions are met, or yielding Reasoning with status and progress labels.
- Adjusted responses handling to increment finished count and yield progress Reasoning only when no exception occurs.
2025-08-01 02:05:59 +02:00
hlohaus
499dcc0154 refactor: replace see_stream with sse_stream and update md2html output logic
- Replaced all imports and usages of `see_stream` with `sse_stream` across:
  - `g4f/Provider/Kimi.py`
  - `g4f/Provider/hf_space/BlackForestLabs_Flux1KontextDev.py`
  - `g4f/Provider/needs_auth/PuterJS.py`
  - `g4f/Provider/template/OpenaiTemplate.py`
  - `g4f/requests/__init__.py` (renamed function `see_stream` to `sse_stream`)
- Modified `g4f/Provider/needs_auth/GeminiPro.py`:
  - Updated `default_model` from `gemini-2.5-flash-preview-04-17` to `gemini-2.5-flash`
  - Removed `gemini-2.5-flash-preview-04-17` from `fallback_models`
- Updated `etc/tool/md2html.py`:
  - Added `re` import
  - Changed `process_single_file_with_output` to check if output file exists
  - If exists, uses regex to update `<title>` and `itemprop="text">` content instead of writing full template
  - If not, generates HTML using the template as before
2025-07-29 19:57:13 +02:00
hlohaus
f83c92446e fix: update provider status, models, error handling, and imports
- Set `working = False` in Free2GPT, Startnest, and Reka providers
- Changed `default_model` in LambdaChat from `deepseek-v3-0324` to `deepseek-r1`
- Removed `deepseek-v3` alias from LambdaChat's `model_aliases`
- In Kimi provider:
  - Replaced manual status check with `await raise_for_status(response)`
  - Set `model` field to `"k2"` in chat completion request
  - Removed unused `pass` statement
- In WeWordle provider:
  - Removed `**kwargs` from `data_payload` construction
- In Reka provider:
  - Set default value for `stream` to `True`
  - Modified `get_cookies` call to use `cache_result=False`
- In `cli/client.py`:
  - Added conditional import for `MarkItDown` with `has_markitdown` flag
  - Raised `MissingRequirementsError` if `MarkItDown` is not installed
- In `gui/server/backend_api.py`:
  - Imported `MissingAuthError`
  - Wrapped `get_provider_models` call in try-except block to return 401 if `MissingAuthError` is raised
2025-07-27 18:03:54 +02:00
hlohaus
8892b00ac1 Add Kimi provider, add vision support to LMArenaBeta 2025-07-25 16:43:06 +02:00