fix(dictation): drop the under-input interim preview in chat

The live partial transcript was shown as a dimmed line under the chat textarea,
but each segment only flickers there for an instant before its final lands in
the draft — the preview was unreadable noise. Remove it: realtime partials are
no longer rendered separately; finalized segments are appended straight into the
draft (where the user actually reads them). Editor dictation (inline ghost at the
caret) is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
claude code agent 227
2026-06-21 20:47:45 +03:00
parent 85130da79f
commit c70dac79ad

View File

@@ -1,9 +1,8 @@
import { KeyboardEvent, useState } from "react";
import { KeyboardEvent } from "react";
import {
ActionIcon,
Group,
Stack,
Text,
Textarea,
Tooltip,
} from "@mantine/core";
@@ -48,16 +47,12 @@ export default function ChatInput({
const workspace = useAtomValue(workspaceAtom);
const isDictationEnabled = workspace?.settings?.ai?.dictation === true;
const isRealtime = workspace?.settings?.ai?.dictationRealtime === true;
// Live interim (partial) transcript shown as a dimmed tail under the input.
const [interim, setInterim] = useState("");
const send = (): void => {
const text = value.trim();
if (!text || isStreaming || disabled) return;
onSend(text);
setValue("");
// Drop any leftover partial when a message is sent.
setInterim("");
};
const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>): void => {
@@ -90,11 +85,11 @@ export default function ChatInput({
<RealtimeMicButton
size="lg"
disabled={isStreaming || disabled}
onInterim={(text) => setInterim(text)}
onFinal={(text) => {
setValue((v) => appendFinalToDraft(v, text));
setInterim("");
}}
// No separate interim preview in the chat: partials are not shown
// under the input (they only flicker before the final lands in the
// draft). Each finalized segment is appended straight into the draft.
onInterim={() => {}}
onFinal={(text) => setValue((v) => appendFinalToDraft(v, text))}
/>
) : (
<MicButton
@@ -129,11 +124,6 @@ export default function ChatInput({
</Tooltip>
)}
</Group>
{interim && (
<Text size="sm" c="dimmed">
{interim}
</Text>
)}
</Stack>
);
}