Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots 📖

feat(settings): add voice narration provider and API key settings

Luis Ortizf198ec39aa98
diff --git a/src/core/guides/types.ts b/src/core/guides/types.ts
index 84d1711..8343194 100644
--- a/src/core/guides/types.ts
+++ b/src/core/guides/types.ts
@@ -1,3 +1,5 @@
+import type { VoiceProvider } from '@/core/capture/voice/transcribe';
+
export interface Guide {
id: string;
title: string;
@@ -43,6 +45,10 @@ export interface Settings {
aiApiKey: string;
aiProvider: 'openai' | 'anthropic';
aiModel: string;
+ voiceEnabled: boolean;
+ voiceProvider: VoiceProvider;
+ voiceApiKey: string;
+ voiceMicrophoneId: string;
}
export interface ElementMeta {
diff --git a/src/locales/en.yml b/src/locales/en.yml
index fc1fa67..efc7d6f 100644
--- a/src/locales/en.yml
+++ b/src/locales/en.yml
@@ -83,6 +83,9 @@ settings:
model: Model
apiKey: API Key
aiLanguage: Description Language
+ voiceNarration: Voice Narration
+ voiceDescription: Narrate out loud while you record and your words become the step descriptions.
+ voiceDataNotice: Your recorded audio is sent to the provider you choose above, using your own API key. This is the one part of Mimik that sends anything out of your browser.
saveSettings: Save Settings
saved: Saved
smartBlur: Smart Blur
diff --git a/src/locales/es.yml b/src/locales/es.yml
index 46fa5ca..4291d45 100644
--- a/src/locales/es.yml
+++ b/src/locales/es.yml
@@ -83,6 +83,9 @@ settings:
model: Modelo
apiKey: Clave API
aiLanguage: Idioma de descripciones
+ voiceNarration: "Narración por voz"
+ voiceDescription: "Narra en voz alta mientras grabas y tus palabras se convierten en las descripciones de los pasos."
+ voiceDataNotice: "El audio que grabes se envía al proveedor que elijas arriba, usando tu propia clave API. Es la única parte de Mimik que saca algo de tu navegador."
saveSettings: Guardar ajustes
saved: Guardado
smartBlur: Desenfoque inteligente
diff --git a/src/locales/fr.yml b/src/locales/fr.yml
index c3cf21e..84760b5 100644
--- a/src/locales/fr.yml
+++ b/src/locales/fr.yml
@@ -83,6 +83,9 @@ settings:
model: "Modèle"
apiKey: "Clé API"
aiLanguage: Langue des descriptions
+ voiceNarration: "Narration vocale"
+ voiceDescription: "Commentez à voix haute pendant l'enregistrement : vos mots deviennent les descriptions des étapes."
+ voiceDataNotice: "L'audio enregistré est envoyé au fournisseur choisi ci-dessus, avec votre propre clé API. C'est la seule partie de Mimik qui fait sortir quelque chose de votre navigateur."
saveSettings: "Enregistrer"
saved: "Enregistré"
smartBlur: Flou intelligent
diff --git a/src/locales/pt-BR.yml b/src/locales/pt-BR.yml
index a3c5a8f..128b480 100644
--- a/src/locales/pt-BR.yml
+++ b/src/locales/pt-BR.yml
@@ -83,6 +83,9 @@ settings:
model: Modelo
apiKey: Chave da API
aiLanguage: "Idioma das descrições"
+ voiceNarration: "Narração por voz"
+ voiceDescription: "Narre em voz alta enquanto grava e suas palavras viram as descrições dos passos."
+ voiceDataNotice: "O áudio gravado é enviado pro provedor que você escolher acima, usando sua própria chave API. É a única parte do Mimik que manda algo pra fora do seu navegador."
saveSettings: Salvar ajustes
saved: Salvo
smartBlur: Desfoque inteligente
diff --git a/src/ui/shared/SettingsView.tsx b/src/ui/shared/SettingsView.tsx
index 8312378..f0a26dd 100644
--- a/src/ui/shared/SettingsView.tsx
+++ b/src/ui/shared/SettingsView.tsx
@@ -1,9 +1,10 @@
-import { ArrowLeft, Bug, Check, ChevronRight, EyeOff, Globe, Shield, Sparkles, Star } from 'lucide-react';
+import { ArrowLeft, Bug, Check, ChevronRight, EyeOff, Globe, Mic, Shield, Sparkles, Star } from 'lucide-react';
import { useEffect, useState } from 'react';
import { i18n } from '#imports';
import { PRESET_LABELS, type PresetKey } from '@/core/blur/regexes';
import { AI_PROVIDERS, type AIProviderKey } from '@/core/capture/ai/models';
import { AI_LANGUAGES, type AILanguageCode } from '@/core/capture/ai/prompts';
+import type { VoiceProvider } from '@/core/capture/voice/transcribe';
import { localStorage } from '@/lib/browser-api';
import { Button } from '@/ui/components/ui/button';
import { Input } from '@/ui/components/ui/input';
@@ -18,6 +19,10 @@ export default function SettingsView({ onBack }: SettingsViewProps) {
const [apiKey, setApiKey] = useState('');
const [saved, setSaved] = useState(false);
const [aiLanguage, setAiLanguage] = useState<AILanguageCode>('en');
+ const [voiceEnabled, setVoiceEnabled] = useState(false);
+ const [voiceProvider, setVoiceProvider] = useState<VoiceProvider>('openai');
+ const [voiceApiKey, setVoiceApiKey] = useState('');
+ const [voiceMicrophoneId, setVoiceMicrophoneId] = useState('');
const [blurPresets, setBlurPresets] = useState<Record<PresetKey, boolean>>({
email: true,
phone: true,
@@ -28,14 +33,30 @@ export default function SettingsView({ onBack }: SettingsViewProps) {
});
useEffect(() => {
- localStorage.get(['aiApiKey', 'aiProvider', 'aiModel', 'aiLanguage', 'blurPresets']).then((result) => {
- const p = (result.aiProvider as AIProviderKey) || 'openai';
- setProvider(p);
- setModel((result.aiModel as string) || AI_PROVIDERS[p].defaultModel);
- if (result.aiApiKey) setApiKey(result.aiApiKey as string);
- if (result.aiLanguage) setAiLanguage(result.aiLanguage as AILanguageCode);
- if (result.blurPresets) setBlurPresets(result.blurPresets as Record<PresetKey, boolean>);
- });
+ localStorage
+ .get([
+ 'aiApiKey',
+ 'aiProvider',
+ 'aiModel',
+ 'aiLanguage',
+ 'blurPresets',
+ 'voiceEnabled',
+ 'voiceProvider',
+ 'voiceApiKey',
+ 'voiceMicrophoneId',
+ ])
+ .then((result) => {
+ const p = (result.aiProvider as AIProviderKey) || 'openai';
+ setProvider(p);
+ setModel((result.aiModel as string) || AI_PROVIDERS[p].defaultModel);
+ if (result.aiApiKey) setApiKey(result.aiApiKey as string);
+ if (result.aiLanguage) setAiLanguage(result.aiLanguage as AILanguageCode);
+ if (result.blurPresets) setBlurPresets(result.blurPresets as Record<PresetKey, boolean>);
+ setVoiceEnabled(result.voiceEnabled === true);
+ setVoiceProvider((result.voiceProvider as VoiceProvider) || 'openai');
+ if (result.voiceApiKey) setVoiceApiKey(result.voiceApiKey as string);
+ if (result.voiceMicrophoneId) setVoiceMicrophoneId(result.voiceMicrophoneId as string);
+ });
}, []);
const handleProviderChange = (newProvider: AIProviderKey) => {
@@ -44,7 +65,17 @@ export default function SettingsView({ onBack }: SettingsViewProps) {
};
const handleSave = async () => {
- await localStorage.set({ aiApiKey: apiKey, aiProvider: provider, aiModel: model, aiLanguage, blurPresets });
+ await localStorage.set({
+ aiApiKey: apiKey,
+ aiProvider: provider,
+ aiModel: model,
+ aiLanguage,
+ blurPresets,
+ voiceEnabled,
+ voiceProvider,
+ voiceApiKey,
+ voiceMicrophoneId,
+ });
setSaved(true);
setTimeout(() => setSaved(false), 2000);
};
@@ -139,6 +170,60 @@ export default function SettingsView({ onBack }: SettingsViewProps) {
</div>
</div>
+ <div className="border border-border rounded-[10px] p-3.5 space-y-3">
+ <div className="flex items-center justify-between gap-2.5">
+ <div className="flex items-center gap-2.5">
+ <div className="w-7 h-7 rounded-lg bg-secondary flex items-center justify-center">
+ <Mic size={14} className="text-accent" />
+ </div>
+ <span className="text-xs font-bold text-foreground">{i18n.t('settings.voiceNarration')}</span>
+ </div>
+ <button
+ onClick={() => setVoiceEnabled((prev) => !prev)}
+ className={`w-9 h-5 rounded-full transition-colors relative shrink-0 ${
+ voiceEnabled ? 'bg-accent' : 'bg-border'
+ }`}
+ >
+ <span
+ className={`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white shadow-sm transition-transform ${
+ voiceEnabled ? 'translate-x-4' : 'translate-x-0'
+ }`}
+ />
+ </button>
+ </div>
+
+ <p className="text-[10px] text-muted-foreground leading-relaxed">{i18n.t('settings.voiceDescription')}</p>
+
+ <div>
+ <label className="block text-[11px] font-semibold text-foreground mb-1">
+ {i18n.t('settings.provider')}
+ </label>
+ <select
+ value={voiceProvider}
+ onChange={(e) => setVoiceProvider(e.target.value as VoiceProvider)}
+ className="w-full border border-border rounded-lg px-3 py-2 text-[13px] text-foreground bg-card font-medium outline-none focus:border-ring focus:ring-2 focus:ring-ring/10"
+ >
+ <option value="openai">OpenAI</option>
+ <option value="groq">Groq</option>
+ </select>
+ </div>
+
+ <div>
+ <label className="block text-[11px] font-semibold text-foreground mb-1">{i18n.t('settings.apiKey')}</label>
+ <Input
+ type="password"
+ value={voiceApiKey}
+ onChange={(e) => setVoiceApiKey(e.target.value)}
+ placeholder={voiceProvider === 'groq' ? 'gsk_...' : 'sk-...'}
+ />
+ </div>
+
+ <div className="flex items-start gap-2 px-3 py-2.5 rounded-lg bg-secondary text-[10px] text-muted-foreground leading-relaxed">
+ <Shield size={12} className="shrink-0 mt-0.5 text-accent" />
+ <span>{i18n.t('settings.voiceDataNotice')}</span>
+ </div>
+ </div>
+
<div className="border border-border rounded-[10px] p-3.5 space-y-1">
<div className="flex items-center gap-2.5 mb-2">
<div className="w-7 h-7 rounded-lg bg-secondary flex items-center justify-center">