diff --git a/README.ja.md b/README.ja.md index af380ca4a..58c9dab65 100644 --- a/README.ja.md +++ b/README.ja.md @@ -58,6 +58,7 @@ ompweb --no-open # ブラウザ自動起動を無効 ## 主な機能 - **リアルタイムチャット**: ローカルの `omp` エージェントとストリーミング対話。 +- **キュー削除の確認**: キュー内のフォローアップやステアメッセージをパネルから削除する前に、内容を表示して確認します。OMP 内部ですでにキューに入ったメッセージの配信は取り消しません。 - **セッション管理**: プロジェクトごとに履歴を一覧表示、分岐やフォークにも対応。 - **ライブタスク&サブエージェント**: Todo リストと稼働中サブエージェントの進捗を折りたたみパネルでリアルタイム表示。 - **ファイル閲覧・プレビュー**: チャットと並べてファイルを閲覧、コード・Markdown・画像・音声・PDF をプレビュー。 diff --git a/README.md b/README.md index 40720b140..3224e5a83 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ password is stored there in plain text). ## Features - **Interactive Chat**: Real-time streaming conversation with your local `omp` agent — tool calls, thinking levels, token counts, cost, context gauge, queue controls, and interrupt & retry. +- **Queue Deletion Confirmation**: Preview and confirm before removing queued follow-ups or steered messages from the queue panel. This does not cancel delivery already queued inside OMP. - **Session Management**: Browse past conversations by project, fork sessions, branch within a session, archive/restore, import session files, and deep-link via URL. - **Live Plans & Subagents**: Collapsible panels pinned above the composer track live todo phases and running subagents (status, tool, retries, tokens/cost, nested tasks) with transcript dialogs and history recovery. - **Tool Preset Picker**: Choose the toolset for new sessions in the composer — `none` / `default` (`read,bash,edit,write`) / `full` (all tools including subagents). Persists to localStorage. diff --git a/README.zh-CN.md b/README.zh-CN.md index 70f787eba..1df95b61b 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -58,6 +58,7 @@ ompweb --no-open # 不自动打开浏览器 ## 功能特性 - **实时对话**:与本地 `omp` 智能体进行低延迟流式交互。 +- **队列删除确认**:从队列面板移除后续消息或引导消息前,先预览内容并确认。此操作不会取消 OMP 内部已排队消息的发送。 - **会话管理**:按项目浏览历史会话,支持会话分叉与分支回溯。 - **实时任务与子智能体**:可折叠面板实时展示任务清单(todo)与子智能体进度,并支持查看完整转录。 - **文件管理与预览**:与对话并排浏览文件,支持代码、Markdown、图片、音频及 PDF 预览。 diff --git a/components/ChatInput.tsx b/components/ChatInput.tsx index 0cf23a39c..361c1361a 100644 --- a/components/ChatInput.tsx +++ b/components/ChatInput.tsx @@ -6,6 +6,7 @@ import { getSubmitDuringRunBehavior } from "@/lib/composer-prefs"; import type { BuiltinSlashCommandResult, CompactResultInfo, QueuedMessages, SlashCommandInfo } from "@/hooks/useAgentSession"; import type { ActiveGoal, ActivePlan } from "@/lib/web-mode-state"; import { toast } from "@/components/ui/toast"; +import { ConfirmDialog } from "@/components/ui/field"; import { useDictation } from "@/hooks/useDictation"; import type { GenerationSpeedInfo, SessionStatsInfo } from "@/lib/pi-types"; import { formatCompactNumber, formatPercent } from "@/lib/format"; @@ -267,6 +268,11 @@ export const ChatInput = memo(forwardRef(function ChatIn [locale], ); const [value, setValue] = useState(() => (draftKey ? getDraft(draftKey)?.value ?? "" : "")); + const [queuedDeleteTarget, setQueuedDeleteTarget] = useState<{ + text: string; + draftKey: string | undefined; + queue: Props["queuedMessages"]; + } | null>(null); const [modelDropdownOpen, setModelDropdownOpen] = useState(false); const [thinkingDropdownOpen, setThinkingDropdownOpen] = useState(false); const [contextOpen, setContextOpen] = useState(false); @@ -596,6 +602,7 @@ export const ChatInput = memo(forwardRef(function ChatIn // validation banner along with the old draft. attachmentRevisionRef.current += 1; setAttachError(null); + setQueuedDeleteTarget(null); if (previousDraftKey) { setDraft(previousDraftKey, { @@ -1017,6 +1024,9 @@ export const ChatInput = memo(forwardRef(function ChatIn const queuedCount = queuedEntries.length; const [queueExpanded, setQueueExpanded] = useState(false); + // Invalidate confirmation if delivery or navigation changes the queue. + const activeDeleteTarget = queuedDeleteTarget?.draftKey === draftKey + && queuedDeleteTarget?.queue === queuedMessages ? queuedDeleteTarget : null; const handleItemEdit = useCallback((text: string) => { onRemoveQueuedMessage?.(text); @@ -1034,8 +1044,8 @@ export const ChatInput = memo(forwardRef(function ChatIn }, [onRemoveQueuedMessage]); const handleItemDelete = useCallback((text: string) => { - onRemoveQueuedMessage?.(text); - }, [onRemoveQueuedMessage]); + setQueuedDeleteTarget({ text, draftKey, queue: queuedMessages }); + }, [draftKey, queuedMessages]); const handleItemSteer = useCallback((entry: { kind: "follow-up" | "steer"; text: string }) => { if (entry.kind === "follow-up") { @@ -1440,6 +1450,27 @@ export const ChatInput = memo(forwardRef(function ChatIn padding: "0 16px calc(8px + env(safe-area-inset-bottom))", }} > + { if (!open) setQueuedDeleteTarget(null); }} + title={t("chatInput.queuedDeleteTitle")} + description={( + <> + {t("chatInput.queuedDeleteConfirmBody")} + + {activeDeleteTarget?.text} + + + )} + confirmLabel={t("chatInput.queuedDelete")} + cancelLabel={t("chatInput.cancel")} + danger + onConfirm={() => { + if (!activeDeleteTarget) return; + setQueuedDeleteTarget(null); + onRemoveQueuedMessage?.(activeDeleteTarget.text); + }} + /> {/* Hidden file input */}