chattercatcher 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -178,6 +178,28 @@ function resolveEmbeddingApiKey(input) {
178
178
  return explicit || input.llmApiKey;
179
179
  }
180
180
 
181
+ // src/time/beijing.ts
182
+ var BEIJING_TIME_ZONE = "Asia/Shanghai";
183
+ var BEIJING_DATE_TIME_FORMATTER = new Intl.DateTimeFormat("zh-CN", {
184
+ timeZone: BEIJING_TIME_ZONE,
185
+ year: "numeric",
186
+ month: "2-digit",
187
+ day: "2-digit",
188
+ hour: "2-digit",
189
+ minute: "2-digit",
190
+ second: "2-digit",
191
+ hour12: false
192
+ });
193
+ function formatOffsetTimeZone(date) {
194
+ const parts = Object.fromEntries(
195
+ BEIJING_DATE_TIME_FORMATTER.formatToParts(date).map((part) => [part.type, part.value])
196
+ );
197
+ return `${parts.year}-${parts.month}-${parts.day}T${parts.hour}:${parts.minute}:${parts.second}+08:00`;
198
+ }
199
+ function formatBeijingTimeForPrompt(date) {
200
+ return `${formatOffsetTimeZone(date)}\uFF08\u5317\u4EAC\u65F6\u95F4\uFF0CUTC+8\uFF0CAsia/Shanghai\uFF09`;
201
+ }
202
+
181
203
  // src/cron/generator.ts
182
204
  var SYSTEM_PROMPT = "\u4F60\u6B63\u5728\u4E3A\u98DE\u4E66\u7FA4\u751F\u6210\u4E00\u6761\u5B9A\u65F6\u6D88\u606F\u3002\u53EF\u4EE5\u5148\u8C03\u7528\u641C\u7D22\u5DE5\u5177\u68C0\u7D22\u672C\u5730\u7FA4\u804A\u77E5\u8BC6\u5E93\u3002\u6700\u7EC8\u8F93\u51FA\u5FC5\u987B\u662F\u53EF\u4EE5\u76F4\u63A5\u53D1\u5230\u7FA4\u91CC\u7684\u7EAF\u6587\u672C\uFF0C\u4E0D\u8981\u8F93\u51FA\u5DE5\u5177\u8C03\u7528\u8BF4\u660E\u3002";
183
205
  function evidenceToText(evidence) {
@@ -199,7 +221,7 @@ ${input.memberPrompt}
199
221
  \u751F\u6210\u6D88\u606F\u65F6\u9047\u5230\u4E0A\u8FF0 ID \u65F6\u4F18\u5148\u4F7F\u7528\u5BF9\u5E94\u7FA4\u6635\u79F0\uFF1B\u6CA1\u6709\u6620\u5C04\u65F6\u4FDD\u7559\u539F ID\uFF0C\u4E0D\u8981\u7F16\u9020\u6635\u79F0\u3002` : SYSTEM_PROMPT;
200
222
  const messages = [
201
223
  { role: "system", content: systemPrompt },
202
- { role: "user", content: `\u5F53\u524D\u65F6\u95F4\uFF1A${input.now.toISOString()}
224
+ { role: "user", content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(input.now)}
203
225
  \u4EFB\u52A1\u63D0\u793A\u8BCD\uFF1A${input.prompt}` }
204
226
  ];
205
227
  const toolsByName = new Map(input.tools.map((tool) => [tool.name, tool]));
@@ -219,7 +241,7 @@ ${input.memberPrompt}
219
241
  { role: "system", content: systemPrompt },
220
242
  {
221
243
  role: "user",
222
- content: `\u5F53\u524D\u65F6\u95F4\uFF1A${input.now.toISOString()}
244
+ content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(input.now)}
223
245
  \u4EFB\u52A1\u63D0\u793A\u8BCD\uFF1A${input.prompt}
224
246
 
225
247
  \u8BC1\u636E\uFF1A
@@ -247,7 +269,7 @@ ${evidenceToText(evidence)}`
247
269
  { role: "system", content: SYSTEM_PROMPT },
248
270
  {
249
271
  role: "user",
250
- content: `\u5F53\u524D\u65F6\u95F4\uFF1A${input.now.toISOString()}
272
+ content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(input.now)}
251
273
  \u4EFB\u52A1\u63D0\u793A\u8BCD\uFF1A${input.prompt}
252
274
 
253
275
  \u8BC1\u636E\uFF1A
@@ -3202,7 +3224,7 @@ async function summarizeEpisodeWindow(window, model, now) {
3202
3224
  },
3203
3225
  {
3204
3226
  role: "user",
3205
- content: `\u5F53\u524D\u65F6\u95F4\uFF1A${now.toISOString()}
3227
+ content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(now)}
3206
3228
  \u7FA4\u804A\uFF1A${window.chatName}
3207
3229
  \u65F6\u95F4\uFF1A${window.startedAt} - ${window.endedAt}
3208
3230
 
@@ -4072,7 +4094,7 @@ async function runFeishuToolLoop(input) {
4072
4094
  const systemPrompt = systemPromptParts.join("\n\n");
4073
4095
  const messages = [
4074
4096
  { role: "system", content: systemPrompt },
4075
- { role: "user", content: `\u5F53\u524D\u65F6\u95F4\uFF1A${input.now.toISOString()}
4097
+ { role: "user", content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(input.now)}
4076
4098
  \u95EE\u9898\uFF1A${input.question}` }
4077
4099
  ];
4078
4100
  const toolsByName = new Map(input.tools.map((tool) => [tool.name, tool]));
@@ -5402,7 +5424,7 @@ function buildEvidencePrompt(input, options = {}) {
5402
5424
  },
5403
5425
  {
5404
5426
  role: "user",
5405
- content: `\u5F53\u524D\u65F6\u95F4\uFF1A${now.toISOString()}
5427
+ content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(now)}
5406
5428
  \u95EE\u9898\uFF1A${question}
5407
5429
 
5408
5430
  \u8BC1\u636E\u5904\u7406\u89C4\u5219\uFF1A