fix: 时间被固定

This commit is contained in:
Sakura-RanChen
2025-07-29 09:55:32 +08:00
parent 67c4622ca7
commit e5d3048fb2
2 changed files with 7 additions and 4 deletions
@@ -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,