Skip to content

Commit 0173a4d

Browse files
author
谁在吵着吃糖
committed
fix: resolve duplicate port generation in visualization config service
1 parent a77093c commit 0173a4d

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

apps/memos-local-openclaw/index.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,8 +2471,18 @@ Groups: ${groupNames.length > 0 ? groupNames.join(", ") : "(none)"}`,
24712471
// service.start() during normal startup if this is a fresh launch.
24722472
const SELF_START_DELAY_MS = 2000;
24732473
setTimeout(() => {
2474-
const isCliCommand = process.argv.some(arg => ["doctor", "plugins", "channels", "agents", "memory", "config", "tools", "setup", "onboard", "status", "logs", "wiki"].some(cmd => arg.includes(cmd)));
2475-
if (!serviceStarted && !isCliCommand) {
2474+
const args = process.argv.map(arg => String(arg || "").toLowerCase());
2475+
const gatewayIndex = args.lastIndexOf("gateway");
2476+
let shouldStart = false;
2477+
2478+
if (gatewayIndex !== -1) {
2479+
const nextArg = args[gatewayIndex + 1];
2480+
if (!nextArg || nextArg.startsWith("-") || nextArg === "start" || nextArg === "restart") {
2481+
shouldStart = true;
2482+
}
2483+
}
2484+
2485+
if (!serviceStarted && shouldStart) {
24762486
api.logger.info("memos-local: service.start() not called by host, self-starting viewer...");
24772487
startServiceCore().catch((err) => {
24782488
api.logger.warn(`memos-local: self-start failed: ${err}`);

0 commit comments

Comments
 (0)