feat: add OpenRouter dictation and speech recognition settings
This commit is contained in:
@@ -335,6 +335,7 @@ export function KeysSection({
|
||||
/** The paste editor for a freshly chosen Add-provider target. */
|
||||
const [adding, setAdding] = useState<ProviderKeyInfo | null>(null);
|
||||
const [addError, setAddError] = useState<string | null>(null);
|
||||
const followedProvider = useRef<string | null>(null);
|
||||
|
||||
// Escape folds any open editor (unfolded row or the Add-provider paste)
|
||||
// WITHOUT closing the dialog. Claimed at document CAPTURE phase — the
|
||||
@@ -372,7 +373,17 @@ export function KeysSection({
|
||||
// named row; a fresh mount seeds it via the useState initializer.
|
||||
useEffect(() => {
|
||||
if (initialRow !== undefined) setOpenRow(initialRow);
|
||||
followedProvider.current = null;
|
||||
}, [initialRow]);
|
||||
// A missing model-provider key has no table row yet. Deep-link into the
|
||||
// existing Add-provider editor instead (for example, OpenRouter STT setup).
|
||||
useEffect(() => {
|
||||
if (!initialRow || !statuses || !providers || followedProvider.current === initialRow) return;
|
||||
followedProvider.current = initialRow;
|
||||
if (statuses.some((status) => status.id === initialRow)) return;
|
||||
const provider = providers.find((provider) => provider.envVar === initialRow);
|
||||
if (provider) { setAdding(provider); setAddError(null); setOpenRow(null); }
|
||||
}, [initialRow, statuses, providers]);
|
||||
|
||||
async function saveKey(id: string, value: string): Promise<string | null> {
|
||||
const res = await fetch(`/api/keys/${id}`, {
|
||||
|
||||
Reference in New Issue
Block a user