dsh-im-lark 0.1.2 → 0.1.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/README.md +3 -3
- package/lib/client.js +2 -2
- package/lib/src/host/inbound-pipeline.js +9 -16
- package/lib/src/shared/version.js +1 -1
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
- **入站**:文本、富文本、图片、文件;语音/视频/表情包等给一句明确提示,不静默丢弃
|
|
18
18
|
- **出站**:Markdown 卡片、图片;长回答按字符与卡片体积双上限切段
|
|
19
19
|
- **引用回复**:回答引用触发它的那条消息,单聊与群里都成立
|
|
20
|
-
- **处理反馈**:收到消息先打 `
|
|
20
|
+
- **处理反馈**:收到消息先打 `Get`(收到)表情,处理完**追加** `DONE`,两个标记并排保留;失败保留 `Get`、不追加 `DONE`,不留「已完成」的假信号。飞书没有官方「正在输入」接口
|
|
21
21
|
- **卡片更新**:流式回答原地更新同一张卡片;超过平台限制(14 天、单卡 5 QPS)后改发新卡
|
|
22
22
|
- **交互卡片**:核心模式的**单问题**单选题与多选题在飞书里勾选后提交,结果交回核心;
|
|
23
23
|
独立模式的单题提问同样发卡片(单选/多选都是勾选器,靠文案区分,必须点提交),其余仍走
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
> 单选/多选靠卡片文案区分,提交后回传勾选项与「其他」输入。两种模式的作答被拒都有可见
|
|
32
32
|
> 反馈:还能答的卡会**整卡重画**并写上原因(飞书的表单提交是一次性的,只发一句提示
|
|
33
33
|
> 会让卡片点不动),可以重新勾选提交;已经不能再答的卡直接改成失效态、去掉勾选框。
|
|
34
|
-
> `
|
|
34
|
+
> `Get` / `DONE` 表情与卡片排版随租户配置略有差异,以实际表现为准。
|
|
35
35
|
|
|
36
36
|
## 安装
|
|
37
37
|
|
|
@@ -98,7 +98,7 @@ dsh plugin --profile web add file:/绝对路径/dsh-im-lark
|
|
|
98
98
|
config:
|
|
99
99
|
domain: feishu # feishu(默认)或 lark(国际版)
|
|
100
100
|
maxText: 2000 # 单条消息字符上限,超出自动切段
|
|
101
|
-
typingIndicator: true # 收到打
|
|
101
|
+
typingIndicator: true # 收到打 Get,处理完追加 DONE(Get 不撤)
|
|
102
102
|
replyStatus: false # 回答末尾附加模型、耗时、token
|
|
103
103
|
directBusyMode: steer # 独立会话里回合进行中又来消息:steer 插话 / queue 排队(旧值 interrupt 会迁移成 steer)
|
|
104
104
|
directWorkspaceId: '' # 独立会话的工作区 id;留空用自动创建的默认工作区
|
package/lib/client.js
CHANGED
|
@@ -131,7 +131,7 @@ var en_default = {
|
|
|
131
131
|
"register.failed": "Failed to create the app. Please retry.",
|
|
132
132
|
"behavior.title": "Message behavior",
|
|
133
133
|
"behavior.typing": "Working / done reaction",
|
|
134
|
-
"behavior.typingHint": "
|
|
134
|
+
"behavior.typingHint": "Adds a Get (received) reaction on arrival, then appends DONE when finished; both stay on the message. Lark has no official typing API.",
|
|
135
135
|
"behavior.replyStatus": "Status line in replies",
|
|
136
136
|
"behavior.replyStatusHint": "Model, reasoning effort and duration.",
|
|
137
137
|
"common.save": "Save",
|
|
@@ -243,7 +243,7 @@ var zh_default = {
|
|
|
243
243
|
"register.failed": "\u521B\u5EFA\u5E94\u7528\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",
|
|
244
244
|
"behavior.title": "\u6D88\u606F\u884C\u4E3A",
|
|
245
245
|
"behavior.typing": "\u5904\u7406\u72B6\u6001\u8868\u60C5",
|
|
246
|
-
"behavior.typingHint": "\u6536\u5230\u6D88\u606F\u5148\u6253
|
|
246
|
+
"behavior.typingHint": "\u6536\u5230\u6D88\u606F\u5148\u6253\u300C\u6536\u5230\u300D(Get)\uFF0C\u5904\u7406\u5B8C\u8FFD\u52A0 DONE\uFF0C\u4E24\u4E2A\u90FD\u4FDD\u7559\u3002\u98DE\u4E66\u6CA1\u6709\u5B98\u65B9\u8F93\u5165\u72B6\u6001\u63A5\u53E3\u3002",
|
|
247
247
|
"behavior.replyStatus": "\u56DE\u590D\u672B\u5C3E\u663E\u793A\u72B6\u6001",
|
|
248
248
|
"behavior.replyStatusHint": "\u9644\u52A0\u6A21\u578B\u3001\u63A8\u7406\u7B49\u7EA7\u4E0E\u8017\u65F6\u3002",
|
|
249
249
|
"common.save": "\u4FDD\u5B58",
|
|
@@ -15,12 +15,13 @@ const TEXT_MAX = 20_000;
|
|
|
15
15
|
/**
|
|
16
16
|
* 消息上的处理状态标记,走官方「添加消息表情回复」接口的 `emoji_type`。
|
|
17
17
|
*
|
|
18
|
-
* - `
|
|
19
|
-
* - `DONE
|
|
18
|
+
* - `Get`:收到消息就打上(官方表情表里「已收到/已受理」语义的那个);
|
|
19
|
+
* - `DONE`:处理完成后**追加**,`Get` 不撤,两个标记并排留在消息上。
|
|
20
20
|
*
|
|
21
|
-
*
|
|
21
|
+
* 第一个标记永不撤销——它只表示「收到过」,失败时也成立;只有成功处理完
|
|
22
|
+
* 才追加 `DONE`,失败不给「已完成」的假信号。
|
|
22
23
|
*/
|
|
23
|
-
const
|
|
24
|
+
const REACTION_ACK = 'Get';
|
|
24
25
|
const REACTION_DONE = 'DONE';
|
|
25
26
|
const KNOWN_IMAGE_TYPES = new Set(['image/png', 'image/jpeg', 'image/webp', 'image/gif']);
|
|
26
27
|
/** 卡片回调的重推窗口:没有 `event_id` 时用它兜住平台重推,窗口之外允许同一张卡再提交。 */
|
|
@@ -135,8 +136,9 @@ export class InboundPipeline {
|
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
async #processMessage(message, body) {
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
if (this.#typing)
|
|
140
|
+
await this.#addReaction(message.messageId, REACTION_ACK);
|
|
141
|
+
// 只有走到最后才算处理完:中途抛错时不追加 DONE。
|
|
140
142
|
let settled = false;
|
|
141
143
|
try {
|
|
142
144
|
const draft = await this.#toDraft(message, body);
|
|
@@ -160,8 +162,7 @@ export class InboundPipeline {
|
|
|
160
162
|
settled = true;
|
|
161
163
|
}
|
|
162
164
|
finally {
|
|
163
|
-
|
|
164
|
-
await this.#removeReaction(message.messageId, typingId);
|
|
165
|
+
// 「收到」标记不撤:它只表示消息已受理,成功与失败都留着。
|
|
165
166
|
if (settled && this.#typing)
|
|
166
167
|
await this.#addReaction(message.messageId, REACTION_DONE);
|
|
167
168
|
}
|
|
@@ -177,14 +178,6 @@ export class InboundPipeline {
|
|
|
177
178
|
return undefined;
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
|
-
async #removeReaction(messageId, reactionId) {
|
|
181
|
-
try {
|
|
182
|
-
await this.#api.removeReaction({ messageId, reactionId });
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
// 移除失败不影响交付;消息上的表情会随消息留存。
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
181
|
/** 事件 → 协议草稿;媒体下载失败时降级成文字说明,不让整条消息丢掉。 */
|
|
189
182
|
async #toDraft(message, body) {
|
|
190
183
|
const notes = [];
|
package/locale/en.json
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"register.failed": "Failed to create the app. Please retry.",
|
|
63
63
|
"behavior.title": "Message behavior",
|
|
64
64
|
"behavior.typing": "Working / done reaction",
|
|
65
|
-
"behavior.typingHint": "
|
|
65
|
+
"behavior.typingHint": "Adds a Get (received) reaction on arrival, then appends DONE when finished; both stay on the message. Lark has no official typing API.",
|
|
66
66
|
"behavior.replyStatus": "Status line in replies",
|
|
67
67
|
"behavior.replyStatusHint": "Model, reasoning effort and duration.",
|
|
68
68
|
"common.save": "Save",
|
package/locale/zh.json
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"register.failed": "创建应用失败,请重试",
|
|
63
63
|
"behavior.title": "消息行为",
|
|
64
64
|
"behavior.typing": "处理状态表情",
|
|
65
|
-
"behavior.typingHint": "
|
|
65
|
+
"behavior.typingHint": "收到消息先打「收到」(Get),处理完追加 DONE,两个都保留。飞书没有官方输入状态接口。",
|
|
66
66
|
"behavior.replyStatus": "回复末尾显示状态",
|
|
67
67
|
"behavior.replyStatusHint": "附加模型、推理等级与耗时。",
|
|
68
68
|
"common.save": "保存",
|