JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix: 日期提示词优化
renquanjia679390ba4e7a
diff --git a/jiuwenswarm/agents/harness/common/rails/runtime_prompt_rail.py b/jiuwenswarm/agents/harness/common/rails/runtime_prompt_rail.pyindex 098c9fa73c..47bc1a81a3 100644--- a/jiuwenswarm/agents/harness/common/rails/runtime_prompt_rail.py+++ b/jiuwenswarm/agents/harness/common/rails/runtime_prompt_rail.py@@ -10,6 +10,7 @@ from __future__ import annotationsimport osimport sys+from datetime import datetime, timedelta, timezonefrom pathlib import Pathfrom typing import Any@@ -264,15 +265,29 @@ class RuntimePromptRail(DeepAgentRail):self.system_prompt_builder.remove_section(name)# ── time ──+ # Inject real date values (day-level precision only, not HH:MM) to avoid+ # repeated date derivations in reasoning. Priority 130 places this after+ # FINAL_VISIBLE_REPLY(120) so the dynamic suffix does not break prefix+ # caching of the static sections above.+ now = datetime.now(timezone.utc).astimezone()+ weekday_cn = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'][now.weekday()]+ weekday_en = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'][now.weekday()]+ week_start = now - timedelta(days=now.weekday())+ week_end = now + timedelta(days=6 - now.weekday())+if not self._force_english and self._language == "cn":time_content = ("# 时间说明\n\n"+ f"当前日期:{now.strftime('%Y-%m-%d')}({weekday_cn})\n"+ f"本周日期范围:{week_start.strftime('%Y-%m-%d')} 至 {week_end.strftime('%Y-%m-%d')}\n""- 当用户询问“最新、当前、今年、本年、实时、近期”等信息并需要搜索时,""搜索 query 必须优先使用当前年份或日期")else:time_content = ("# Time Description\n\n"+ f"Current date: {now.strftime('%Y-%m-%d')} ({weekday_en})\n"+ f"This week: {week_start.strftime('%Y-%m-%d')} to {week_end.strftime('%Y-%m-%d')}\n""- When the user asks for latest/current/this-year/recent information and search is needed, ""search queries must prefer the current year or date.")@@ -280,7 +295,7 @@ class RuntimePromptRail(DeepAgentRail):self.system_prompt_builder.add_section(PromptSection(name="time",content={"cn": time_content, "en": time_content},- priority=92,+ priority=130,))# ── runtime ──diff --git a/jiuwenswarm/agents/harness/common/rails/stream_event_rail.py b/jiuwenswarm/agents/harness/common/rails/stream_event_rail.pyindex b3e28f30c4..c4324c1123 100644--- a/jiuwenswarm/agents/harness/common/rails/stream_event_rail.py+++ b/jiuwenswarm/agents/harness/common/rails/stream_event_rail.py@@ -1080,6 +1080,8 @@ class JiuSwarmStreamEventRail(DeepAgentRail):"这次调用要达成的目标(如「调研 openJiuwen 官网信息」「创建三子棋对战团队」),""不要只写工具名或裸 URL。""该字段仅用于界面展示,不影响工具实际执行。\n"+ "若工具参数里已有 `description`:`call_goal` 必须与 `description` 使用同一句,"+ "禁止再写一句近义复述(避免同一信息输出两遍)。\n""团队工具也必须填 `call_goal`,且不能用其它字段代替:\n""- `spawn_member` / `spawn_teammate`:`call_goal` 写「为何创建该成员」;""`display_name` 仍是成员展示名,两者都要填。\n"@@ -1092,6 +1094,8 @@ class JiuSwarmStreamEventRail(DeepAgentRail):"When calling any tool, set `call_goal`: one short phrase for the goal of this call ""(e.g. \"Research openJiuwen official site\", \"Create tic-tac-toe team\"). ""Do not just repeat the tool name or raw URL. UI only; does not affect execution.\n"+ "If the tool already has a `description` parameter: set `call_goal` to the exact same "+ "string — do not invent a second near-duplicate phrase.\n""Team tools must also set `call_goal`; do not substitute other fields:\n""- `spawn_member` / `spawn_teammate`: `call_goal` = why spawn this member; ""`display_name` remains the member label — fill both.\n"