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
This commit is contained in:
hlohaus 2025-07-27 18:03:54 +02:00
parent 8892b00ac1
commit f83c92446e
8 changed files with 27 additions and 24 deletions

View file

@ -16,7 +16,12 @@ from g4f.Provider import ProviderUtils
from g4f.image import extract_data_uri, is_accepted_format
from g4f.image.copy_images import get_media_dir
from g4f.client.helper import filter_markdown
from g4f.integration.markitdown import MarkItDown
from g4f.errors import MissingRequirementsError
try:
from g4f.integration.markitdown import MarkItDown
has_markitdown = True
except ImportError:
has_markitdown = False
from g4f.config import CONFIG_DIR, COOKIES_DIR
from g4f import debug
@ -284,6 +289,8 @@ def run_client_args(args):
media.append(input_value)
else:
try:
if not has_markitdown:
raise MissingRequirementsError("MarkItDown is not installed. Install it with `pip install -U markitdown`.")
md = MarkItDown()
text_content = md.convert_url(input_value).text_content
input_text += f"\n```\n{text_content}\n\nSource: {input_value}\n```\n"