mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-23 03:19:41 +00:00
Merge pull request #3315 from xinnan-tech/fix-model-name
更换豆包、Gemini的LLM模型、修复 performance_tester 异步配置加载错误
This commit is contained in:
commit
e1876f1ce1
8 changed files with 62 additions and 28 deletions
|
|
@ -0,0 +1,22 @@
|
|||
UPDATE `ai_model_config`
|
||||
SET `config_json` = JSON_SET(`config_json`, '$.model_name', 'doubao-seed-2-0-lite-260215')
|
||||
WHERE `id` = 'LLM_DoubaoLLM'
|
||||
AND JSON_UNQUOTE(JSON_EXTRACT(`config_json`, '$.model_name')) IN (
|
||||
'doubao-1-5-pro-32k-250115'
|
||||
);
|
||||
|
||||
UPDATE `ai_model_config`
|
||||
SET `remark` = REPLACE(
|
||||
REPLACE(
|
||||
`remark`,
|
||||
'开通Doubao-1.5-pro服务',
|
||||
'开通 Doubao-Seed-2.0-Lite 服务'
|
||||
),
|
||||
'当前建议使用doubao-1-5-pro-32k-250115',
|
||||
'当前建议使用 doubao-seed-2-0-lite-260215'
|
||||
)
|
||||
WHERE `id` = 'LLM_DoubaoLLM'
|
||||
AND (
|
||||
`remark` LIKE '%Doubao-1.5-pro%'
|
||||
OR `remark` LIKE '%doubao-1-5-pro-32k-250115%'
|
||||
);
|
||||
|
|
@ -725,6 +725,13 @@ databaseChangeLog:
|
|||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202608061030.sql
|
||||
- changeSet:
|
||||
id: 202608061800
|
||||
author: cgd
|
||||
changes:
|
||||
- sqlFile:
|
||||
encoding: utf8
|
||||
path: classpath:db/changelog/202608061800.sql
|
||||
- changeSet:
|
||||
id: 202608131030
|
||||
author: tykechen
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ selected_module:
|
|||
# 不想开通意图识别,就设置成:nointent
|
||||
# 意图识别可使用intent_llm。优点:通用性强,缺点:增加串行前置意图识别模块,会增加处理时间,支持控制音量大小等iot操作
|
||||
# 意图识别可使用function_call,缺点:需要所选择的LLM支持function_call,优点:按需调用工具、速度快,理论上能全部操作所有iot指令
|
||||
# 默认免费的ChatGLMLLM就已经支持function_call,但是如果像追求稳定建议把LLM设置成:DoubaoLLM,使用的具体model_name是:doubao-1-5-pro-32k-250115
|
||||
# 默认免费的ChatGLMLLM就已经支持function_call,但是如果像追求稳定建议把LLM设置成:DoubaoLLM,使用的具体model_name是:doubao-seed-2-0-lite-260215
|
||||
Intent: function_call
|
||||
|
||||
# 意图识别,是用于理解用户意图的模块,例如:播放音乐
|
||||
|
|
@ -638,12 +638,12 @@ LLM:
|
|||
DoubaoLLM:
|
||||
# 定义LLM API类型
|
||||
type: openai
|
||||
# 先开通服务,打开以下网址,开通的服务搜索Doubao-1.5-pro,开通它
|
||||
# 先开通服务,打开以下网址,开通的服务搜索Doubao-Seed-2.0-Lite,开通它
|
||||
# 开通地址:https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement?LLM=%7B%7D&OpenTokenDrawer=false
|
||||
# 免费额度500000token
|
||||
# 开通后,进入这里获取密钥:https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D
|
||||
base_url: https://ark.cn-beijing.volces.com/api/v3
|
||||
model_name: doubao-1-5-pro-32k-250115
|
||||
model_name: doubao-seed-2-0-lite-260215
|
||||
api_key: 你的doubao web key
|
||||
DeepSeekLLM:
|
||||
# 定义LLM API类型
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ description = "大语言模型性能测试"
|
|||
|
||||
|
||||
class LLMPerformanceTester:
|
||||
def __init__(self):
|
||||
self.config = load_config()
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
# 使用更符合智能体场景的测试内容,包含系统提示词
|
||||
self.system_prompt = self._load_system_prompt()
|
||||
self.test_sentences = self.config.get("module_test", {}).get(
|
||||
|
|
@ -536,7 +536,8 @@ class LLMPerformanceTester:
|
|||
|
||||
|
||||
async def main():
|
||||
tester = LLMPerformanceTester()
|
||||
config = await load_config()
|
||||
tester = LLMPerformanceTester(config)
|
||||
await tester.run()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ except ImportError:
|
|||
dashscope = None
|
||||
|
||||
class BaseASRTester:
|
||||
def __init__(self, config_key: str):
|
||||
self.config = load_config()
|
||||
def __init__(self, config_key: str, config):
|
||||
self.config = config
|
||||
self.config_key = config_key
|
||||
self.asr_config = self.config.get("ASR", {}).get(config_key, {})
|
||||
self.test_audio_files = self._load_test_audio_files()
|
||||
|
|
@ -63,8 +63,8 @@ class BaseASRTester:
|
|||
|
||||
|
||||
class DoubaoStreamASRTester(BaseASRTester):
|
||||
def __init__(self):
|
||||
super().__init__("DoubaoStreamASR")
|
||||
def __init__(self, config):
|
||||
super().__init__("DoubaoStreamASR", config)
|
||||
from core.providers.asr.doubao_stream import ASRProvider as DoubaoStreamProvider
|
||||
self.provider = DoubaoStreamProvider(self.asr_config, delete_audio_file=False)
|
||||
|
||||
|
|
@ -128,8 +128,8 @@ class DoubaoStreamASRTester(BaseASRTester):
|
|||
|
||||
|
||||
class QwenASRFlashTester(BaseASRTester):
|
||||
def __init__(self):
|
||||
super().__init__("Qwen3ASRFlash")
|
||||
def __init__(self, config):
|
||||
super().__init__("Qwen3ASRFlash", config)
|
||||
|
||||
async def _test_single(self, audio_file_info):
|
||||
temp_file_path = None
|
||||
|
|
@ -213,8 +213,8 @@ class QwenASRFlashTester(BaseASRTester):
|
|||
|
||||
|
||||
class XunfeiStreamASRTester(BaseASRTester):
|
||||
def __init__(self):
|
||||
super().__init__("XunfeiStreamASR")
|
||||
def __init__(self, config):
|
||||
super().__init__("XunfeiStreamASR", config)
|
||||
|
||||
def _create_url(self):
|
||||
url = "wss://iat-api.xfyun.cn/v2/iat"
|
||||
|
|
@ -325,13 +325,14 @@ class XunfeiStreamASRTester(BaseASRTester):
|
|||
|
||||
return self._calculate_result("讯飞流式ASR", latencies, test_count)
|
||||
class ASRPerformanceSuite:
|
||||
def __init__(self):
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
self.testers = []
|
||||
self.results = []
|
||||
|
||||
def register_tester(self, tester_class):
|
||||
try:
|
||||
tester = tester_class()
|
||||
tester = tester_class(self.config)
|
||||
self.testers.append(tester)
|
||||
print(f"已注册测试器: {tester.config_key}")
|
||||
except Exception as e:
|
||||
|
|
@ -390,7 +391,8 @@ async def main():
|
|||
parser.add_argument("--count", type=int, default=5, help="测试次数")
|
||||
args = parser.parse_args()
|
||||
|
||||
suite = ASRPerformanceSuite()
|
||||
config = await load_config()
|
||||
suite = ASRPerformanceSuite(config)
|
||||
suite.register_tester(DoubaoStreamASRTester)
|
||||
suite.register_tester(QwenASRFlashTester)
|
||||
suite.register_tester(XunfeiStreamASRTester)
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ from config.settings import load_config
|
|||
|
||||
description = "流式TTS语音合成首词耗时测试"
|
||||
class StreamTTSPerformanceTester:
|
||||
def __init__(self):
|
||||
self.config = load_config()
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
self.test_texts = [
|
||||
"你好,这是一句话。"
|
||||
]
|
||||
|
|
@ -663,7 +663,8 @@ async def main():
|
|||
parser.add_argument("--count", type=int, default=5, help="每个TTS服务的测试次数")
|
||||
|
||||
args = parser.parse_args()
|
||||
await StreamTTSPerformanceTester().run(args.text, args.count)
|
||||
config = await load_config()
|
||||
await StreamTTSPerformanceTester(config).run(args.text, args.count)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ description = "非流式语音合成性能测试"
|
|||
|
||||
|
||||
class TTSPerformanceTester:
|
||||
def __init__(self):
|
||||
self.config = load_config()
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
self.test_sentences = self.config.get("module_test", {}).get(
|
||||
"test_sentences",
|
||||
[
|
||||
|
|
@ -190,10 +190,10 @@ class TTSPerformanceTester:
|
|||
|
||||
# 为了performance_tester.py的调用需求
|
||||
async def main():
|
||||
tester = TTSPerformanceTester()
|
||||
config = await load_config()
|
||||
tester = TTSPerformanceTester(config)
|
||||
await tester.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
tester = TTSPerformanceTester()
|
||||
asyncio.run(tester.run())
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ description = "视觉识别模型性能测试"
|
|||
|
||||
|
||||
class AsyncVisionPerformanceTester:
|
||||
def __init__(self):
|
||||
self.config = load_config()
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
|
||||
self.test_images = [
|
||||
"../../docs/images/demo1.png",
|
||||
|
|
@ -184,7 +184,8 @@ class AsyncVisionPerformanceTester:
|
|||
|
||||
|
||||
async def main():
|
||||
tester = AsyncVisionPerformanceTester()
|
||||
config = await load_config()
|
||||
tester = AsyncVisionPerformanceTester(config)
|
||||
await tester.run()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue