缺陷 / 高 / Agent 引擎
electron/harness/prompts/context-builder.ts
ContextBuilder.buildSystemPrompt 中:
const now = new Date(); const timezone = 'Asia/Shanghai'; // 硬编码 const formattedTime = now.toLocaleString('zh-CN', { timeZone: timezone });
硬编码 Asia/Shanghai 时区:
// 使用系统本地时区 const formattedTime = now.toLocaleString('zh-CN', { timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone, }); // 或显式传入 const timezone = process.env.TZ ?? Intl.DateTimeFormat().resolvedOptions().timeZone;
同时考虑添加 timezone 配置项让用户覆盖。
文件: electron/harness/prompts/context-builder.ts
修复: 时区硬编码 Asia/Shanghai 改为 Intl.DateTimeFormat().resolvedOptions().timeZone(系统本地时区),兜底回退 Asia/Shanghai。System Prompt 中的时区标注同步使用本地时区名。
Asia/Shanghai
Intl.DateTimeFormat().resolvedOptions().timeZone
验证: tsc --noEmit 类型检查通过。
tsc --noEmit
No dependencies set.
The note is not visible to the blocked user.
问题类型
缺陷 / 高 / Agent 引擎
文件位置
electron/harness/prompts/context-builder.ts问题描述
ContextBuilder.buildSystemPrompt 中:
硬编码 Asia/Shanghai 时区:
影响
建议修复
同时考虑添加 timezone 配置项让用户覆盖。
修复说明
文件:
electron/harness/prompts/context-builder.ts修复: 时区硬编码
Asia/Shanghai改为Intl.DateTimeFormat().resolvedOptions().timeZone(系统本地时区),兜底回退Asia/Shanghai。System Prompt 中的时区标注同步使用本地时区名。验证:
tsc --noEmit类型检查通过。