@zlr_236/popo 0.0.10 → 0.0.11
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 +18 -11
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import type { ClawdbotConfig, RuntimeEnv } from "openclaw/plugin-sdk";
|
|
2
2
|
import {
|
|
3
3
|
buildPendingHistoryContextFromMap,
|
|
4
|
-
recordPendingHistoryEntryIfEnabled,
|
|
5
4
|
clearHistoryEntriesIfEnabled,
|
|
6
5
|
DEFAULT_GROUP_HISTORY_LIMIT,
|
|
7
6
|
type HistoryEntry,
|
|
8
7
|
} from "openclaw/plugin-sdk";
|
|
9
|
-
import { promises as fs } from "node:fs";
|
|
10
|
-
import { fileURLToPath } from "node:url";
|
|
11
|
-
import { dirname, join } from "node:path";
|
|
12
8
|
import type { PopoConfig, PopoMessageContext, PopoMediaInfo } from "./types.js";
|
|
9
|
+
import { promises as fs } from "node:fs";
|
|
10
|
+
import { join } from "node:path";
|
|
13
11
|
import { getPopoRuntime } from "./runtime.js";
|
|
14
12
|
import {
|
|
15
13
|
resolvePopoGroupConfig,
|
|
16
|
-
resolvePopoReplyPolicy,
|
|
17
14
|
resolvePopoAllowlistMatch,
|
|
18
15
|
isPopoGroupAllowed,
|
|
19
16
|
} from "./policy.js";
|
|
@@ -145,14 +142,24 @@ async function resolvePopoMediaList(params: {
|
|
|
145
142
|
maxBytes,
|
|
146
143
|
);
|
|
147
144
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
// --- 我添加的转存逻辑开始 ---
|
|
146
|
+
try {
|
|
147
|
+
const targetDir = "/home/node/.openclaw/file";
|
|
148
|
+
const originalName = fileInfo?.name || `file_${Date.now()}`;
|
|
149
|
+
const targetPath = join(targetDir, originalName);
|
|
150
|
+
|
|
151
|
+
// 确保目标目录存在
|
|
152
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
153
|
+
|
|
154
|
+
// 将保存好的 inbound 文件复制到目标路径,并恢复原始文件名
|
|
155
|
+
await fs.copyFile(saved.path, targetPath);
|
|
156
|
+
log?.(`popo: custom transfer success: ${saved.path} -> ${targetPath}`);
|
|
157
|
+
} catch (transferErr) {
|
|
158
|
+
log?.(`popo: custom transfer failed: ${String(transferErr)}`);
|
|
159
|
+
}
|
|
153
160
|
|
|
154
161
|
out.push({
|
|
155
|
-
path:
|
|
162
|
+
path: saved.path,
|
|
156
163
|
contentType: saved.contentType,
|
|
157
164
|
placeholder: inferPlaceholder(msgType),
|
|
158
165
|
});
|