diff --git a/dsLightRag/Config/Config.py b/dsLightRag/Config/Config.py index ffd61e81..0f4331df 100644 --- a/dsLightRag/Config/Config.py +++ b/dsLightRag/Config/Config.py @@ -93,4 +93,10 @@ HS_VOICE_TYPE_QINCANG = "BV701_V2_streaming" # 中年男声,用于朗读古 #LibLib的配置 LIBLIB_URL="https://openapi.liblibai.cloud" LIBLIB_ACCESSKEY="sOCtVLVTNOZkRMajlhzCmg" -LIBLIB_SECRETKEY="PUe8QTRG9i0G9EbpedHmIpLQ0FyxoYY9" \ No newline at end of file +LIBLIB_SECRETKEY="PUe8QTRG9i0G9EbpedHmIpLQ0FyxoYY9" + + +# 科大讯飞 +XF_APPID="5b83f8d6" +XF_APISECRET="604fa6cb9c5ab664a0d153fe0ccc6802" +XF_APIKEY="5beb887923204000bfcb402046bb05a6" \ No newline at end of file diff --git a/dsLightRag/Config/__pycache__/Config.cpython-310.pyc b/dsLightRag/Config/__pycache__/Config.cpython-310.pyc index fe88a799..7d0935e4 100644 Binary files a/dsLightRag/Config/__pycache__/Config.cpython-310.pyc and b/dsLightRag/Config/__pycache__/Config.cpython-310.pyc differ diff --git a/dsLightRag/Routes/XunFeiRoute.py b/dsLightRag/Routes/XunFeiRoute.py index e914d1d0..d0dba01c 100644 --- a/dsLightRag/Routes/XunFeiRoute.py +++ b/dsLightRag/Routes/XunFeiRoute.py @@ -2,12 +2,12 @@ import logging import os import uuid import time -from fastapi import APIRouter, HTTPException, BackgroundTasks, Query, UploadFile, File +from fastapi import APIRouter, HTTPException, BackgroundTasks, Query, UploadFile, File, Form from pydantic import BaseModel from typing import Optional import tempfile from Util.ObsUtil import ObsUploader -from Config.Config import OBS_BUCKET, OBS_SERVER +from Config.Config import OBS_BUCKET, OBS_SERVER, XF_APPID, XF_APISECRET, XF_APIKEY from fastapi.responses import StreamingResponse import requests @@ -36,19 +36,19 @@ class AudioEvaluationResponse(BaseModel): # 科大讯飞API配置(需要根据实际情况配置) XUNFEI_CONFIG = { - "appid": "your_appid_here", - "api_key": "your_api_key_here", - "api_secret": "your_api_secret_here" + "appid": XF_APPID, + "api_key": XF_APISECRET, + "api_secret": XF_APIKEY } @router.post("/evaluate-audio", response_model=AudioEvaluationResponse) async def evaluate_audio( background_tasks: BackgroundTasks, - language: str = Query("chinese", description="评测语言: chinese 或 english"), - text: str = Query(..., description="评测文本内容"), - group: str = Query("adult", description="群体类型: adult, youth, pupil"), - check_type: str = Query("common", description="检错严格程度: easy, common, hard"), - grade: str = Query("middle", description="学段: junior, middle, senior"), + language: str = Form("chinese", description="评测语言: chinese 或 english"), + text: str = Form(..., description="评测文本内容"), + group: str = Form("adult", description="群体类型: adult, youth, pupil"), + check_type: str = Form("common", description="检错严格程度: easy, common, hard"), + grade: str = Form("middle", description="学段: junior, middle, senior"), audio_file: UploadFile = File(...)): """ 语音评测接口 - 支持中文和英文篇章朗读判分 diff --git a/dsLightRag/Routes/__pycache__/XunFeiRoute.cpython-310.pyc b/dsLightRag/Routes/__pycache__/XunFeiRoute.cpython-310.pyc index c09079bd..c352f0b9 100644 Binary files a/dsLightRag/Routes/__pycache__/XunFeiRoute.cpython-310.pyc and b/dsLightRag/Routes/__pycache__/XunFeiRoute.cpython-310.pyc differ diff --git a/dsLightRag/static/XunFei/audio_evaluation.html b/dsLightRag/static/XunFei/audio_evaluation.html index eb9ea657..9ddd7510 100644 --- a/dsLightRag/static/XunFei/audio_evaluation.html +++ b/dsLightRag/static/XunFei/audio_evaluation.html @@ -104,7 +104,6 @@