mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
refactor: update audio parameter handling in EdgeTTS and stubs
- Remove the unused `language`, `locale`, and `extra_parameters` parameters from the `EdgeTTS` function signature in `g4f/Provider/audio/EdgeTTS.py`. - Update voice selection logic to check for `"locale"` and `"language"` keys in the `audio` dictionary, defaulting to `cls.default_locale` when neither is provided, and modify the error message accordingly. - Refactor extraction of extra parameters by building a dict from the `audio` dictionary for keys `"rate"`, `"volume"`, and `"pitch"`. - In `g4f/api/stubs.py`, remove the try/except block for importing `Annotated` and import `Messages` from `..typing` instead. - Add an optional `audio: Optional[dict] = None` field to the `ImageGenerationConfig` model.
This commit is contained in:
parent
e83282fc4b
commit
1296b3f64f
2 changed files with 12 additions and 18 deletions
|
|
@ -2,12 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
from typing import Union, Optional
|
||||
try:
|
||||
from typing import Annotated
|
||||
except ImportError:
|
||||
class Annotated:
|
||||
pass
|
||||
from g4f.typing import Messages
|
||||
|
||||
from ..typing import Messages
|
||||
|
||||
class ChatCompletionsConfig(BaseModel):
|
||||
messages: Messages = Field(examples=[[{"role": "system", "content": ""}, {"role": "user", "content": ""}]])
|
||||
|
|
@ -69,6 +65,7 @@ class ImageGenerationConfig(BaseModel):
|
|||
n: Optional[int] = None
|
||||
negative_prompt: Optional[str] = None
|
||||
resolution: Optional[str] = None
|
||||
audio: Optional[dict] = None
|
||||
|
||||
@model_validator(mode='before')
|
||||
def parse_size(cls, values):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue