@dcrays/dcgchat-test 0.1.25 → 0.2.0
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/package.json +1 -1
- package/src/bot.ts +16 -0
- package/src/channel.ts +8 -0
- package/src/monitor.ts +4 -0
- package/src/tool.ts +11 -3
- package/src/types.ts +8 -0
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -89,6 +89,10 @@ export async function handleDcgchatMessage(params: {
|
|
|
89
89
|
// @ts-ignore
|
|
90
90
|
content: {
|
|
91
91
|
bot_token: msg.content.bot_token,
|
|
92
|
+
domain_id: msg.content.domain_id,
|
|
93
|
+
app_id: msg.content.app_id,
|
|
94
|
+
bot_id: msg.content.bot_id,
|
|
95
|
+
agent_id: msg.content.agent_id,
|
|
92
96
|
session_id: msg.content.session_id,
|
|
93
97
|
message_id: msg.content.message_id,
|
|
94
98
|
response: "[错误] 消息格式不正确",
|
|
@@ -182,6 +186,10 @@ export async function handleDcgchatMessage(params: {
|
|
|
182
186
|
source: "client",
|
|
183
187
|
content: {
|
|
184
188
|
bot_token: msg.content.bot_token,
|
|
189
|
+
domain_id: msg.content.domain_id,
|
|
190
|
+
app_id: msg.content.app_id,
|
|
191
|
+
bot_id: msg.content.bot_id,
|
|
192
|
+
agent_id: msg.content.agent_id,
|
|
185
193
|
session_id: msg.content.session_id,
|
|
186
194
|
message_id: msg.content.message_id,
|
|
187
195
|
response: t,
|
|
@@ -218,6 +226,10 @@ export async function handleDcgchatMessage(params: {
|
|
|
218
226
|
source: "client",
|
|
219
227
|
content: {
|
|
220
228
|
bot_token: msg.content.bot_token,
|
|
229
|
+
domain_id: msg.content.domain_id,
|
|
230
|
+
app_id: msg.content.app_id,
|
|
231
|
+
bot_id: msg.content.bot_id,
|
|
232
|
+
agent_id: msg.content.agent_id,
|
|
221
233
|
session_id: msg.content.session_id,
|
|
222
234
|
message_id: msg.content.message_id,
|
|
223
235
|
response: '',
|
|
@@ -238,6 +250,10 @@ export async function handleDcgchatMessage(params: {
|
|
|
238
250
|
source: "client",
|
|
239
251
|
content: {
|
|
240
252
|
bot_token: msg.content.bot_token,
|
|
253
|
+
domain_id: msg.content.domain_id,
|
|
254
|
+
app_id: msg.content.app_id,
|
|
255
|
+
bot_id: msg.content.bot_id,
|
|
256
|
+
agent_id: msg.content.agent_id,
|
|
241
257
|
session_id: msg.content.session_id,
|
|
242
258
|
message_id: msg.content.message_id,
|
|
243
259
|
response: `[错误] ${err instanceof Error ? err.message : String(err)}`,
|
package/src/channel.ts
CHANGED
|
@@ -153,6 +153,10 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
|
153
153
|
source: "client",
|
|
154
154
|
content: {
|
|
155
155
|
bot_token: botToken,
|
|
156
|
+
domain_id: params.domainId,
|
|
157
|
+
app_id: params.appId,
|
|
158
|
+
bot_id: params.botId,
|
|
159
|
+
agent_id: params.agentId,
|
|
156
160
|
response: ctx.text.replaceAll(
|
|
157
161
|
"/root/.openclaw/workspace/moBooksAgentGenerate",
|
|
158
162
|
"/upload"
|
|
@@ -188,6 +192,10 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
|
188
192
|
source: "client",
|
|
189
193
|
content: {
|
|
190
194
|
bot_token: botToken,
|
|
195
|
+
domain_id: params.domainId,
|
|
196
|
+
app_id: params.appId,
|
|
197
|
+
bot_id: params.botId,
|
|
198
|
+
agent_id: params.agentId,
|
|
191
199
|
response: ctx.text.replaceAll(
|
|
192
200
|
"/root/.openclaw/workspace/moBooksAgentGenerate",
|
|
193
201
|
"/upload"
|
package/src/monitor.ts
CHANGED
|
@@ -117,6 +117,10 @@ export async function monitorDcgchatProvider(opts: MonitorDcgchatOpts): Promise<
|
|
|
117
117
|
token: msg.content.bot_token,
|
|
118
118
|
sessionId: msg.content.session_id,
|
|
119
119
|
messageId: msg.content.message_id,
|
|
120
|
+
domainId: msg.content.domain_id,
|
|
121
|
+
appId: msg.content.app_id,
|
|
122
|
+
botId: msg.content.bot_id,
|
|
123
|
+
agentId: msg.content.agent_id,
|
|
120
124
|
});
|
|
121
125
|
await handleDcgchatMessage({
|
|
122
126
|
cfg,
|
package/src/tool.ts
CHANGED
|
@@ -5,9 +5,13 @@ import { logDcgchat } from "./log.js";
|
|
|
5
5
|
|
|
6
6
|
let msgParams = {} as {
|
|
7
7
|
userId: number;
|
|
8
|
-
token: string
|
|
9
|
-
sessionId: string
|
|
10
|
-
messageId: string
|
|
8
|
+
token: string;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
messageId: string;
|
|
11
|
+
domainId: string;
|
|
12
|
+
appId: string;
|
|
13
|
+
botId: string;
|
|
14
|
+
agentId: string;
|
|
11
15
|
}
|
|
12
16
|
let msgStatus: 'running' | 'finished' | '' = '';
|
|
13
17
|
export function setMsgParams(params: any) {
|
|
@@ -57,6 +61,10 @@ export function monitoringToolMessage(api: OpenClawPluginApi) {
|
|
|
57
61
|
source: "client",
|
|
58
62
|
content: {
|
|
59
63
|
bot_token: params?.token,
|
|
64
|
+
domain_id: params?.domainId,
|
|
65
|
+
app_id: params?.appId,
|
|
66
|
+
bot_id: params?.botId,
|
|
67
|
+
agent_id: params?.agentId,
|
|
60
68
|
response: text,
|
|
61
69
|
session_id:params?.sessionId,
|
|
62
70
|
message_id: params?.messageId || Date.now().toString()
|
package/src/types.ts
CHANGED
|
@@ -39,6 +39,10 @@ export type InboundMessage = {
|
|
|
39
39
|
// content: string;
|
|
40
40
|
content: {
|
|
41
41
|
bot_token: string;
|
|
42
|
+
domain_id?: string;
|
|
43
|
+
app_id?: string;
|
|
44
|
+
bot_id?: string;
|
|
45
|
+
agent_id?: string;
|
|
42
46
|
session_id: string;
|
|
43
47
|
message_id: string;
|
|
44
48
|
text: string;
|
|
@@ -71,6 +75,10 @@ export type OutboundReply = {
|
|
|
71
75
|
message_id: string; // ""
|
|
72
76
|
response: string; // ""
|
|
73
77
|
state: string; // final, chunk
|
|
78
|
+
domain_id?: string;
|
|
79
|
+
app_id?: string;
|
|
80
|
+
bot_id?: string;
|
|
81
|
+
agent_id?: string;
|
|
74
82
|
};
|
|
75
83
|
};
|
|
76
84
|
|