@dcrays/dcgchat-test 0.1.23 → 0.1.25

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcrays/dcgchat-test",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for 书灵墨宝 (WebSocket)",
6
6
  "main": "index.ts",
package/src/bot.ts CHANGED
@@ -170,7 +170,10 @@ export async function handleDcgchatMessage(params: {
170
170
  onReplyStart: async () => {},
171
171
  deliver: async (payload) => {
172
172
  log(`dcgchat[${accountId}][deliver]: received chunk, text length=${payload.text?.length || 0}`);
173
- const t = payload.text?.trim();
173
+ const t = payload.text?.trim().replaceAll(
174
+ "/root/.openclaw/workspace/moBooksAgentGenerate",
175
+ "/upload"
176
+ );
174
177
  if (t) {
175
178
  log(`dcgchat[${accountId}][deliver]: sending chunk to user ${msg._userId}, text="${t.slice(0, 50)}..."`);
176
179
  params.onChunk({
package/src/channel.ts CHANGED
@@ -8,8 +8,7 @@ import { logDcgchat } from "./log.js";
8
8
  import { getWsConnection } from "./connection.js";
9
9
  import { getMsgParams } from "./tool.js";
10
10
 
11
- const uploadRoot = resolve(os.homedir(), '../', "/works");
12
- logDcgchat.info(`uploadRoot: ${uploadRoot}`);
11
+ const uploadRoot = resolve('/', "upload");
13
12
 
14
13
  function isPathInside(parentPath: string, targetPath: string): boolean {
15
14
  const relativePath = relative(parentPath, targetPath);
@@ -86,11 +85,9 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
86
85
  // blockStreaming: true,
87
86
  },
88
87
  agentPrompt: {
89
- messageToolHints: () => {
90
- return [
91
- `- 如果有文件生成,直接将文件生成到${uploadRoot}文件夹下,并将文件发送给我`,
92
- ]
93
- },
88
+ messageToolHints: () => [
89
+ "- 如果有文件生成,直接将文件生成到根目录的/upload文件夹下,并将文件发送给我",
90
+ ],
94
91
  },
95
92
  reload: { configPrefixes: ["channels.dcgchat"] },
96
93
  configSchema: {
@@ -156,7 +153,10 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
156
153
  source: "client",
157
154
  content: {
158
155
  bot_token: botToken,
159
- response: ctx.text,
156
+ response: ctx.text.replaceAll(
157
+ "/root/.openclaw/workspace/moBooksAgentGenerate",
158
+ "/upload"
159
+ ),
160
160
  session_id: params.sessionId,
161
161
  message_id: params.messageId || Date.now().toString(),
162
162
  },
@@ -188,7 +188,10 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
188
188
  source: "client",
189
189
  content: {
190
190
  bot_token: botToken,
191
- response: ctx.text,
191
+ response: ctx.text.replaceAll(
192
+ "/root/.openclaw/workspace/moBooksAgentGenerate",
193
+ "/upload"
194
+ ),
192
195
  files: [{
193
196
  url: url,
194
197
  name: fileName,
package/src/tool.ts CHANGED
@@ -44,16 +44,20 @@ export function monitoringToolMessage(api: OpenClawPluginApi) {
44
44
  message_id: params?.messageId || Date.now().toString()
45
45
  },
46
46
  }));
47
+ const text = JSON.stringify({
48
+ type: 'tool_call',
49
+ ...event
50
+ }).replaceAll(
51
+ "/root/.openclaw/workspace/moBooksAgentGenerate",
52
+ "/upload"
53
+ );
47
54
  ws.send(JSON.stringify({
48
55
  messageType: "openclaw_bot_chat",
49
56
  _userId: params?.userId,
50
57
  source: "client",
51
58
  content: {
52
59
  bot_token: params?.token,
53
- response: JSON.stringify({
54
- type: 'tool_call',
55
- ...event
56
- }),
60
+ response: text,
57
61
  session_id:params?.sessionId,
58
62
  message_id: params?.messageId || Date.now().toString()
59
63
  },