mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
feat: enhance HAR provider, image handling, markdown upload & cache
- **g4f/Provider/har/__init__.py** - `get_models`/`create_async`: iterate over `(domain, harFile)` and filter with `domain in request_url` - `read_har_files` now yields `(domain, har_data)`; fixes file variable shadowing and uses `json.load` - remove stray `print`, add type hint for `find_str`, replace manual loops with `yield from` - small whitespace clean-up - **g4f/Provider/needs_auth/Grok.py** - `ImagePreview` now passes `auth_result.cookies` and `auth_result.headers` - **g4f/Provider/needs_auth/OpenaiChat.py** - add `Union` import; rename/refactor `get_generated_images` → `get_generated_image` - support `file-service://` and `sediment://` pointers; choose correct download URL - return `ImagePreview` or `ImageResponse` accordingly and stream each image part - propagate 422 errors, update prompt assignment and image handling paths - **g4f/client/__init__.py** - drop unused `ignore_working` parameter in sync/async `Completions` - normalise `media` argument: accept single tuple, infer filename when missing, fix index loop - `Images.create_variation` updated to use the new media logic - **g4f/gui/server/api.py** - expose `latest_version_cached` via `?cache=` query parameter - **g4f/gui/server/backend_api.py** - optional Markdown extraction via `MarkItDown`; save rendered text as `<file>.md` - upload flow rewrites: copy to temp file, move to bucket/media dir, clean temp, store filenames - introduce `has_markitdown` guard and improved logging/exception handling - **g4f/tools/files.py** - remove trailing spaces in HAR code-block header string - **g4f/version.py** - add `latest_version_cached` `@cached_property` for memoised version lookup
This commit is contained in:
parent
db47d71f4c
commit
8f63f656a2
8 changed files with 95 additions and 36 deletions
|
|
@ -4,7 +4,7 @@ import logging
|
|||
import os
|
||||
import asyncio
|
||||
from typing import Iterator
|
||||
from flask import send_from_directory
|
||||
from flask import send_from_directory, request
|
||||
from inspect import signature
|
||||
|
||||
from ...errors import VersionNotFoundError, MissingAuthError
|
||||
|
|
@ -87,7 +87,10 @@ class Api:
|
|||
latest_version = None
|
||||
try:
|
||||
current_version = version.utils.current_version
|
||||
latest_version = version.utils.latest_version
|
||||
if request.args.get("cache"):
|
||||
latest_version = version.utils.latest_version_cached
|
||||
else:
|
||||
latest_version = version.utils.latest_version
|
||||
except VersionNotFoundError:
|
||||
pass
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue