mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-12-23 11:02:40 +03:00
Fix import Annotated typing
This commit is contained in:
parent
1b7f89f69a
commit
8153668ab8
4
.github/workflows/publish-workflow.yaml
vendored
4
.github/workflows/publish-workflow.yaml
vendored
@ -10,10 +10,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python 3.8
|
- name: Set up Python 3.13
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.8"
|
python-version: "3.13"
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
- name: Install requirements
|
- name: Install requirements
|
||||||
run: |
|
run: |
|
||||||
|
@ -27,7 +27,12 @@ from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
|
|||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from starlette.responses import FileResponse
|
from starlette.responses import FileResponse
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
from typing import Union, Optional, List, Annotated
|
from typing import Union, Optional, List
|
||||||
|
try:
|
||||||
|
from typing import Annotated
|
||||||
|
except ImportError:
|
||||||
|
class Annotated:
|
||||||
|
pass
|
||||||
|
|
||||||
import g4f
|
import g4f
|
||||||
import g4f.debug
|
import g4f.debug
|
||||||
@ -456,8 +461,6 @@ class Api:
|
|||||||
|
|
||||||
return FileResponse(target, media_type=content_type)
|
return FileResponse(target, media_type=content_type)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def format_exception(e: Union[Exception, str], config: Union[ChatCompletionsConfig, ImageGenerationConfig] = None, image: bool = False) -> str:
|
def format_exception(e: Union[Exception, str], config: Union[ChatCompletionsConfig, ImageGenerationConfig] = None, image: bool = False) -> str:
|
||||||
last_provider = {} if not image else g4f.get_last_provider(True)
|
last_provider = {} if not image else g4f.get_last_provider(True)
|
||||||
provider = (AppConfig.image_provider if image else AppConfig.provider)
|
provider = (AppConfig.image_provider if image else AppConfig.provider)
|
||||||
|
Loading…
Reference in New Issue
Block a user