@xgjktech/xg_cwork_im 1.0.6 → 1.0.8
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 +23 -17
- package/package.json +1 -1
- package/src/channel.ts +313 -191
- package/src/connection.ts +11 -3
- package/src/group-history-tool.ts +34 -16
- package/src/resource-file.ts +253 -0
- package/src/send-group-message-tool.ts +98 -97
- package/src/send-service.ts +215 -68
- package/src/tool-json-result.ts +24 -0
- package/src/types.ts +287 -206
package/README.md
CHANGED
|
@@ -126,7 +126,7 @@ openclaw plugins enable xg_cwork_im
|
|
|
126
126
|
|
|
127
127
|
### 步骤 2:配置 Channel 账户信息
|
|
128
128
|
|
|
129
|
-
编辑 `~/.openclaw/openclaw.json
|
|
129
|
+
编辑 `~/.openclaw/openclaw.json`,添加以下配置(推荐 `accounts` 使用对象 map,key 即 `accountId`):
|
|
130
130
|
|
|
131
131
|
```json
|
|
132
132
|
{
|
|
@@ -134,15 +134,17 @@ openclaw plugins enable xg_cwork_im
|
|
|
134
134
|
"xg_cwork_im": {
|
|
135
135
|
"baseUrl": "https://cwork-web-test.xgjktech.com.cn",
|
|
136
136
|
"wsBaseUrl": "wss://cwork-web-test.xgjktech.com.cn",
|
|
137
|
-
"accounts":
|
|
138
|
-
{ "appKey": "你的机器人 appKey", "agentId": "main", "name": "个人助手" }
|
|
139
|
-
|
|
137
|
+
"accounts": {
|
|
138
|
+
"main": { "appKey": "你的机器人 appKey", "agentId": "main", "name": "个人助手" }
|
|
139
|
+
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
> **多账户**:如有多个机器人,在 `accounts`
|
|
145
|
+
> **多账户**:如有多个机器人,在 `accounts` 中继续追加即可(对象 map:key 为 `accountId`)。每个账户可指定不同的 `agentId` 对应不同的 OpenClaw Agent。
|
|
146
|
+
|
|
147
|
+
> **accounts.default(可选)**:OpenClaw 的 `doctor --fix` 可能会自动生成 `accounts.default`,用于存放默认项(例如 `groupPolicy` 等)。本插件会把 `accounts.default` 作为“默认覆盖”合并到每个真实账号上,但 **不会**把它当作一个需要启动连接的账号。
|
|
146
148
|
|
|
147
149
|
### 步骤 3:重启 Gateway
|
|
148
150
|
|
|
@@ -170,15 +172,19 @@ openclaw gateway restart
|
|
|
170
172
|
"wsBaseUrl": "wss://cwork-web-test.xgjktech.com.cn",
|
|
171
173
|
"groupPolicy": "mention",
|
|
172
174
|
"debug": false,
|
|
173
|
-
// 可选:首条 AI 回复超时时间(毫秒),默认
|
|
174
|
-
// 未配置时:
|
|
175
|
-
"firstReplyTimeoutMs":
|
|
176
|
-
"accounts":
|
|
177
|
-
{ "appKey": "appKey_机器人A", "agentId": "main", "name": "个人助手" },
|
|
178
|
-
{ "appKey": "appKey_机器人B", "agentId": "sales", "name": "销售助手" }
|
|
179
|
-
|
|
175
|
+
// 可选:首条 AI 回复超时时间(毫秒),默认 30 分钟
|
|
176
|
+
// 未配置时:30 * 60_000 = 1800000
|
|
177
|
+
"firstReplyTimeoutMs": 1800000,
|
|
178
|
+
"accounts": {
|
|
179
|
+
"main": { "appKey": "appKey_机器人A", "agentId": "main", "name": "个人助手" },
|
|
180
|
+
"sales": { "appKey": "appKey_机器人B", "agentId": "sales", "name": "销售助手" }
|
|
181
|
+
}
|
|
180
182
|
}
|
|
181
|
-
}
|
|
183
|
+
},
|
|
184
|
+
"bindings": [
|
|
185
|
+
{ "type": "route", "agentId": "main", "match": { "channel": "xg_cwork_im", "accountId": "main" } },
|
|
186
|
+
{ "type": "route", "agentId": "sales", "match": { "channel": "xg_cwork_im", "accountId": "sales" } }
|
|
187
|
+
]
|
|
182
188
|
}
|
|
183
189
|
```
|
|
184
190
|
|
|
@@ -196,9 +202,9 @@ openclaw gateway restart
|
|
|
196
202
|
"maxReconnectDelay": 120000,
|
|
197
203
|
// 生产环境可根据需要调整首回复超时时间(毫秒)
|
|
198
204
|
"firstReplyTimeoutMs": 300000,
|
|
199
|
-
"accounts":
|
|
200
|
-
{ "appKey": "你的生产 appKey", "agentId": "main", "name": "个人助手" }
|
|
201
|
-
|
|
205
|
+
"accounts": {
|
|
206
|
+
"main": { "appKey": "你的生产 appKey", "agentId": "main", "name": "个人助手" }
|
|
207
|
+
}
|
|
202
208
|
}
|
|
203
209
|
}
|
|
204
210
|
}
|
|
@@ -223,7 +229,7 @@ openclaw gateway restart
|
|
|
223
229
|
| `reconnectJitter` | number | `0.3` | 重连抖动因子(0-1) |
|
|
224
230
|
| `firstReplyTimeoutMs` | number | `300000` | **首条 AI 回复超时时间(毫秒)**。用于保护「思考中」占位消息:若在该时间窗口内 AI 没有任何回复,则自动将占位消息更新为「当前请求处理超时,请稍后重试」。|
|
|
225
231
|
|
|
226
|
-
### 账户配置(`accounts[n]`)
|
|
232
|
+
### 账户配置(`accounts.<accountId>` / `accounts[n]`)
|
|
227
233
|
|
|
228
234
|
| 选项 | 类型 | 默认值 | 说明 |
|
|
229
235
|
|---|---|---|---|
|