mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
@@ -73,6 +73,10 @@ class Dialogue:
|
||||
if system_message:
|
||||
# 基础系统提示
|
||||
enhanced_system_prompt = system_message.content
|
||||
# 替换时间占位符
|
||||
enhanced_system_prompt = enhanced_system_prompt.replace(
|
||||
"{{current_time}}", datetime.now().strftime("%H:%M")
|
||||
)
|
||||
|
||||
# 添加说话人个性化描述
|
||||
try:
|
||||
|
||||
@@ -120,7 +120,6 @@ class PromptManager:
|
||||
from datetime import datetime
|
||||
|
||||
now = datetime.now()
|
||||
current_time = now.strftime("%H:%M")
|
||||
today_date = now.strftime("%Y-%m-%d")
|
||||
today_weekday = WEEKDAY_MAP[now.strftime("%A")]
|
||||
today_lunar = cnlunar.Lunar(now, godType="8char")
|
||||
@@ -130,7 +129,7 @@ class PromptManager:
|
||||
today_lunar.lunarDayCn,
|
||||
)
|
||||
|
||||
return current_time, today_date, today_weekday, lunar_date
|
||||
return today_date, today_weekday, lunar_date
|
||||
|
||||
def _get_location_info(self, client_ip: str) -> str:
|
||||
"""获取位置信息"""
|
||||
@@ -199,7 +198,7 @@ class PromptManager:
|
||||
|
||||
try:
|
||||
# 获取最新的时间信息(不缓存)
|
||||
current_time, today_date, today_weekday, lunar_date = (
|
||||
today_date, today_weekday, lunar_date = (
|
||||
self._get_current_time_info()
|
||||
)
|
||||
|
||||
@@ -224,7 +223,7 @@ class PromptManager:
|
||||
template = Template(self.base_prompt_template)
|
||||
enhanced_prompt = template.render(
|
||||
base_prompt=user_prompt,
|
||||
current_time=current_time,
|
||||
current_time="{{current_time}}",
|
||||
today_date=today_date,
|
||||
today_weekday=today_weekday,
|
||||
lunar_date=lunar_date,
|
||||
|
||||
Reference in New Issue
Block a user