feat(dictation): gate streaming dictation behind a workspace toggle
Streaming (silence-cut) dictation was hardcoded on. Put it behind a per-workspace flag settings.ai.dictationStreaming, default off, with batch dictation as the default and fallback. Mirrors the existing settings.ai.dictation flag end to end: - server: aiDictationStreaming on UpdateWorkspaceDto + workspace.service writes settings.ai.dictationStreaming via updateAiSettings (jsonb merge keeps siblings) - client: IWorkspaceAiSettings.dictationStreaming, an optimistic "Streaming dictation" sub-toggle under "Voice dictation" (disabled when dictation is off) - gate the MicButton streaming prop in the editor toolbar and chat composer on the flag instead of a literal true When the flag is absent/false both call sites pass streaming=false, so the VAD model/wasm are never fetched and behavior is unchanged. Reuses the existing STT model and /ai-chat/transcribe — no new provider/model/endpoint fields. Removes the backlog entry now that it is implemented. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { FC, useRef } from "react";
|
||||
import type { Editor } from "@tiptap/react";
|
||||
import { useAtomValue } from "jotai";
|
||||
import { workspaceAtom } from "@/features/user/atoms/current-user-atom.ts";
|
||||
import { MicButton } from "@/features/dictation/components/mic-button";
|
||||
|
||||
interface Props {
|
||||
@@ -9,6 +11,11 @@ interface Props {
|
||||
}
|
||||
|
||||
export const DictationGroup: FC<Props> = ({ editor, color, iconSize }) => {
|
||||
// Streaming (silence-cut) dictation is opt-in per workspace; absent/false
|
||||
// keeps the stable batch path.
|
||||
const workspace = useAtomValue(workspaceAtom);
|
||||
const streamingDictation =
|
||||
workspace?.settings?.ai?.dictationStreaming === true;
|
||||
// Caret snapshot taken when dictation starts (where the first segment lands).
|
||||
const rangeRef = useRef<{ from: number; to: number } | null>(null);
|
||||
// Running insertion point: after each inserted segment we remember the caret
|
||||
@@ -70,7 +77,7 @@ export const DictationGroup: FC<Props> = ({ editor, color, iconSize }) => {
|
||||
return (
|
||||
<MicButton
|
||||
size="md"
|
||||
streaming
|
||||
streaming={streamingDictation}
|
||||
onStart={handleStart}
|
||||
onText={handleText}
|
||||
disabled={!editor.isEditable}
|
||||
|
||||
Reference in New Issue
Block a user