refactor(command): remove history command
This commit is contained in:
1 parent
efec4a608d
commit
c927808aff
30 files changed
+58
-278
No files matched your search
@@ -296,7 +296,7 @@ const COMMAND_ICONS: Record<string, LucideIcon> = {
|
||||
const BUILTIN_COMMAND_ICONS: Record<string, LucideIcon> = {
|
||||
"/new": NewChatIcon, "/compact": CompactIcon, "/stop": StopIcon,
|
||||
"/restart": RestartIcon, "/status": StatusIcon, "/model": ModelsIcon,
|
||||
"/history": HistoryIcon, "/goal": GoalIcon, "/trigger": TriggerIcon,
|
||||
"/goal": GoalIcon, "/trigger": TriggerIcon,
|
||||
"/dream": DreamIcon, "/dream-log": DreamLogIcon, "/dream-restore": RestoreMemoryIcon,
|
||||
"/dream-prompt": PromptTemplateIcon, "/evaluator-prompt": PromptTemplateIcon,
|
||||
"/skill": SkillsIcon, "/help": HelpIcon, "/pairing": PairingIcon,
|
||||
@@ -1007,8 +1007,6 @@ export function ThreadComposer({
|
||||
: t("thread.composer.slash.details.goalReady");
|
||||
} else if (command.command === "/stop" && isStreaming) {
|
||||
detail = t("thread.composer.slash.details.stopRunning");
|
||||
} else if (command.command === "/history") {
|
||||
detail = t("thread.composer.slash.details.history");
|
||||
}
|
||||
return {
|
||||
...command,
|
||||
|
||||
@@ -2215,7 +2215,6 @@
|
||||
"details": {
|
||||
"goalActive": "Goal is running",
|
||||
"goalReady": "Start a sustained objective",
|
||||
"history": "Show recent messages",
|
||||
"stopRunning": "Running now"
|
||||
},
|
||||
"commands": {
|
||||
@@ -2243,10 +2242,6 @@
|
||||
"title": "Model",
|
||||
"description": "View or switch the current model preset."
|
||||
},
|
||||
"history": {
|
||||
"title": "Chat history",
|
||||
"description": "Show the last N saved messages."
|
||||
},
|
||||
"dream": {
|
||||
"title": "Run Dream",
|
||||
"description": "Organize memory now."
|
||||
|
||||
@@ -2051,10 +2051,6 @@
|
||||
"title": "Modelo",
|
||||
"description": "Consulta o cambia el preajuste de modelo actual."
|
||||
},
|
||||
"history": {
|
||||
"title": "Historial del chat",
|
||||
"description": "Muestra los últimos N mensajes guardados."
|
||||
},
|
||||
"dream": {
|
||||
"title": "Ejecutar Dream",
|
||||
"description": "Organiza la memoria ahora."
|
||||
@@ -2095,7 +2091,6 @@
|
||||
"details": {
|
||||
"goalActive": "El objetivo está en curso",
|
||||
"goalReady": "Iniciar un objetivo sostenido",
|
||||
"history": "Mostrar mensajes recientes",
|
||||
"stopRunning": "En ejecución"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2051,10 +2051,6 @@
|
||||
"title": "Modèle",
|
||||
"description": "Consultez ou changez le préréglage de modèle actuel."
|
||||
},
|
||||
"history": {
|
||||
"title": "Historique de discussion",
|
||||
"description": "Affichez les N derniers messages enregistrés."
|
||||
},
|
||||
"dream": {
|
||||
"title": "Lancer Dream",
|
||||
"description": "Organisez la mémoire maintenant."
|
||||
@@ -2095,7 +2091,6 @@
|
||||
"details": {
|
||||
"goalActive": "L’objectif est en cours",
|
||||
"goalReady": "Démarrer un objectif durable",
|
||||
"history": "Afficher les messages récents",
|
||||
"stopRunning": "En cours"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2051,10 +2051,6 @@
|
||||
"title": "Model",
|
||||
"description": "Lihat atau ganti preset model saat ini."
|
||||
},
|
||||
"history": {
|
||||
"title": "Riwayat chat",
|
||||
"description": "Tampilkan N pesan terakhir yang tersimpan."
|
||||
},
|
||||
"dream": {
|
||||
"title": "Jalankan Dream",
|
||||
"description": "Atur memori sekarang."
|
||||
@@ -2095,7 +2091,6 @@
|
||||
"details": {
|
||||
"goalActive": "Tujuan sedang berjalan",
|
||||
"goalReady": "Mulai tujuan berkelanjutan",
|
||||
"history": "Tampilkan pesan terbaru",
|
||||
"stopRunning": "Sedang berjalan"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2051,10 +2051,6 @@
|
||||
"title": "モデル",
|
||||
"description": "現在のモデルプリセットを確認・切り替えます。"
|
||||
},
|
||||
"history": {
|
||||
"title": "会話の履歴",
|
||||
"description": "保存済みメッセージの直近 N 件を表示します。"
|
||||
},
|
||||
"dream": {
|
||||
"title": "Dream を実行",
|
||||
"description": "メモリーを今すぐ整理します。"
|
||||
@@ -2095,7 +2091,6 @@
|
||||
"details": {
|
||||
"goalActive": "目標が実行中",
|
||||
"goalReady": "継続的な目標を開始",
|
||||
"history": "最近のメッセージを表示",
|
||||
"stopRunning": "実行中"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2051,10 +2051,6 @@
|
||||
"title": "모델",
|
||||
"description": "현재 모델 프리셋을 확인하거나 전환합니다."
|
||||
},
|
||||
"history": {
|
||||
"title": "대화 기록",
|
||||
"description": "저장된 최근 N개 메시지를 표시합니다."
|
||||
},
|
||||
"dream": {
|
||||
"title": "Dream 실행",
|
||||
"description": "메모리를 지금 정리합니다."
|
||||
@@ -2095,7 +2091,6 @@
|
||||
"details": {
|
||||
"goalActive": "목표 실행 중",
|
||||
"goalReady": "지속 목표 시작",
|
||||
"history": "최근 메시지 보기",
|
||||
"stopRunning": "실행 중"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2035,7 +2035,6 @@
|
||||
"details": {
|
||||
"goalActive": "Objetivo em execução",
|
||||
"goalReady": "Iniciar um objetivo sustentado",
|
||||
"history": "Mostrar mensagens recentes",
|
||||
"stopRunning": "Executando agora"
|
||||
},
|
||||
"commands": {
|
||||
@@ -2063,10 +2062,6 @@
|
||||
"title": "Modelo",
|
||||
"description": "Veja ou troque o preset de modelo atual."
|
||||
},
|
||||
"history": {
|
||||
"title": "Histórico da conversa",
|
||||
"description": "Mostre as últimas N mensagens salvas."
|
||||
},
|
||||
"dream": {
|
||||
"title": "Executar Dream",
|
||||
"description": "Organize a memória agora."
|
||||
|
||||
@@ -2051,10 +2051,6 @@
|
||||
"title": "Mô hình",
|
||||
"description": "Xem hoặc đổi bộ thiết lập mô hình hiện tại."
|
||||
},
|
||||
"history": {
|
||||
"title": "Lịch sử trò chuyện",
|
||||
"description": "Hiện N tin nhắn đã lưu gần nhất."
|
||||
},
|
||||
"dream": {
|
||||
"title": "Chạy Dream",
|
||||
"description": "Sắp xếp bộ nhớ ngay."
|
||||
@@ -2095,7 +2091,6 @@
|
||||
"details": {
|
||||
"goalActive": "Mục tiêu đang chạy",
|
||||
"goalReady": "Bắt đầu mục tiêu duy trì",
|
||||
"history": "Hiển thị tin nhắn gần đây",
|
||||
"stopRunning": "Đang chạy"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2215,7 +2215,6 @@
|
||||
"details": {
|
||||
"goalActive": "目标正在运行",
|
||||
"goalReady": "开始一个持续目标",
|
||||
"history": "查看最近消息",
|
||||
"stopRunning": "正在运行"
|
||||
},
|
||||
"commands": {
|
||||
@@ -2243,10 +2242,6 @@
|
||||
"title": "模型",
|
||||
"description": "查看或切换当前模型预设"
|
||||
},
|
||||
"history": {
|
||||
"title": "对话记录",
|
||||
"description": "查看最近 N 条已保存的消息"
|
||||
},
|
||||
"dream": {
|
||||
"title": "运行 Dream",
|
||||
"description": "手动整理记忆"
|
||||
|
||||
@@ -2051,10 +2051,6 @@
|
||||
"title": "模型",
|
||||
"description": "檢視或切換當前模型預設"
|
||||
},
|
||||
"history": {
|
||||
"title": "對話記錄",
|
||||
"description": "檢視最近 N 條已儲存的訊息"
|
||||
},
|
||||
"dream": {
|
||||
"title": "執行 Dream",
|
||||
"description": "手動整理記憶"
|
||||
@@ -2095,7 +2091,6 @@
|
||||
"details": {
|
||||
"goalActive": "目標正在執行",
|
||||
"goalReady": "開始一個持續目標",
|
||||
"history": "檢視最近訊息",
|
||||
"stopRunning": "正在執行"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1399,9 +1399,9 @@ describe("webui API helpers", () => {
|
||||
accepts_args: false,
|
||||
},
|
||||
{
|
||||
command: "/history",
|
||||
title: "Show conversation history",
|
||||
description: "Print the last N messages.",
|
||||
command: "/inspect",
|
||||
title: "Inspect session",
|
||||
description: "Inspect a session.",
|
||||
icon: "history",
|
||||
arg_hint: "[n]",
|
||||
lifecycle: "side_channel",
|
||||
@@ -1437,9 +1437,9 @@ describe("webui API helpers", () => {
|
||||
acceptsArgs: false,
|
||||
},
|
||||
{
|
||||
command: "/history",
|
||||
title: "Show conversation history",
|
||||
description: "Print the last N messages.",
|
||||
command: "/inspect",
|
||||
title: "Inspect session",
|
||||
description: "Inspect a session.",
|
||||
icon: "history",
|
||||
argHint: "[n]",
|
||||
lifecycle: "side_channel",
|
||||
|
||||
@@ -28,7 +28,6 @@ const SLASH_COMMAND_KEYS = [
|
||||
"restart",
|
||||
"status",
|
||||
"model",
|
||||
"history",
|
||||
"dream",
|
||||
"dream_log",
|
||||
"dream_restore",
|
||||
@@ -629,7 +628,6 @@ describe("webui i18n", () => {
|
||||
expect(slash.badges.recent).toBeTruthy();
|
||||
expect(slash.details.goalActive).toBeTruthy();
|
||||
expect(slash.details.goalReady).toBeTruthy();
|
||||
expect(slash.details.history).toBeTruthy();
|
||||
expect(slash.details.stopRunning).toBeTruthy();
|
||||
for (const key of SLASH_COMMAND_KEYS) {
|
||||
const command = slash.commands[key as keyof typeof slash.commands];
|
||||
|
||||
@@ -50,9 +50,9 @@ const COMMANDS: SlashCommand[] = [
|
||||
acceptsArgs: false,
|
||||
},
|
||||
{
|
||||
command: "/history",
|
||||
title: "Show conversation history",
|
||||
description: "Print the last N persisted messages.",
|
||||
command: "/inspect",
|
||||
title: "Inspect session",
|
||||
description: "Inspect a session.",
|
||||
icon: "history",
|
||||
argHint: "[n]",
|
||||
lifecycle: "side_channel",
|
||||
@@ -490,13 +490,13 @@ describe("ThreadComposer", () => {
|
||||
|
||||
const input = screen.getByLabelText("Message input");
|
||||
fireEvent.change(input, { target: { value: "/" } });
|
||||
expect(screen.getByRole("option", { name: /\/history/i })).toHaveAttribute(
|
||||
expect(screen.getByRole("option", { name: /\/inspect/i })).toHaveAttribute(
|
||||
"aria-selected",
|
||||
"true",
|
||||
);
|
||||
fireEvent.keyDown(input, { key: "Enter" });
|
||||
|
||||
expect(input).toHaveValue("/history ");
|
||||
expect(input).toHaveValue("/inspect ");
|
||||
expect(onSend).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -1714,15 +1714,15 @@ describe("ThreadComposer", () => {
|
||||
expect(palette).toBeInTheDocument();
|
||||
expect(palette).toHaveStyle({ maxHeight: "288px" });
|
||||
expect(screen.queryByRole("option", { name: /\/stop/i })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("option", { name: /\/history/i })).toHaveAttribute(
|
||||
expect(screen.getByRole("option", { name: /\/inspect/i })).toHaveAttribute(
|
||||
"aria-selected",
|
||||
"true",
|
||||
);
|
||||
fireEvent.keyDown(input, { key: "Enter" });
|
||||
|
||||
expect(input).toHaveValue("/history ");
|
||||
expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/history");
|
||||
expect(input.previousElementSibling?.textContent).toBe("/history ");
|
||||
expect(input).toHaveValue("/inspect ");
|
||||
expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/inspect");
|
||||
expect(input.previousElementSibling?.textContent).toBe("/inspect ");
|
||||
expect(onSend).not.toHaveBeenCalled();
|
||||
expect(screen.queryByRole("listbox", { name: "Slash commands" })).not.toBeInTheDocument();
|
||||
});
|
||||
@@ -1807,7 +1807,7 @@ describe("ThreadComposer", () => {
|
||||
});
|
||||
|
||||
it("orders recent slash commands first for the blank slash menu", () => {
|
||||
window.localStorage.setItem("nanobot.webui.slashCommandRecents", JSON.stringify(["/history"]));
|
||||
window.localStorage.setItem("nanobot.webui.slashCommandRecents", JSON.stringify(["/inspect"]));
|
||||
render(
|
||||
<ThreadComposer
|
||||
onSend={vi.fn()}
|
||||
@@ -1820,7 +1820,7 @@ describe("ThreadComposer", () => {
|
||||
target: { value: "/" },
|
||||
});
|
||||
|
||||
expect(screen.getByRole("option", { name: /\/history/i })).toHaveAttribute(
|
||||
expect(screen.getByRole("option", { name: /\/inspect/i })).toHaveAttribute(
|
||||
"aria-selected",
|
||||
"true",
|
||||
);
|
||||
@@ -2419,12 +2419,12 @@ describe("ThreadComposer", () => {
|
||||
const onSend = vi.fn();
|
||||
render(<ThreadComposer onSend={onSend} slashCommands={COMMANDS} />);
|
||||
const input = screen.getByLabelText("Message input") as HTMLTextAreaElement;
|
||||
const text = "/history $workflow 中文 English";
|
||||
const text = "/inspect $workflow 中文 English";
|
||||
fireEvent.change(input, { target: { value: text, selectionStart: text.length } });
|
||||
|
||||
const command = screen.getByTestId("composer-slash-command");
|
||||
const skill = screen.getByTestId("composer-skill-reference-workflow");
|
||||
expect(command).toHaveTextContent("/history");
|
||||
expect(command).toHaveTextContent("/inspect");
|
||||
expect(command.className).toBe(skill.className);
|
||||
expect(command.getAttribute("style")).toBe(skill.getAttribute("style"));
|
||||
expect(input.previousElementSibling).toHaveAttribute("aria-hidden", "true");
|
||||
@@ -2433,15 +2433,15 @@ describe("ThreadComposer", () => {
|
||||
input.setSelectionRange(1, 4);
|
||||
const setData = vi.fn();
|
||||
fireEvent.copy(input, { clipboardData: { setData } });
|
||||
expect(setData).toHaveBeenCalledWith("text/plain", "his");
|
||||
expect(setData).toHaveBeenCalledWith("text/plain", "ins");
|
||||
fireEvent.cut(input, { clipboardData: { setData } });
|
||||
expect(input).toHaveValue("/tory $workflow 中文 English");
|
||||
expect(input).toHaveValue("/pect $workflow 中文 English");
|
||||
expect(screen.queryByTestId("composer-slash-command")).not.toBeInTheDocument();
|
||||
fireEvent.keyDown(input, { key: "z", ctrlKey: true });
|
||||
expect(input).toHaveValue(text);
|
||||
expect(input.selectionStart).toBe(1);
|
||||
expect(input.selectionEnd).toBe(4);
|
||||
expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/history");
|
||||
expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/inspect");
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
|
||||
expect(onSend).toHaveBeenCalledWith(text, undefined, { sideChannel: true });
|
||||
@@ -2495,14 +2495,14 @@ describe("ThreadComposer", () => {
|
||||
expect(onSend).toHaveBeenCalledWith(command.trim(), undefined, { sideChannel: true, userShell: true });
|
||||
});
|
||||
|
||||
it.each(["", "/history "])("mirrors inline references during composition without submitting the IME confirmation: %s", (prefix) => {
|
||||
it.each(["", "/inspect "])("mirrors inline references during composition without submitting the IME confirmation: %s", (prefix) => {
|
||||
const onSend = vi.fn();
|
||||
render(<ThreadComposer onSend={onSend} slashCommands={COMMANDS} />);
|
||||
const input = screen.getByLabelText("Message input") as HTMLTextAreaElement;
|
||||
fireEvent.change(input, { target: { value: `${prefix}$workflow ` } });
|
||||
fireEvent.compositionStart(input);
|
||||
fireEvent.change(input, { target: { value: `${prefix}$workflow zhong` } });
|
||||
if (prefix) expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/history");
|
||||
if (prefix) expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/inspect");
|
||||
expect(screen.getByTestId("composer-skill-reference-workflow")).toHaveTextContent(/^\$workflow$/);
|
||||
expect(input.previousElementSibling?.textContent).toBe(input.value);
|
||||
expect(input.previousElementSibling).toHaveClass("z-20");
|
||||
@@ -3237,10 +3237,10 @@ describe("ThreadComposer", () => {
|
||||
);
|
||||
|
||||
const input = screen.getByLabelText("Message input");
|
||||
fireEvent.change(input, { target: { value: "/history" } });
|
||||
fireEvent.change(input, { target: { value: "/inspect" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
|
||||
|
||||
expect(onSend).toHaveBeenCalledWith("/history", undefined, { sideChannel: true });
|
||||
expect(onSend).toHaveBeenCalledWith("/inspect", undefined, { sideChannel: true });
|
||||
});
|
||||
|
||||
it("does not infer side-channel behavior before command metadata loads", () => {
|
||||
@@ -3497,10 +3497,10 @@ describe("ThreadComposer", () => {
|
||||
it("does not mark side-channel commands as guidance during an active turn", () => {
|
||||
const onSend = vi.fn();
|
||||
render(<ThreadComposer onSend={onSend} onStop={vi.fn()} isStreaming slashCommands={COMMANDS} />);
|
||||
fireEvent.change(screen.getByLabelText("Message input"), { target: { value: "/history 5" } });
|
||||
fireEvent.change(screen.getByLabelText("Message input"), { target: { value: "/inspect 5" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
|
||||
|
||||
expect(onSend).toHaveBeenCalledWith("/history 5", undefined, { sideChannel: true });
|
||||
expect(onSend).toHaveBeenCalledWith("/inspect 5", undefined, { sideChannel: true });
|
||||
});
|
||||
|
||||
it("keeps Stop available while a draft attachment is encoding", () => {
|
||||
@@ -3574,7 +3574,7 @@ describe("ThreadComposer", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it.each(["/history 5", "/stop now", "/STOP@nanobot now"])(
|
||||
it.each(["/inspect 5", "/stop now", "/STOP@nanobot now"])(
|
||||
"sends registered command %s to the gateway without queuing it",
|
||||
(content) => {
|
||||
const onSend = vi.fn();
|
||||
|
||||
@@ -5478,9 +5478,9 @@ describe("ThreadShell", () => {
|
||||
return httpJson({
|
||||
commands: [
|
||||
{
|
||||
command: "/history",
|
||||
title: "Show conversation history",
|
||||
description: "Print the last N persisted messages.",
|
||||
command: "/inspect",
|
||||
title: "Inspect session",
|
||||
description: "Inspect a session.",
|
||||
icon: "history",
|
||||
arg_hint: "[n]",
|
||||
lifecycle: "side_channel",
|
||||
@@ -5520,7 +5520,7 @@ describe("ThreadShell", () => {
|
||||
});
|
||||
|
||||
expect(screen.getByRole("listbox", { name: "Slash commands" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("option", { name: /\/history/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole("option", { name: /\/inspect/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("surfaces a dismissible banner for an uncorrelated message_too_big error", async () => {
|
||||
|
||||
Reference in new issue
Block a user