palz-connector 1.6.7 → 1.6.8
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/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/bot.js +18 -11
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/bot.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - 通过 OpenClaw Runtime 的 dispatchReplyFromConfig 完成 AI 对话
|
|
10
10
|
* - Session 管理交由 OpenClaw Runtime(resolveAgentRoute)
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
12
|
+
import { networkInterfaces } from "node:os";
|
|
13
13
|
import { getPalzRuntime } from "./runtime.js";
|
|
14
14
|
import { resolvePalzAccount } from "./config.js";
|
|
15
15
|
import { tryClaimMessage } from "./dedup.js";
|
|
@@ -239,19 +239,26 @@ function buildKbIngestNoticeMessage(results) {
|
|
|
239
239
|
...lines,
|
|
240
240
|
].join("\n");
|
|
241
241
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
242
|
+
/**
|
|
243
|
+
* 解析回调 host:直接探测本 pod 的网卡 IP,让 kb engine 绕过 Service 直连本 pod。
|
|
244
|
+
* 取第一个非 internal 的 IPv4 地址,在 K8s pod 内即为 pod IP。
|
|
245
|
+
* 探测不到时兜底用 127.0.0.1。
|
|
246
|
+
*/
|
|
247
|
+
function resolveKbCallbackHost() {
|
|
248
|
+
const ifaces = networkInterfaces();
|
|
249
|
+
for (const addrs of Object.values(ifaces)) {
|
|
250
|
+
if (!addrs)
|
|
251
|
+
continue;
|
|
252
|
+
for (const addr of addrs) {
|
|
253
|
+
if (addr.family === "IPv4" && !addr.internal)
|
|
254
|
+
return addr.address;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return "127.0.0.1";
|
|
251
258
|
}
|
|
252
259
|
function resolveKbIngestCallbackUrl(config) {
|
|
253
260
|
if (typeof config.controlPort === "number" && config.controlPort > 0) {
|
|
254
|
-
const host =
|
|
261
|
+
const host = resolveKbCallbackHost();
|
|
255
262
|
return `http://${host}:${config.controlPort}/admin/kb-ingest/callback`;
|
|
256
263
|
}
|
|
257
264
|
return undefined;
|