Add support for Xfyun ASR and TTS services in the backend
- Introduce new Xfyun ASR and TTS services, enabling integration with iFlytek's voice recognition and synthesis capabilities. - Update AssistantConfig model to include interface types for STT and TTS. - Enhance credential testing to validate Xfyun credentials. - Modify service factory to create Xfyun services based on configuration. - Update README with new configuration details for Xfyun integration. - Add new frontend components for visualizing audio streams and managing user interactions.
This commit is contained in:
@@ -15,7 +15,7 @@ from schemas import (
|
||||
CredentialTestResult,
|
||||
CredentialUpsert,
|
||||
)
|
||||
from services.credential_tester import test_openai_credential
|
||||
from services.credential_tester import test_openai_credential, test_xfyun_credential
|
||||
from services.masking import mask, resolve_incoming_key
|
||||
from sqlalchemy import select, update
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
@@ -84,6 +84,8 @@ async def create_credential(
|
||||
|
||||
@router.post("/test", response_model=CredentialTestResult)
|
||||
async def test_new_credential(body: CredentialTestRequest):
|
||||
if body.interface_type == "xfyun":
|
||||
return test_xfyun_credential(body)
|
||||
if body.interface_type != "openai":
|
||||
return CredentialTestResult(
|
||||
ok=False,
|
||||
@@ -111,6 +113,8 @@ async def test_saved_credential(
|
||||
config = body.model_copy(
|
||||
update={"api_key": resolve_incoming_key(body.api_key, c.api_key)}
|
||||
)
|
||||
if config.interface_type == "xfyun":
|
||||
return test_xfyun_credential(config)
|
||||
if config.interface_type != "openai":
|
||||
return CredentialTestResult(
|
||||
ok=False,
|
||||
|
||||
Reference in New Issue
Block a user