@dcrays/dcgchat-test 0.4.22 → 0.4.24
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/channel.ts +2 -6
- package/src/cronToolCall.ts +2 -2
- package/src/tool.ts +2 -8
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -113,11 +113,7 @@ export async function sendDcgchatMedia(opts: DcgchatMediaSendOptions): Promise<v
|
|
|
113
113
|
sessionKey = resolveIsolatedCronSessionToJobSessionKey(sessionKey)
|
|
114
114
|
|
|
115
115
|
/** 定时自动执行未走 onRunCronJob,须与 finishedDcgchatCron 共用同一 messageId,否则附件与气泡错位 */
|
|
116
|
-
if (
|
|
117
|
-
!opts.messageId?.trim() &&
|
|
118
|
-
(fromIsolatedCron || fromDcgCronWrapper) &&
|
|
119
|
-
!getCronMessageId(sessionKey)
|
|
120
|
-
) {
|
|
116
|
+
if (!opts.messageId?.trim() && (fromIsolatedCron || fromDcgCronWrapper) && !getCronMessageId(sessionKey)) {
|
|
121
117
|
setCronMessageId(sessionKey, `${Date.now()}`)
|
|
122
118
|
}
|
|
123
119
|
|
|
@@ -152,7 +148,7 @@ export async function sendDcgchatMedia(opts: DcgchatMediaSendOptions): Promise<v
|
|
|
152
148
|
return
|
|
153
149
|
}
|
|
154
150
|
const fileName = mediaUrl?.split(/[\\/]/).pop() || ''
|
|
155
|
-
const notMessageId = `${msgCtx?.messageId}`?.length
|
|
151
|
+
const notMessageId = `${msgCtx?.messageId}`?.length === 13 || !msgCtx?.messageId
|
|
156
152
|
try {
|
|
157
153
|
const botToken = msgCtx.botToken ?? getOpenClawConfig()?.channels?.["dcgchat-test"]?.botToken ?? ''
|
|
158
154
|
const url = opts.mediaUrl ? await ossUpload(opts.mediaUrl, botToken, 1) : ''
|
package/src/cronToolCall.ts
CHANGED
|
@@ -137,7 +137,7 @@ function patchCronDeliveryInParams(
|
|
|
137
137
|
if (agentId) d.accountId = agentId
|
|
138
138
|
if (announceNoChannel) {
|
|
139
139
|
d.bestEffort = true
|
|
140
|
-
d.channel =
|
|
140
|
+
d.channel = 'dcgchat-test'
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -191,7 +191,7 @@ export function cronToolCall(event: { toolName: any; params: any; toolCallId: an
|
|
|
191
191
|
if (params.command.indexOf('cron create') > -1 || params.command.indexOf('cron add') > -1) {
|
|
192
192
|
const newParams = JSON.parse(JSON.stringify(params)) as Record<string, unknown>
|
|
193
193
|
newParams.command =
|
|
194
|
-
params.command.replace('--json', '') + ` --session-key ${sk} --channel ${
|
|
194
|
+
params.command.replace('--json', '') + ` --session-key ${sk} --channel ${'dcgchat-test'} --to dcg-cron:${sk} --json`
|
|
195
195
|
return { params: newParams }
|
|
196
196
|
} else {
|
|
197
197
|
return undefined
|
package/src/tool.ts
CHANGED
|
@@ -362,8 +362,7 @@ export function monitoringToolMessage(api: OpenClawPluginApi) {
|
|
|
362
362
|
const sk = resolveHookSessionKey(item.event, args ?? {})
|
|
363
363
|
if (sk) {
|
|
364
364
|
const toolHooksOk =
|
|
365
|
-
isSessionActiveForTool(sk) ||
|
|
366
|
-
(item.event === 'before_tool_call' && shouldRunBeforeToolCallWithoutRunningSession(event))
|
|
365
|
+
isSessionActiveForTool(sk) || (item.event === 'before_tool_call' && shouldRunBeforeToolCallWithoutRunningSession(event))
|
|
367
366
|
if (toolHooksOk) {
|
|
368
367
|
if (['after_tool_call', 'before_tool_call'].includes(item.event)) {
|
|
369
368
|
const { result: _result, ...rest } = event
|
|
@@ -378,12 +377,7 @@ export function monitoringToolMessage(api: OpenClawPluginApi) {
|
|
|
378
377
|
...rest,
|
|
379
378
|
status: 'running'
|
|
380
379
|
})
|
|
381
|
-
sendToolCallMessage(
|
|
382
|
-
sk,
|
|
383
|
-
text,
|
|
384
|
-
event.toolCallId || event.runId || Date.now().toString(),
|
|
385
|
-
0
|
|
386
|
-
)
|
|
380
|
+
sendToolCallMessage(sk, text, event.toolCallId || event.runId || Date.now().toString(), 0)
|
|
387
381
|
return hookResult
|
|
388
382
|
}
|
|
389
383
|
const text = JSON.stringify({
|