@dcrays/dcgchat-test 0.2.4 → 0.2.6
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 +8 -4
- package/src/channel.ts +0 -5
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -24,7 +24,12 @@ async function resolveMediaFromUrls(files: { name: string, url: string }[], botT
|
|
|
24
24
|
for (let i = 0; i < files.length; i++) {
|
|
25
25
|
const file = files[i];
|
|
26
26
|
try {
|
|
27
|
-
|
|
27
|
+
let data = ''
|
|
28
|
+
if (/^https?:\/\//i.test(file.url)) {
|
|
29
|
+
data = file.url
|
|
30
|
+
} else {
|
|
31
|
+
data = await generateSignUrl(file.url, botToken);
|
|
32
|
+
}
|
|
28
33
|
log(`dcgchat media: [${i + 1}/${files.length}] generateSignUrl: ${data}`);
|
|
29
34
|
const response = await fetch(data);
|
|
30
35
|
if (!response.ok) {
|
|
@@ -99,10 +104,9 @@ export async function handleDcgchatMessage(params: {
|
|
|
99
104
|
|
|
100
105
|
const account = resolveAccount(cfg, accountId);
|
|
101
106
|
const userId = msg._userId.toString();
|
|
102
|
-
// const text = msg.text?.trim();
|
|
103
107
|
const text = msg.content.text?.trim();
|
|
104
108
|
|
|
105
|
-
if (!
|
|
109
|
+
if (!text ) {
|
|
106
110
|
params.onChunk({
|
|
107
111
|
messageType: "openclaw_bot_chat",
|
|
108
112
|
_userId: msg._userId,
|
|
@@ -116,7 +120,7 @@ export async function handleDcgchatMessage(params: {
|
|
|
116
120
|
agent_id: msg.content.agent_id,
|
|
117
121
|
session_id: msg.content.session_id,
|
|
118
122
|
message_id: msg.content.message_id,
|
|
119
|
-
response: "
|
|
123
|
+
response: "你需要我帮你做什么呢?",
|
|
120
124
|
},
|
|
121
125
|
});
|
|
122
126
|
return;
|
package/src/channel.ts
CHANGED
|
@@ -44,11 +44,6 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
|
44
44
|
effects: true,
|
|
45
45
|
// blockStreaming: true,
|
|
46
46
|
},
|
|
47
|
-
agentPrompt: {
|
|
48
|
-
messageToolHints: () => [
|
|
49
|
-
"- 如果有文件生成,直接将文件生成到根目录的/upload文件夹下,并将文件发送给我",
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
47
|
reload: { configPrefixes: ["channels.dcgchat"] },
|
|
53
48
|
configSchema: {
|
|
54
49
|
schema: {
|