- Introduce a new model structure for managing interface definitions and model resources, enhancing the backend's capability to handle various service integrations. - Update the Makefile to reflect changes in database seeding and resource management commands. - Remove the deprecated credentials management routes and replace them with a unified model registry API. - Modify existing routes and schemas to align with the new model structure, ensuring seamless integration with the frontend. - Enhance database seeding scripts to populate new model resources and their configurations. - Update README documentation to reflect the new architecture and usage instructions for model resources and interface definitions.
21 lines
728 B
Python
21 lines
728 B
Python
"""Shared Xfyun service value normalization."""
|
|
|
|
from __future__ import annotations
|
|
|
|
def websocket_url(value: str, default: str) -> str:
|
|
url = (value or default).strip()
|
|
if url.startswith("https://"):
|
|
return f"wss://{url.removeprefix('https://')}"
|
|
if url.startswith("http://"):
|
|
return f"ws://{url.removeprefix('http://')}"
|
|
return url
|
|
|
|
def xfyun_language(value: str) -> str:
|
|
normalized = (value or "zh_cn").lower().replace("-", "_")
|
|
return {"zh": "zh_cn", "en": "en_us"}.get(normalized, normalized)
|
|
|
|
|
|
def xfyun_speed(value: float) -> int:
|
|
"""Reuse the existing OpenAI-style speed field where 1.0 means normal."""
|
|
return max(0, min(100, round(value * 50 if value <= 4 else value)))
|