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) Add quit altName to TUI slash command autocomplete suggestions Refs:#1557

haowenzhong113244bb87f17
diff --git a/jiuwenswarm/channels/tui/frontend/src/ui/app-screen.ts b/jiuwenswarm/channels/tui/frontend/src/ui/app-screen.ts
index f55bc8af61..bc02de4418 100644
--- a/jiuwenswarm/channels/tui/frontend/src/ui/app-screen.ts
+++ b/jiuwenswarm/channels/tui/frontend/src/ui/app-screen.ts
@@ -5294,11 +5294,13 @@ export class AppScreen implements Component, Focusable {
private buildSlashCommands(): TuiSlashCommand[] {
const hasAnyCompletion = (cmd: SlashCommand): boolean =>
!!cmd.completion || (cmd.subCommands?.some(hasAnyCompletion) ?? false);
- return this.commands.getAll().map((command) => ({
- name: command.name,
- description: command.description,
- getArgumentCompletions: hasAnyCompletion(command)
- ? async (argumentPrefix: string): Promise<AutocompleteItem[] | null> => {
+ const result: TuiSlashCommand[] = [];
+ for (const command of this.commands.getAll()) {
+ result.push({
+ name: command.name,
+ description: command.description,
+ getArgumentCompletions: hasAnyCompletion(command)
+ ? async (argumentPrefix: string): Promise<AutocompleteItem[] | null> => {
const trimmed = argumentPrefix.trim();
// Traverse subcommand chain to find the deepest command with completion
let currentCommand: typeof command = command;
@@ -5400,7 +5402,15 @@ export class AppScreen implements Component, Focusable {
return null;
}
: undefined,
- }));
+ });
+ for (const altName of command.altNames ?? []) {
+ result.push({
+ name: altName,
+ description: command.description,
+ });
+ }
+ }
+ return result;
}
private buildPendingQuestionLines(