supported aliyun coding plan.
This commit is contained in:
@@ -5,7 +5,7 @@ from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from pydantic.alias_generators import to_camel
|
||||
from pydantic_settings import BaseSettings
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Base(BaseModel):
|
||||
@@ -198,23 +198,6 @@ class QQConfig(Base):
|
||||
) # Allowed user openids (empty = public access)
|
||||
|
||||
|
||||
class MatrixConfig(Base):
|
||||
"""Matrix (Element) channel configuration."""
|
||||
|
||||
enabled: bool = False
|
||||
homeserver: str = "https://matrix.org"
|
||||
access_token: str = ""
|
||||
user_id: str = "" # e.g. @bot:matrix.org
|
||||
device_id: str = ""
|
||||
e2ee_enabled: bool = True # end-to-end encryption support
|
||||
sync_stop_grace_seconds: int = 2 # graceful sync_forever shutdown timeout
|
||||
max_media_bytes: int = 20 * 1024 * 1024 # inbound + outbound attachment limit
|
||||
allow_from: list[str] = Field(default_factory=list)
|
||||
group_policy: Literal["open", "mention", "allowlist"] = "open"
|
||||
group_allow_from: list[str] = Field(default_factory=list)
|
||||
allow_room_mentions: bool = False
|
||||
|
||||
|
||||
class ChannelsConfig(Base):
|
||||
"""Configuration for chat channels."""
|
||||
|
||||
@@ -339,6 +322,20 @@ class MCPServerConfig(Base):
|
||||
tool_timeout: int = 30 # Seconds before a tool call is cancelled
|
||||
|
||||
|
||||
class TTSConfig(Base):
|
||||
"""Text-to-Speech configuration."""
|
||||
|
||||
provider: str = "edge_tts" # Default TTS provider
|
||||
voice: str = "en-US-ChristopherNeural" # Default voice
|
||||
speed: float = 1.0 # Voice speed multiplier
|
||||
|
||||
|
||||
class AudioConfig(Base):
|
||||
"""Audio configuration."""
|
||||
|
||||
tts: TTSConfig = Field(default_factory=TTSConfig)
|
||||
|
||||
|
||||
class ToolsConfig(Base):
|
||||
"""Tools configuration."""
|
||||
|
||||
@@ -356,6 +353,7 @@ class Config(BaseSettings):
|
||||
providers: ProvidersConfig = Field(default_factory=ProvidersConfig)
|
||||
gateway: GatewayConfig = Field(default_factory=GatewayConfig)
|
||||
tools: ToolsConfig = Field(default_factory=ToolsConfig)
|
||||
audio: AudioConfig = Field(default_factory=AudioConfig)
|
||||
|
||||
@property
|
||||
def workspace_path(self) -> Path:
|
||||
|
||||
@@ -359,15 +359,15 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
|
||||
keywords=("dashscope-coding-plan", "coding-plan", "aliyun-coding", "bailian-coding"),
|
||||
env_key="DASHSCOPE_CODING_PLAN_API_KEY",
|
||||
display_name="Alibaba Cloud Coding Plan",
|
||||
litellm_prefix="dashscope", # → dashscope/{model}
|
||||
skip_prefixes=("dashscope/", "openrouter/"),
|
||||
litellm_prefix="openai", # → openai/{model} (uses OpenAI-compatible endpoint)
|
||||
skip_prefixes=("openai/", "dashscope/", "openrouter/"),
|
||||
env_extras=(),
|
||||
is_gateway=True,
|
||||
is_local=False,
|
||||
detect_by_key_prefix="sk-sp-", # coding plan API keys start with "sk-sp-"
|
||||
detect_by_base_keyword="coding.dashscope",
|
||||
default_api_base="https://coding.dashscope.aliyuncs.com/v1",
|
||||
strip_model_prefix=False,
|
||||
strip_model_prefix=True, # Strip "dashscope_coding_plan/" prefix
|
||||
model_overrides=(),
|
||||
),
|
||||
# === Auxiliary (not a primary LLM provider) ============================
|
||||
|
||||
Reference in New Issue
Block a user