mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
feat: le-bot设备assistant_name替换为乐宝 + test页挂到8003端口
This commit is contained in:
parent
8f9803a5fc
commit
71438fee7b
2 changed files with 108 additions and 94 deletions
|
|
@ -235,7 +235,7 @@ public class ConfigServiceImpl implements ConfigService {
|
|||
|
||||
// 构建模块配置
|
||||
buildModuleConfig(
|
||||
agent.getAgentName(),
|
||||
resolveAssistantName(agent.getAgentName()),
|
||||
prompt,
|
||||
agent.getSummaryMemory(),
|
||||
voice,
|
||||
|
|
@ -607,9 +607,17 @@ public class ConfigServiceImpl implements ConfigService {
|
|||
|
||||
result.put("selected_module", selectedModule);
|
||||
if (StringUtils.isNotBlank(prompt)) {
|
||||
prompt = prompt.replace("{{assistant_name}}", StringUtils.isBlank(assistantName) ? "小智" : assistantName);
|
||||
assistantName = resolveAssistantName(assistantName);
|
||||
prompt = prompt.replace("{{assistant_name}}", assistantName);
|
||||
}
|
||||
result.put("prompt", prompt);
|
||||
result.put("summaryMemory", summaryMemory);
|
||||
}
|
||||
|
||||
private String resolveAssistantName(String name) {
|
||||
if (StringUtils.isBlank(name) || name.startsWith("le-bot-")) {
|
||||
return "乐宝";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import asyncio
|
||||
import os
|
||||
from aiohttp import web
|
||||
from config.logger import setup_logging
|
||||
from core.api.ota_handler import OTAHandler
|
||||
|
|
@ -63,6 +64,11 @@ class SimpleHttpServer:
|
|||
]
|
||||
)
|
||||
# 添加路由
|
||||
# 测试页面
|
||||
test_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), "test")
|
||||
if os.path.isdir(test_dir):
|
||||
app.router.add_static("/test", test_dir, name="test")
|
||||
|
||||
app.add_routes(
|
||||
[
|
||||
web.get("/mcp/vision/explain", self.vision_handler.handle_get),
|
||||
|
|
|
|||
Loading…
Reference in a new issue