@dcrays/dcgchat-test 0.1.14 → 0.1.15
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 +2 -2
- package/src/channel.ts +1 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcrays/dcgchat-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenClaw channel plugin for DCG Chat (WebSocket)",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"label": "DCG Chat",
|
|
34
34
|
"selectionLabel": "DCG Chat",
|
|
35
35
|
"docsPath": "/channels/dcgchat",
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
"docsLabel": "dcgchat",
|
|
38
38
|
"blurb": "连接 OpenClaw 与 DCG Chat 产品",
|
|
39
39
|
"order": 80
|
package/src/channel.ts
CHANGED
|
@@ -20,17 +20,14 @@ async function ensureMediaInUploadDir(url: string): Promise<string> {
|
|
|
20
20
|
if (!url || /^([a-z][a-z\d+\-.]*):\/\//i.test(url) || !isAbsolute(url)) {
|
|
21
21
|
return url;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
23
|
const sourcePath = resolve(url);
|
|
25
24
|
if (isPathInside(uploadRoot, sourcePath)) {
|
|
26
25
|
return sourcePath;
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
const fileName = basename(sourcePath);
|
|
30
28
|
if (!fileName) {
|
|
31
29
|
return sourcePath;
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
const targetPath = resolve(uploadRoot, fileName);
|
|
35
32
|
if (targetPath === sourcePath) {
|
|
36
33
|
return targetPath;
|
|
@@ -47,7 +44,6 @@ async function ensureMediaInUploadDir(url: string): Promise<string> {
|
|
|
47
44
|
await copyFile(sourcePath, targetPath);
|
|
48
45
|
await unlink(sourcePath);
|
|
49
46
|
}
|
|
50
|
-
|
|
51
47
|
return targetPath;
|
|
52
48
|
}
|
|
53
49
|
|
|
@@ -177,7 +173,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
|
177
173
|
const {botToken} = resolveAccount(ctx.cfg, ctx.accountId);
|
|
178
174
|
|
|
179
175
|
// try {
|
|
180
|
-
const url = ctx.mediaUrl;
|
|
176
|
+
const url = await ensureMediaInUploadDir(ctx.mediaUrl ?? '');
|
|
181
177
|
const fileName = url?.split(/[\\/]/).pop() || ''
|
|
182
178
|
const content = {
|
|
183
179
|
messageType: "openclaw_bot_chat",
|