chattercatcher 0.2.2 → 0.2.4
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/cli.js +56 -13
- package/dist/cli.js.map +1 -1
- package/dist/index.js +55 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import fs15 from "fs/promises";
|
|
|
8
8
|
// package.json
|
|
9
9
|
var package_default = {
|
|
10
10
|
name: "chattercatcher",
|
|
11
|
-
version: "0.2.
|
|
11
|
+
version: "0.2.4",
|
|
12
12
|
description: "\u672C\u5730\u4F18\u5148\u7684\u98DE\u4E66/Lark \u5BB6\u5EAD\u7FA4\u77E5\u8BC6\u5E93\u673A\u5668\u4EBA",
|
|
13
13
|
type: "module",
|
|
14
14
|
main: "dist/index.js",
|
|
@@ -2714,6 +2714,28 @@ async function restoreLocalData(input2) {
|
|
|
2714
2714
|
};
|
|
2715
2715
|
}
|
|
2716
2716
|
|
|
2717
|
+
// src/time/beijing.ts
|
|
2718
|
+
var BEIJING_TIME_ZONE = "Asia/Shanghai";
|
|
2719
|
+
var BEIJING_DATE_TIME_FORMATTER = new Intl.DateTimeFormat("zh-CN", {
|
|
2720
|
+
timeZone: BEIJING_TIME_ZONE,
|
|
2721
|
+
year: "numeric",
|
|
2722
|
+
month: "2-digit",
|
|
2723
|
+
day: "2-digit",
|
|
2724
|
+
hour: "2-digit",
|
|
2725
|
+
minute: "2-digit",
|
|
2726
|
+
second: "2-digit",
|
|
2727
|
+
hour12: false
|
|
2728
|
+
});
|
|
2729
|
+
function formatOffsetTimeZone(date) {
|
|
2730
|
+
const parts = Object.fromEntries(
|
|
2731
|
+
BEIJING_DATE_TIME_FORMATTER.formatToParts(date).map((part) => [part.type, part.value])
|
|
2732
|
+
);
|
|
2733
|
+
return `${parts.year}-${parts.month}-${parts.day}T${parts.hour}:${parts.minute}:${parts.second}+08:00`;
|
|
2734
|
+
}
|
|
2735
|
+
function formatBeijingTimeForPrompt(date) {
|
|
2736
|
+
return `${formatOffsetTimeZone(date)}\uFF08\u5317\u4EAC\u65F6\u95F4\uFF0CUTC+8\uFF0CAsia/Shanghai\uFF09`;
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2717
2739
|
// src/episodes/summarizer.ts
|
|
2718
2740
|
async function summarizeEpisodeWindow(window, model, now) {
|
|
2719
2741
|
const transcript = window.messages.map((message) => `[${message.sentAt}] ${message.senderName}\uFF1A${message.text}`).join("\n");
|
|
@@ -2724,7 +2746,7 @@ async function summarizeEpisodeWindow(window, model, now) {
|
|
|
2724
2746
|
},
|
|
2725
2747
|
{
|
|
2726
2748
|
role: "user",
|
|
2727
|
-
content: `\u5F53\u524D\u65F6\u95F4\uFF1A${now
|
|
2749
|
+
content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(now)}
|
|
2728
2750
|
\u7FA4\u804A\uFF1A${window.chatName}
|
|
2729
2751
|
\u65F6\u95F4\uFF1A${window.startedAt} - ${window.endedAt}
|
|
2730
2752
|
|
|
@@ -3160,7 +3182,7 @@ ${input2.memberPrompt}
|
|
|
3160
3182
|
\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;
|
|
3161
3183
|
const messages = [
|
|
3162
3184
|
{ role: "system", content: systemPrompt },
|
|
3163
|
-
{ role: "user", content: `\u5F53\u524D\u65F6\u95F4\uFF1A${input2.now
|
|
3185
|
+
{ role: "user", content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(input2.now)}
|
|
3164
3186
|
\u4EFB\u52A1\u63D0\u793A\u8BCD\uFF1A${input2.prompt}` }
|
|
3165
3187
|
];
|
|
3166
3188
|
const toolsByName = new Map(input2.tools.map((tool) => [tool.name, tool]));
|
|
@@ -3180,7 +3202,7 @@ ${input2.memberPrompt}
|
|
|
3180
3202
|
{ role: "system", content: systemPrompt },
|
|
3181
3203
|
{
|
|
3182
3204
|
role: "user",
|
|
3183
|
-
content: `\u5F53\u524D\u65F6\u95F4\uFF1A${input2.now
|
|
3205
|
+
content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(input2.now)}
|
|
3184
3206
|
\u4EFB\u52A1\u63D0\u793A\u8BCD\uFF1A${input2.prompt}
|
|
3185
3207
|
|
|
3186
3208
|
\u8BC1\u636E\uFF1A
|
|
@@ -3208,7 +3230,7 @@ ${evidenceToText(evidence)}`
|
|
|
3208
3230
|
{ role: "system", content: SYSTEM_PROMPT },
|
|
3209
3231
|
{
|
|
3210
3232
|
role: "user",
|
|
3211
|
-
content: `\u5F53\u524D\u65F6\u95F4\uFF1A${input2.now
|
|
3233
|
+
content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(input2.now)}
|
|
3212
3234
|
\u4EFB\u52A1\u63D0\u793A\u8BCD\uFF1A${input2.prompt}
|
|
3213
3235
|
|
|
3214
3236
|
\u8BC1\u636E\uFF1A
|
|
@@ -4217,7 +4239,7 @@ async function runFeishuToolLoop(input2) {
|
|
|
4217
4239
|
const systemPrompt = systemPromptParts.join("\n\n");
|
|
4218
4240
|
const messages = [
|
|
4219
4241
|
{ role: "system", content: systemPrompt },
|
|
4220
|
-
{ role: "user", content: `\u5F53\u524D\u65F6\u95F4\uFF1A${input2.now
|
|
4242
|
+
{ role: "user", content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(input2.now)}
|
|
4221
4243
|
\u95EE\u9898\uFF1A${input2.question}` }
|
|
4222
4244
|
];
|
|
4223
4245
|
const toolsByName = new Map(input2.tools.map((tool) => [tool.name, tool]));
|
|
@@ -4611,12 +4633,33 @@ function extractImageKey(response) {
|
|
|
4611
4633
|
throw new Error("\u98DE\u4E66\u56FE\u7247\u4E0A\u4F20\u54CD\u5E94\u7F3A\u5C11 image_key\u3002");
|
|
4612
4634
|
}
|
|
4613
4635
|
function collectErrorFields(error) {
|
|
4614
|
-
const fields = [
|
|
4615
|
-
const
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4636
|
+
const fields = [];
|
|
4637
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4638
|
+
function visit(value) {
|
|
4639
|
+
if (value === void 0 || value === null || seen.has(value)) {
|
|
4640
|
+
return;
|
|
4641
|
+
}
|
|
4642
|
+
fields.push(value);
|
|
4643
|
+
if (typeof value !== "object") {
|
|
4644
|
+
return;
|
|
4645
|
+
}
|
|
4646
|
+
seen.add(value);
|
|
4647
|
+
if (Array.isArray(value)) {
|
|
4648
|
+
for (const item of value) {
|
|
4649
|
+
visit(item);
|
|
4650
|
+
}
|
|
4651
|
+
return;
|
|
4652
|
+
}
|
|
4653
|
+
const record = value;
|
|
4654
|
+
visit(record.code);
|
|
4655
|
+
visit(record.errorCode);
|
|
4656
|
+
visit(record.msg);
|
|
4657
|
+
visit(record.message);
|
|
4658
|
+
visit(record.error);
|
|
4659
|
+
visit(record.response);
|
|
4660
|
+
visit(record.data);
|
|
4661
|
+
}
|
|
4662
|
+
visit(error);
|
|
4620
4663
|
return fields;
|
|
4621
4664
|
}
|
|
4622
4665
|
function isRichTextCompatibilityError(error) {
|
|
@@ -5749,7 +5792,7 @@ function buildEvidencePrompt(input2, options = {}) {
|
|
|
5749
5792
|
},
|
|
5750
5793
|
{
|
|
5751
5794
|
role: "user",
|
|
5752
|
-
content: `\u5F53\u524D\u65F6\u95F4\uFF1A${now
|
|
5795
|
+
content: `\u5F53\u524D\u65F6\u95F4\uFF1A${formatBeijingTimeForPrompt(now)}
|
|
5753
5796
|
\u95EE\u9898\uFF1A${question}
|
|
5754
5797
|
|
|
5755
5798
|
\u8BC1\u636E\u5904\u7406\u89C4\u5219\uFF1A
|