@dingtalk-real-ai/dingtalk-connector 0.7.5 → 0.7.7
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/.github/workflows/issue-to-AI-table.yml +52 -0
- package/CHANGELOG.md +30 -0
- package/README.md +56 -21
- package/docs/RELEASE_NOTES_V0.7.4.md +63 -79
- package/docs/RELEASE_NOTES_V0.7.5.md +143 -129
- package/docs/RELEASE_NOTES_V0.7.6.md +219 -0
- package/docs/RELEASE_NOTES_V0.7.7.md +122 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +13 -5
- package/plugin.ts +179 -32
- package/tests/README.md +54 -0
- package/tests/ai-card/PLAN.md +54 -0
- package/tests/ai-card/ai-card.test.ts +372 -0
- package/tests/audio/PLAN.md +64 -0
- package/tests/audio/audio.test.ts +283 -0
- package/tests/bindings/PLAN.md +99 -0
- package/tests/bindings/bindings.test.ts +191 -0
- package/tests/card-update/PLAN.md +29 -0
- package/tests/card-update/card-update.test.ts +127 -0
- package/tests/config-token/PLAN.md +94 -0
- package/tests/config-token/config-token.test.ts +153 -0
- package/tests/core/PLAN.md +65 -0
- package/tests/core/core.test.ts +286 -0
- package/tests/deliver-payload/PLAN.md +59 -0
- package/tests/deliver-payload/deliver-payload.test.ts +91 -0
- package/tests/download/PLAN.md +47 -0
- package/tests/download/download.test.ts +261 -0
- package/tests/file-markers/PLAN.md +74 -0
- package/tests/file-markers/file-markers.test.ts +105 -0
- package/tests/index.ts +129 -0
- package/tests/integration/PLAN.md +65 -0
- package/tests/integration/integration.test.ts +232 -0
- package/tests/mcp-tools/PLAN.md +67 -0
- package/tests/mcp-tools/mcp-tools.test.ts +327 -0
- package/tests/media/PLAN.md +37 -0
- package/tests/media/media.test.ts +50 -0
- package/tests/message-extract/PLAN.md +83 -0
- package/tests/message-extract/message-extract.test.ts +205 -0
- package/tests/proactive/PLAN.md +88 -0
- package/tests/proactive/proactive.test.ts +502 -0
- package/tests/prompts/PLAN.md +71 -0
- package/tests/prompts/prompts.test.ts +64 -0
- package/tests/send-message/PLAN.md +44 -0
- package/tests/send-message/send-message.test.ts +228 -0
- package/tests/session/PLAN.md +90 -0
- package/tests/session/session.test.ts +166 -0
- package/tests/upload/PLAN.md +72 -0
- package/tests/upload/upload.test.ts +390 -0
- package/tests/video/PLAN.md +118 -0
- package/tests/video/video.test.ts +40 -0
- package/vitest.config.ts +13 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Issue 变更推送到 Webhook
|
|
2
|
+
# 当有 Issue 变更时,发送指定格式的数据到 webhook
|
|
3
|
+
name: 📤 Issue Webhook Notification
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
issues:
|
|
7
|
+
types: [opened, reopened, closed, edited, labeled, unlabeled]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
notify:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: 📬 Send Issue to Webhook
|
|
14
|
+
uses: actions/github-script@v7
|
|
15
|
+
with:
|
|
16
|
+
script: |
|
|
17
|
+
const webhook = process.env.ISSUE_WEBHOOK_URL;
|
|
18
|
+
if (!webhook) {
|
|
19
|
+
console.log('⚠️ ISSUE_WEBHOOK_URL not set, skipping notification');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const payload = context.payload;
|
|
24
|
+
const issue = payload.issue;
|
|
25
|
+
const action = payload.action;
|
|
26
|
+
|
|
27
|
+
// 构建指定格式的数据
|
|
28
|
+
const webhookPayload = {
|
|
29
|
+
action: action,
|
|
30
|
+
issue: {
|
|
31
|
+
id: issue.id,
|
|
32
|
+
number: issue.number,
|
|
33
|
+
title: issue.title,
|
|
34
|
+
body: issue.body,
|
|
35
|
+
state: issue.state,
|
|
36
|
+
html_url: issue.html_url
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const response = await fetch(webhook, {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
headers: { 'Content-Type': 'application/json' },
|
|
43
|
+
body: JSON.stringify(webhookPayload)
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (response.ok) {
|
|
47
|
+
console.log('✅ Webhook notification sent successfully');
|
|
48
|
+
} else {
|
|
49
|
+
console.log('❌ Failed to send webhook notification:', response.status, response.statusText);
|
|
50
|
+
}
|
|
51
|
+
env:
|
|
52
|
+
ISSUE_WEBHOOK_URL: ${{ secrets.DINGTALK_AI_TABLE_WEBHOOK }}
|
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,34 @@
|
|
|
6
6
|
This document records all significant changes. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
7
7
|
and version numbers follow [Semantic Versioning](https://semver.org/).
|
|
8
8
|
|
|
9
|
+
## [0.7.7] - 2026-03-13
|
|
10
|
+
|
|
11
|
+
### 新增 / Added
|
|
12
|
+
- ✨ **自定义 Gateway URL 支持** - 新增 `gatewayBaseUrl` 配置项,支持通过自定义 URL(如 Nginx 反向代理到 TLS/HTTPS Gateway)访问 Gateway
|
|
13
|
+
**Custom Gateway URL support** - Added `gatewayBaseUrl` option to allow using a custom URL (e.g., Nginx reverse proxy to a TLS/HTTPS Gateway)
|
|
14
|
+
- ✨ **钉钉「思考中」表情反馈** - 在处理用户消息期间为原消息贴上「🤔思考中」表情,处理结束后自动撤回,清晰展示处理进度
|
|
15
|
+
**DingTalk “thinking” emotion feedback** - Attaches a “🤔 Thinking” emotion to the original user message while processing and automatically recalls it after completion to clearly indicate progress
|
|
16
|
+
- ✨ **测试基础设施完善** - 引入 Vitest 及多种测试脚本(run/watch/coverage/ui/integration),为后续自动化测试和回归验证提供基础
|
|
17
|
+
**Improved testing infrastructure** - Introduced Vitest and multiple test scripts (run/watch/coverage/ui/integration) to enable better automated and regression testing
|
|
18
|
+
- ✨ **Issue Webhook 工作流** - 新增 GitHub Actions 工作流,将 Issue 变更以统一 JSON 格式推送到配置的 Webhook
|
|
19
|
+
**Issue webhook workflow** - Added a GitHub Actions workflow to push Issue changes as unified JSON payloads to a configured webhook
|
|
20
|
+
|
|
21
|
+
### 修复 / Fixes
|
|
22
|
+
- 🐛 **媒体元数据与缩略图提取更健壮** - ffprobe 或缩略图生成失败时不再中断主流程,而是返回默认元数据或空缩略图
|
|
23
|
+
**More robust media metadata & thumbnail extraction** - ffprobe or thumbnail generation failures no longer abort the main flow but return default metadata or a null thumbnail instead
|
|
24
|
+
- 🐛 **音频时长提取兼容性改进** - 使用动态 `import('child_process')` 替代 `require('child_process')`,提升在不同运行环境下的兼容性
|
|
25
|
+
**Audio duration extraction compatibility** - Replaced `require('child_process')` with dynamic `import('child_process')` to improve compatibility across environments
|
|
26
|
+
- 🐛 **主动消息用户列表校验** - 为主动消息的 `userIds` 列表增加空值过滤,避免因无效用户 ID 导致请求失败
|
|
27
|
+
**Proactive message user list validation** - Added empty value filtering for the `userIds` list in proactive messages to prevent request failures caused by invalid IDs
|
|
28
|
+
|
|
29
|
+
## [0.7.6] - 2026-03-12
|
|
30
|
+
|
|
31
|
+
### 修复 / Fixes
|
|
32
|
+
- 🐛 **Gateway 端口连接修复** - 修复修改 gateway 端口后无法连接的问题,确保配置中的 `gateway.port` 能够正确生效
|
|
33
|
+
**Gateway port connection fix** - Fixed issue where connection fails after modifying gateway port, ensuring that `gateway.port` in configuration takes effect correctly
|
|
34
|
+
- 🐛 **新会话命令修复** - 修复新会话命令(`/new`、`/reset`、`/clear`、`新会话` 等)未真正清理会话的问题,统一将命令透传到 Gateway 由 Gateway 统一处理会话重置
|
|
35
|
+
**New session command fix** - Fixed issue where new session commands (`/new`, `/reset`, `/clear`, `新会话`, etc.) did not actually clear sessions, commands are now forwarded to Gateway for unified session reset handling
|
|
36
|
+
|
|
9
37
|
## [0.7.5] - 2026-03-10
|
|
10
38
|
|
|
11
39
|
### 修复 / Fixes
|
|
@@ -13,6 +41,8 @@ and version numbers follow [Semantic Versioning](https://semver.org/).
|
|
|
13
41
|
**Fixed Stream client frequent reconnection issue** - Disabled `DWClient` built-in `autoReconnect`, reconnection is now managed by framework's health-monitor to avoid dual reconnection mechanism conflict
|
|
14
42
|
- 🐛 **修复连接关闭不完整问题** - `stop()` 方法现在正确调用 `client.disconnect()` 关闭 WebSocket 连接
|
|
15
43
|
**Fixed incomplete connection closure** - `stop()` method now correctly calls `client.disconnect()` to close WebSocket connection
|
|
44
|
+
- 🐛 **Gateway 端口连接修复** - 修复修改 gateway 端口后无法连接的问题
|
|
45
|
+
**Gateway port connection fix** - Fixed issue where connection fails after modifying gateway port
|
|
16
46
|
|
|
17
47
|
### 重构 / Refactoring
|
|
18
48
|
- ✅ **OpenClaw session.dmScope 机制** - 会话管理由 OpenClaw Gateway 统一处理,插件不再内部管理会话超时
|
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
# DingTalk OpenClaw Connector
|
|
1
|
+
# Offical DingTalk OpenClaw Connector
|
|
2
|
+
## 钉钉官方OpenClaw连接器
|
|
2
3
|
|
|
3
4
|
以下提供两种方案连接到 [OpenClaw](https://openclaw.ai) Gateway,分别是钉钉机器人和钉钉 DEAP Agent。
|
|
4
5
|
|
|
5
|
-
> 📝 **版本信息**:当前版本 v0.7.
|
|
6
|
+
> 📝 **版本信息**:当前版本 v0.7.7 | [查看变更日志](CHANGELOG.md) | [发布说明](docs/RELEASE_NOTES_V0.7.7.md) | [发布指南](RELEASE.md)
|
|
6
7
|
|
|
7
8
|
## 快速导航
|
|
8
9
|
|
|
@@ -86,6 +87,7 @@ openclaw plugins install -l .
|
|
|
86
87
|
"channels": {
|
|
87
88
|
"dingtalk-connector": {
|
|
88
89
|
"enabled": true,
|
|
90
|
+
"gatewayBaseUrl": "http://localhost:18789", // 可选:如果Gateway地址是TLS/HTTPS,see PR #117
|
|
89
91
|
"clientId": "dingxxxxxxxxx", // 钉钉 AppKey
|
|
90
92
|
"clientSecret": "your_secret_here", // 钉钉 AppSecret
|
|
91
93
|
"gatewayToken": "", // 可选:Gateway 认证 token, openclaw.json配置中 gateway.auth.token 的值
|
|
@@ -97,19 +99,17 @@ openclaw plugins install -l .
|
|
|
97
99
|
"asyncMode": false, // 可选:异步模式,立即回执用户消息,后台处理并推送结果(默认:false)
|
|
98
100
|
"ackText": "🫡 任务已接收" // 可选:异步模式下的回执消息文本(默认:'🫡 任务已接收,处理中...')
|
|
99
101
|
}
|
|
100
|
-
},
|
|
101
|
-
"gateway": { // gateway通常是已有的节点,配置时注意把http部分追加到已有节点下
|
|
102
|
-
"http": {
|
|
103
|
-
"endpoints": {
|
|
104
|
-
"chatCompletions": {
|
|
105
|
-
"enabled": true
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
102
|
}
|
|
110
103
|
}
|
|
111
104
|
```
|
|
112
105
|
|
|
106
|
+
执行配置命令
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
openclaw config set gateway.http.endpoints.chatCompletions.enabled true
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
|
|
113
113
|
或者在 OpenClaw Dashboard 页面配置:
|
|
114
114
|
|
|
115
115
|
<img width="1916" height="1996" alt="image" src="https://github.com/user-attachments/assets/00b585ca-c1df-456c-9c65-7345a718b94b" />
|
|
@@ -129,21 +129,20 @@ openclaw plugins list # 确认 dingtalk-connector 已加载
|
|
|
129
129
|
## 创建钉钉机器人
|
|
130
130
|
|
|
131
131
|
1. 打开 [钉钉开放平台](https://open.dingtalk.com/)
|
|
132
|
-
2. 进入 **应用开发** → **企业内部开发** →
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
5. **发布应用**,记录 **AppKey** 和 **AppSecret**
|
|
132
|
+
2. 进入 **应用开发** → **企业内部开发** → 创建openclaw机器人
|
|
133
|
+
<img width="2529" height="961" alt="image" src="https://github.com/user-attachments/assets/4163dc50-808c-43c2-84bd-a1e8dde42e05" />
|
|
134
|
+
3. 创建好机器人后,保存一下生成的clientId和clientSecret, 后续配置参数需要
|
|
135
|
+
<img width="687" height="540" alt="image" src="https://github.com/user-attachments/assets/c036ea46-9750-4814-8c24-3e4b54bd2788" />
|
|
136
|
+
|
|
137
|
+
或者在机器人详情中 也可以拿到
|
|
138
|
+
<img width="1527" height="377" alt="image" src="https://github.com/user-attachments/assets/3cf2a661-ed81-441d-9cda-024a6a5377cc" />
|
|
140
139
|
|
|
141
140
|
## 配置参考
|
|
142
141
|
|
|
143
142
|
| 配置项 | 环境变量 | 说明 |
|
|
144
143
|
|--------|----------|------|
|
|
145
|
-
| `clientId` | `DINGTALK_CLIENT_ID` |
|
|
146
|
-
| `clientSecret` | `DINGTALK_CLIENT_SECRET` |
|
|
144
|
+
| `clientId` | `DINGTALK_CLIENT_ID` | 上一步创建openclaw机器人给到的 clinetId |
|
|
145
|
+
| `clientSecret` | `DINGTALK_CLIENT_SECRET` | 上一步创建openclaw机器人给到的 clientSecret |
|
|
147
146
|
| `gatewayToken` | `OPENCLAW_GATEWAY_TOKEN` | Gateway 认证 token(可选) |
|
|
148
147
|
| `gatewayPassword` | — | Gateway 认证 password(可选,与 token 二选一) |
|
|
149
148
|
| `sessionTimeout` | — | ⚠️ 已废弃,请使用 Gateway 的 [`session.reset.idleMinutes`](https://docs.openclaw.ai/gateway/configuration) 配置 |
|
|
@@ -547,6 +546,39 @@ openclaw plugins install @dingtalk-real-ai/dingtalk-connector
|
|
|
547
546
|
| `mammoth` | Word 文档(.docx)解析 |
|
|
548
547
|
| `pdf-parse` | PDF 文档解析 |
|
|
549
548
|
|
|
549
|
+
### Q: Stream 客户端连接 400 错误
|
|
550
|
+
|
|
551
|
+
日志中出现 `channel exited: Request failed with status code 400`,表示钉钉 Stream 连接失败。
|
|
552
|
+
|
|
553
|
+
**常见原因:**
|
|
554
|
+
|
|
555
|
+
| 原因 | 排查方法 |
|
|
556
|
+
|------|----------|
|
|
557
|
+
| **应用未发布** | 钉钉开放平台 → 应用 → 版本管理 → 确认已发布 |
|
|
558
|
+
| **凭证错误** | 检查 `clientId`/`clientSecret` 是否有空格或换行 |
|
|
559
|
+
| **非 Stream 模式** | 确认机器人消息接收模式为 **Stream 模式** |
|
|
560
|
+
| **IP 白名单限制** | 检查应用是否设置了 IP 白名单 |
|
|
561
|
+
|
|
562
|
+
**排查步骤:**
|
|
563
|
+
|
|
564
|
+
1. **验证凭证有效性**
|
|
565
|
+
```bash
|
|
566
|
+
curl -X POST "https://api.dingtalk.com/v1.0/oauth2/accessToken" \
|
|
567
|
+
-H "Content-Type: application/json" \
|
|
568
|
+
-d '{"appKey": "你的clientId", "appSecret": "你的clientSecret"}'
|
|
569
|
+
```
|
|
570
|
+
- 返回 `accessToken` → 凭证正确
|
|
571
|
+
- 返回 `400`/`invalid` → 凭证错误或应用未发布
|
|
572
|
+
|
|
573
|
+
2. **检查应用状态**
|
|
574
|
+
- 登录 [钉钉开放平台](https://open-dev.dingtalk.com/)
|
|
575
|
+
- 确认应用已发布(版本管理 → 发布)
|
|
576
|
+
- 确认机器人已启用且为 Stream 模式
|
|
577
|
+
|
|
578
|
+
3. **重新发布应用**
|
|
579
|
+
- 修改任何配置后,必须点击 **保存** → **发布**
|
|
580
|
+
|
|
581
|
+
|
|
550
582
|
# 方案二:钉钉 DEAP Agent 集成
|
|
551
583
|
|
|
552
584
|
通过将钉钉 [DEAP](https://deap.dingtalk.com) Agent 与 [OpenClaw](https://openclaw.ai) Gateway 连接,实现自然语言驱动的本地设备操作能力。
|
|
@@ -646,6 +678,9 @@ openclaw gateway start
|
|
|
646
678
|
|
|
647
679
|
<img width="3426" height="1752" alt="配置 OpenClaw 技能参数" src="https://github.com/user-attachments/assets/bc725789-382f-41b5-bbdb-ba8f29923d5c" />
|
|
648
680
|
|
|
681
|
+
注意 OpenClaw 属于一个MCP,还需要配置他的触发规则,满足规则的情况下才会使用这个MCP:
|
|
682
|
+
<img width="1088" height="526" alt="image" src="https://github.com/user-attachments/assets/8b0b6f6d-70ff-4edc-b674-7a24126aadfa" />
|
|
683
|
+
|
|
649
684
|
4. 发布 Agent:
|
|
650
685
|
|
|
651
686
|
<img width="3416" height="1762" alt="发布 Agent" src="https://github.com/user-attachments/assets/3f8c3fdb-5f2b-4a4b-8896-35202e713bf3" />
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Release Notes - v0.7.4
|
|
2
2
|
|
|
3
|
-
## 🎉
|
|
3
|
+
## 🎉 功能增强版本 / Feature Enhancement Release
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
本次更新主要新增了按会话区分 Session 的功能,支持单聊、群聊、不同群分别维护独立会话,并提供了记忆隔离/共享的配置选项,让会话管理更加灵活和精细。
|
|
6
6
|
|
|
7
|
-
This update
|
|
7
|
+
This update primarily adds session separation by conversation feature, supporting separate sessions for direct chat, group chat, and different groups, and provides memory isolation/sharing configuration options for more flexible and fine-grained session management.
|
|
8
8
|
|
|
9
9
|
## ✨ 新增功能 / Added Features
|
|
10
10
|
|
|
@@ -16,11 +16,11 @@ Support separate sessions for direct chat, group chat, and different groups; con
|
|
|
16
16
|
|
|
17
17
|
**使用场景 / Use Cases**:
|
|
18
18
|
- ✅ 同一机器人在多个群中服务,希望每个群的对话互不干扰
|
|
19
|
-
Same bot
|
|
19
|
+
Same bot serves multiple groups, with isolated conversations per group
|
|
20
20
|
- ✅ 用户既在私聊也在群聊中使用机器人,希望私聊与群聊上下文分离
|
|
21
|
-
Users
|
|
22
|
-
- ✅
|
|
23
|
-
Complete conversation history
|
|
21
|
+
Users interact with bot in both DMs and group chats, with separated contexts
|
|
22
|
+
- ✅ 不同群之间的对话历史完全隔离
|
|
23
|
+
Complete isolation of conversation history between different groups
|
|
24
24
|
|
|
25
25
|
**配置方式 / Configuration**:
|
|
26
26
|
```json5
|
|
@@ -35,79 +35,77 @@ Support separate sessions for direct chat, group chat, and different groups; con
|
|
|
35
35
|
|
|
36
36
|
**影响范围 / Impact**:
|
|
37
37
|
默认启用,所有用户自动获得会话隔离能力。如需兼容旧行为(按用户维度维护 session),可设置 `separateSessionByConversation: false`。
|
|
38
|
-
Enabled by default, all users automatically get session isolation capability. To maintain
|
|
38
|
+
Enabled by default, all users automatically get session isolation capability. To maintain old behavior (session per user), set `separateSessionByConversation: false`.
|
|
39
39
|
|
|
40
40
|
### 2. 记忆隔离/共享配置 / Memory Isolation/Sharing Configuration
|
|
41
41
|
|
|
42
42
|
**功能描述 / Feature Description**:
|
|
43
|
-
新增 `sharedMemoryAcrossConversations` 配置,控制单 Agent
|
|
44
|
-
Added `sharedMemoryAcrossConversations` option to control whether memory is shared across conversations in single-Agent mode
|
|
43
|
+
新增 `sharedMemoryAcrossConversations` 配置,控制单 Agent 场景下是否在不同会话间共享记忆;默认 `false` 实现群聊与私聊、不同群之间的记忆隔离。
|
|
44
|
+
Added `sharedMemoryAcrossConversations` option to control whether memory is shared across conversations in single-Agent mode; default `false` isolates memory between DMs, group chats, and different groups.
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
46
|
+
**配置选项 / Configuration Options**:
|
|
47
|
+
- `false`(默认):不同群聊、群聊与私聊之间的记忆隔离,AI 不会混淆不同场景下的对话历史
|
|
48
|
+
`false` (default): Memory isolated between different groups and between DMs and groups, AI won't confuse conversation history across scenarios
|
|
49
|
+
- `true`:单 Agent 场景下,同一用户在不同会话间共享记忆
|
|
50
|
+
`true`: In single-Agent mode, same user shares memory across different sessions
|
|
51
51
|
|
|
52
52
|
**配置方式 / Configuration**:
|
|
53
53
|
```json5
|
|
54
54
|
{
|
|
55
55
|
"channels": {
|
|
56
56
|
"dingtalk-connector": {
|
|
57
|
-
"sharedMemoryAcrossConversations": false // 默认:false
|
|
57
|
+
"sharedMemoryAcrossConversations": false // 默认:false
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
**影响范围 / Impact**:
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
默认关闭,确保不同场景下的记忆隔离。如需跨会话共享记忆,可设置 `sharedMemoryAcrossConversations: true`。
|
|
65
|
+
Disabled by default, ensuring memory isolation across scenarios. To share memory across sessions, set `sharedMemoryAcrossConversations: true`.
|
|
66
66
|
|
|
67
67
|
### 3. Gateway Session 格式增强 / Gateway Session Format Enhancement
|
|
68
68
|
|
|
69
69
|
**功能描述 / Feature Description**:
|
|
70
|
-
Session key 支持 `group:conversationId` 格式,便于 Gateway
|
|
71
|
-
Session key supports `group:conversationId` format for Gateway to identify group chat scenarios
|
|
70
|
+
Session key 支持 `group:conversationId` 格式,便于 Gateway 识别群聊场景。
|
|
71
|
+
Session key supports `group:conversationId` format for Gateway to identify group chat scenarios.
|
|
72
72
|
|
|
73
73
|
**技术细节 / Technical Details**:
|
|
74
|
-
- 单聊会话:使用 `direct:{
|
|
75
|
-
Direct chat sessions: Use `direct:{
|
|
74
|
+
- 单聊会话:使用 `direct:{userId}` 格式
|
|
75
|
+
Direct chat sessions: Use `direct:{userId}` format
|
|
76
76
|
- 群聊会话:使用 `group:{conversationId}` 格式
|
|
77
77
|
Group chat sessions: Use `group:{conversationId}` format
|
|
78
|
-
- Gateway
|
|
79
|
-
Gateway can
|
|
78
|
+
- Gateway 可以根据 Session key 格式识别会话类型
|
|
79
|
+
Gateway can identify session type based on Session key format
|
|
80
80
|
|
|
81
81
|
**影响范围 / Impact**:
|
|
82
|
-
|
|
83
|
-
Internal implementation improvement,
|
|
82
|
+
内部实现改进,不影响用户使用,但提高了 Gateway 对会话类型的识别能力。
|
|
83
|
+
Internal implementation improvement, does not affect user usage, but improves Gateway's ability to identify session types.
|
|
84
84
|
|
|
85
85
|
### 4. X-OpenClaw-Memory-User 支持 / X-OpenClaw-Memory-User Support
|
|
86
86
|
|
|
87
87
|
**功能描述 / Feature Description**:
|
|
88
|
-
向 Gateway 传递记忆归属用户标识,支持 Gateway
|
|
89
|
-
Pass memory user identifier to Gateway for memory management
|
|
88
|
+
向 Gateway 传递记忆归属用户标识,支持 Gateway 侧记忆管理。
|
|
89
|
+
Pass memory user identifier to Gateway for memory management.
|
|
90
90
|
|
|
91
91
|
**技术细节 / Technical Details**:
|
|
92
92
|
- 在请求 Gateway 时,自动添加 `X-OpenClaw-Memory-User` header
|
|
93
93
|
Automatically add `X-OpenClaw-Memory-User` header when requesting Gateway
|
|
94
|
-
- Header
|
|
95
|
-
Header value is
|
|
96
|
-
- 支持记忆隔离和共享的灵活配置
|
|
97
|
-
Supports flexible configuration for memory isolation and sharing
|
|
94
|
+
- Header 值为发送消息的用户 ID,便于 Gateway 进行记忆归属管理
|
|
95
|
+
Header value is the user ID who sent the message, facilitating Gateway's memory ownership management
|
|
98
96
|
|
|
99
97
|
**影响范围 / Impact**:
|
|
100
|
-
|
|
101
|
-
Internal implementation improvement,
|
|
98
|
+
内部实现改进,支持 Gateway 侧更精细的记忆管理能力。
|
|
99
|
+
Internal implementation improvement, supporting Gateway-side fine-grained memory management capabilities.
|
|
102
100
|
|
|
103
|
-
## 📋
|
|
101
|
+
## 📋 配置变更 / Configuration Changes
|
|
104
102
|
|
|
105
103
|
### 新增配置项 / New Configuration Options
|
|
106
104
|
|
|
107
105
|
| 配置项 | 类型 | 默认值 | 说明 |
|
|
108
106
|
|--------|------|--------|------|
|
|
109
107
|
| `separateSessionByConversation` | `boolean` | `true` | 是否按单聊/群聊/群区分 session |
|
|
110
|
-
| `sharedMemoryAcrossConversations` | `boolean` | `false` |
|
|
108
|
+
| `sharedMemoryAcrossConversations` | `boolean` | `false` | 是否在不同会话间共享记忆 |
|
|
111
109
|
|
|
112
110
|
### 配置示例 / Configuration Example
|
|
113
111
|
|
|
@@ -118,10 +116,8 @@ Internal implementation improvement, enhances Gateway's memory management capabi
|
|
|
118
116
|
"enabled": true,
|
|
119
117
|
"clientId": "dingxxxxxxxxx",
|
|
120
118
|
"clientSecret": "your_secret_here",
|
|
121
|
-
//
|
|
122
|
-
"
|
|
123
|
-
// 记忆管理配置
|
|
124
|
-
"sharedMemoryAcrossConversations": false // 不同会话间记忆隔离
|
|
119
|
+
"separateSessionByConversation": true, // 按会话区分 Session
|
|
120
|
+
"sharedMemoryAcrossConversations": false // 记忆隔离(默认)
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
123
|
}
|
|
@@ -144,54 +140,42 @@ openclaw plugins install https://github.com/DingTalk-Real-AI/dingtalk-openclaw-c
|
|
|
144
140
|
|
|
145
141
|
### 兼容性说明 / Compatibility Notes
|
|
146
142
|
|
|
147
|
-
-
|
|
143
|
+
- **向下兼容**:本次更新完全向下兼容,现有配置无需修改即可正常工作
|
|
148
144
|
**Backward Compatible**: This update is fully backward compatible, existing configurations work without modification
|
|
149
|
-
- **默认行为变更**:默认启用 `separateSessionByConversation
|
|
150
|
-
**Default Behavior Change**: `separateSessionByConversation
|
|
151
|
-
-
|
|
152
|
-
**
|
|
145
|
+
- **默认行为变更**:默认启用 `separateSessionByConversation`,会话将按单聊/群聊/群区分
|
|
146
|
+
**Default Behavior Change**: `separateSessionByConversation` is enabled by default, sessions will be separated by direct/group/different groups
|
|
147
|
+
- **如需旧行为**:如需保持按用户维度维护 session 的旧行为,可设置 `separateSessionByConversation: false`
|
|
148
|
+
**For Old Behavior**: To maintain old behavior of session per user, set `separateSessionByConversation: false`
|
|
153
149
|
|
|
154
150
|
### 迁移指南 / Migration Guide
|
|
155
151
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
```json5
|
|
160
|
-
{
|
|
161
|
-
"channels": {
|
|
162
|
-
"dingtalk-connector": {
|
|
163
|
-
"separateSessionByConversation": false
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### 行为对比 / Behavior Comparison
|
|
170
|
-
|
|
171
|
-
| 配置 | 会话隔离策略 | 适用场景 |
|
|
172
|
-
|------|-------------|---------|
|
|
173
|
-
| `separateSessionByConversation: true`(默认) | 按单聊/群聊/群区分 | 多群服务、私聊与群聊分离 |
|
|
174
|
-
| `separateSessionByConversation: false` | 按用户维度维护 | 兼容旧行为,统一用户会话 |
|
|
152
|
+
升级到此版本后:
|
|
153
|
+
After upgrading to this version:
|
|
175
154
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
155
|
+
1. **默认启用会话隔离**:无需任何配置,会话将自动按单聊/群聊/群区分
|
|
156
|
+
**Session isolation enabled by default**: No configuration needed, sessions will automatically be separated by direct/group/different groups
|
|
157
|
+
2. **检查会话行为**:确认新的会话隔离行为是否符合预期
|
|
158
|
+
**Check session behavior**: Verify that the new session isolation behavior meets expectations
|
|
159
|
+
3. **配置记忆共享**:如需跨会话共享记忆,可设置 `sharedMemoryAcrossConversations: true`
|
|
160
|
+
**Configure memory sharing**: To share memory across sessions, set `sharedMemoryAcrossConversations: true`
|
|
161
|
+
4. **恢复旧行为**:如需恢复按用户维度维护 session 的旧行为,设置 `separateSessionByConversation: false`
|
|
162
|
+
**Restore old behavior**: To restore old behavior of session per user, set `separateSessionByConversation: false`
|
|
180
163
|
|
|
181
164
|
## 📋 技术细节 / Technical Details
|
|
182
165
|
|
|
183
166
|
### 内部实现变更 / Internal Implementation Changes
|
|
184
167
|
|
|
185
168
|
**变更前 / Before**:
|
|
186
|
-
- Session key
|
|
187
|
-
-
|
|
188
|
-
-
|
|
169
|
+
- Session key 使用用户 ID:`{userId}`
|
|
170
|
+
- 所有会话共享同一个 Session,不区分单聊/群聊
|
|
171
|
+
- 记忆在所有会话间共享
|
|
189
172
|
|
|
190
173
|
**变更后 / After**:
|
|
191
|
-
- Session key
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
174
|
+
- Session key 支持格式:
|
|
175
|
+
- 单聊:`direct:{userId}`
|
|
176
|
+
- 群聊:`group:{conversationId}`
|
|
177
|
+
- 默认按单聊/群聊/群区分 Session
|
|
178
|
+
- 默认记忆隔离,可通过配置共享
|
|
195
179
|
|
|
196
180
|
### 相关代码位置 / Related Code Locations
|
|
197
181
|
|
|
@@ -199,10 +183,10 @@ If you want to maintain old behavior (user-level sessions, no distinction betwee
|
|
|
199
183
|
- `plugin.ts` - 核心逻辑修改
|
|
200
184
|
|
|
201
185
|
关键变更点:
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
-
|
|
205
|
-
-
|
|
186
|
+
- Session key 生成逻辑
|
|
187
|
+
- `streamFromGateway` 函数中的 Session 处理
|
|
188
|
+
- 记忆用户标识传递
|
|
189
|
+
- 配置项解析和验证
|
|
206
190
|
|
|
207
191
|
## 🔗 相关链接 / Related Links
|
|
208
192
|
|