Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix(tui): 修复jiuwenswarm.md 过大后,告警字符过长报错

openJiuwen-bot8011940fec81
diff --git a/jiuwenswarm/channels/tui/frontend/src/ui/welcome.ts b/jiuwenswarm/channels/tui/frontend/src/ui/welcome.ts
index 5152d635dc..b8ce61651f 100644
--- a/jiuwenswarm/channels/tui/frontend/src/ui/welcome.ts
+++ b/jiuwenswarm/channels/tui/frontend/src/ui/welcome.ts
@@ -1,4 +1,4 @@
-import { visibleWidth } from "@mariozechner/pi-tui";
+import { visibleWidth, wrapTextWithAnsi } from "@mariozechner/pi-tui";
import type { ConnectionStatus } from "../core/ws-client.js";
import { padToWidth } from "./rendering/text.js";
import { chalk } from "./theme.js";
@@ -121,7 +121,10 @@ export function buildWelcomeLines(
centerLine(cmdBottom, width),
...(hint ? [centerLine(chalk.hex("#FFFFFF")(hint), width)] : []),
...(memoryWarnings.length > 0
- ? memoryWarnings.map((w) => centerLine(chalk.hex("#FFD700")(`Warning: ${w.message}`), width))
+ ? memoryWarnings.flatMap((w) => {
+ const msg = chalk.hex("#FFD700")(`Warning: ${w.message}`);
+ return wrapTextWithAnsi(msg, Math.max(1, width)).map((line) => padToWidth(line, width));
+ })
: []),
];
}
@@ -146,7 +149,10 @@ export function buildWelcomeLines(
padToWidth(chalk.hex("#FFFFFF")("└────────────────────────────────────────────────────────────┘"), width),
...(hint ? [padToWidth(chalk.hex("#FFFFFF")(hint), width)] : []),
...(memoryWarnings.length > 0
- ? memoryWarnings.map((w) => padToWidth(chalk.hex("#FFD700")(`Warning: ${w.message}`), width))
+ ? memoryWarnings.flatMap((w) => {
+ const msg = chalk.hex("#FFD700")(`Warning: ${w.message}`);
+ return wrapTextWithAnsi(msg, Math.max(1, width)).map((line) => padToWidth(line, width));
+ })
: []),
];
}