Skip to content

Commit cdf0f91

Browse files
authored
Merge pull request #2443 from xinnan-tech/py_fix_prompt_template
fix:修复全模块时缺少prompt_template配置的问题
2 parents cc9d530 + 32ecbe5 commit cdf0f91

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

main/xiaozhi-server/config/config_loader.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def get_config_from_api(config):
6868
"vision_explain": config["server"].get("vision_explain", ""),
6969
"auth_key": config["server"].get("auth_key", ""),
7070
}
71+
# 如果服务器没有prompt_template,则从本地配置读取
72+
if not config_data.get("prompt_template"):
73+
config_data["prompt_template"] = config.get("prompt_template")
7174
return config_data
7275

7376

main/xiaozhi-server/config_from_api.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ manager-api:
2222
# 如果使用docker部署,请使用填写成 http://xiaozhi-esp32-server-web:8002/xiaozhi
2323
url: http://127.0.0.1:8002/xiaozhi
2424
# 你的manager-api的token,就是刚才复制出来的server.secret
25-
secret: 你的server.secret值
25+
secret: 你的server.secret值
26+
# 默认系统提示词模板文件
27+
prompt_template: agent-base-prompt.txt

main/xiaozhi-server/core/utils/prompt_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def build_enhanced_prompt(
225225
weather_info=weather_info,
226226
emojiList=EMOJI_List,
227227
device_id=device_id,
228+
client_ip=client_ip,
228229
*args, **kwargs
229230
)
230231
device_cache_key = f"device_prompt:{device_id}"

0 commit comments

Comments
 (0)