Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

feat(transcription): explicit STT settings with provider, model, prompt (#5926)

boojack238f27dea149
diff --git a/docs/superpowers/plans/2026-05-02-transcription-settings.md b/docs/superpowers/plans/2026-05-02-transcription-settings.md
new file mode 100644
index 000000000..4899d0389
--- /dev/null
+++ b/docs/superpowers/plans/2026-05-02-transcription-settings.md
@@ -0,0 +1,1816 @@
+# Transcription (STT) Settings — Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Replace the implicit "first AI provider with an API key wins" transcription flow with an explicit, instance-level `TranscriptionConfig` that names a provider, model, default language, and prompt hint — enabling Whisper / Groq / self-hosted Whisper-compatible endpoints, restoring multi-provider flexibility, and exposing the Whisper API's `prompt` field for proper-noun spelling hints.
+
+**Architecture:** Schema-additive. Add `TranscriptionConfig` (provider_id, model, language, prompt) to both `proto/store/instance_setting.proto` and `proto/api/v1/instance_service.proto` under `InstanceAISetting` / `InstanceSetting.AISetting`. Server-side `Transcribe` resolves provider/model/language/prompt from the persisted config when not overridden in the request, falling through to the existing `DefaultTranscriptionModel` for the model. `UpdateInstanceSetting` validates `transcription.provider_id` references an existing provider and that the persisted config's strings respect length caps. Frontend splits the existing `AISection` into two groups — "AI Integrations" (existing providers list, renamed in copy) and "Transcription" (new four-field form: Provider / Model / Language / Prompt) — and the home `MemoEditor` reads `aiSetting.transcription` instead of scanning `providers`.
+
+**Tech Stack:** Backend Go 1.26, Connect RPC + protobuf via `buf` (remote plugins), `github.com/pkg/errors`, gRPC `status.Errorf`. Frontend React 18 + TypeScript 6, `@bufbuild/protobuf` v2, Connect-ES, Tailwind v4, Radix UI primitives via `@/components/ui/*`. Tests: Go `testing` + `testify/require`; frontend manual verification (no component tests in `Settings/`).
+
+**Spec:** `docs/superpowers/specs/2026-05-02-transcription-settings-design.md`
+
+**Branch note:** This work is intended for a fresh worktree off `main` (e.g. `feat/transcription-settings`). The spec was committed on `feat/calendar-date-prefill` because that branch was active at brainstorm time; before starting Task 1, create a new worktree:
+
+```bash
+git worktree add -b feat/transcription-settings ../memos-transcription main
+cd ../memos-transcription
+git cherry-pick <spec-commit-sha> # bring the spec doc onto the new branch
+```
+
+---
+
+## File map
+
+**Created**
+
+- (none — all changes are edits or generated)
+
+**Modified — protobuf source (changes regenerate Go + TS + OpenAPI via `buf generate`)**
+
+- `proto/store/instance_setting.proto` — add `TranscriptionConfig` message and `transcription` field on `InstanceAISetting`.
+- `proto/api/v1/instance_service.proto` — add parallel `TranscriptionConfig` message and `transcription` field inside the nested `AISetting` message.
+
+**Modified — backend Go**
+
+- `server/router/api/v1/instance_service.go` — extend `convertInstanceAISettingFromStore` / `convertInstanceAISettingToStore` to round-trip `transcription`; extend `prepareInstanceAISettingForUpdate` to validate `transcription.provider_id` exists in `providers[]` (when set) and length-cap `model` / `language` / `prompt`; preserve unchanged transcription fields when an `UpdateInstanceSetting` request omits them.
+- `server/router/api/v1/ai_service.go` — read `InstanceAISetting.transcription` at the start of `Transcribe`; resolve provider_id / model / language / prompt via "request override → persisted setting → engine default"; return `FailedPrecondition` when no provider can be resolved; remove the now-redundant `provider_id` REQUIRED gate (becomes optional in the proto).
+- `proto/api/v1/ai_service.proto` — relax `TranscribeRequest.provider_id` from REQUIRED to OPTIONAL.
+
+**Modified — backend tests**
+
+- `server/router/api/v1/test/ai_service_test.go` — add cases: persisted `transcription.provider_id` resolves when request omits it; persisted `transcription.model` overrides default; per-call `Config.prompt` wins over persisted prompt; `FailedPrecondition` when neither request nor setting names a provider.
+- `server/router/api/v1/test/instance_service_test.go` — add cases for the new validation: unknown `transcription.provider_id` rejected; oversized `model` / `language` / `prompt` rejected; existing transcription preserved when the field is omitted on update.
+
+**Modified — frontend**
+
+- `web/src/components/Settings/AISection.tsx` — restructure into two `SettingGroup` blocks: "AI Integrations" (existing provider table) and "Transcription" (new). Add `TranscriptionForm` component co-located in the same file or split if it grows past ~120 LOC. Wire local state, change tracking via `lodash-es/isEqual`, save to the same `InstanceSetting_Key.AI` setting.
+- `web/src/components/MemoEditor/index.tsx` — replace the `transcriptionProvider` lookup with a `canTranscribe` boolean derived from `aiSetting.transcription.providerId` plus the referenced provider's existence and `apiKeySet`.
+- `web/src/components/MemoEditor/services/transcriptionService.ts` — drop the `provider` parameter; call `transcribe()` with no `providerId` (server resolves from the setting).
+- `web/src/locales/en.json` — add new strings for the Transcription form. Other locale files are left for the maintainer's translation pass (consistent with how `byok-*` strings were originally added).
+
+---
+
+## Task 1: Add `TranscriptionConfig` to the store proto
+
+**Files:**
+- Modify: `proto/store/instance_setting.proto`
+
+The store-level `TranscriptionConfig` is the persistent shape written to disk. Field numbers are fresh (1–4); the new field on `InstanceAISetting` reuses the next slot (2).
+
+- [ ] **Step 1: Edit `proto/store/instance_setting.proto`**
+
+In the file, locate `message InstanceAISetting { ... }` (around lines 149–152) and replace it with the version below. Then append the new `TranscriptionConfig` message immediately after the existing `AIProviderConfig` block (after the `AIProviderType` enum at the bottom of the file).
+
+```proto
+message InstanceAISetting {
+ // providers is the list of AI provider configurations available instance-wide.
+ repeated AIProviderConfig providers = 1;
+
+ // transcription is the speech-to-text feature configuration.
+ // When unset or transcription.provider_id is empty, transcription is disabled.
+ TranscriptionConfig transcription = 2;
+}
+```
+
+After the existing `enum AIProviderType { ... }` block, append:
+
+```proto
+// TranscriptionConfig configures the speech-to-text feature.
+message TranscriptionConfig {
+ // provider_id references an entry in InstanceAISetting.providers[].id.
+ // Empty string means transcription is disabled.
+ string provider_id = 1;
+
+ // model is the provider-specific model identifier.
+ // Empty string falls back to the engine default
+ // (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers).
+ string model = 2;
+
+ // language is the default ISO 639-1 language hint sent to the provider.
+ // Empty string lets the provider auto-detect.
+ string language = 3;
+
+ // prompt is a default spelling/vocabulary hint passed to the provider.
+ // Used as the OpenAI Whisper "prompt" parameter and folded into the Gemini
+ // generation prompt as a "Context and spelling hints" block.
+ string prompt = 4;
+}
+```
+
+- [ ] **Step 2: Regenerate Go + TypeScript bindings**
+
+Run from the `proto/` directory:
+
+```bash
+cd proto && buf format -w && buf generate
+```
+
+Expected: command exits 0; files under `proto/gen/store/instance_setting.pb.go` and `web/src/types/proto/store/instance_setting_pb.ts` updated to include `TranscriptionConfig` and the new `Transcription` field.
+
+- [ ] **Step 3: Verify Go compiles**
+
+Run from repo root:
+
+```bash
+go build ./...
+```
+
+Expected: PASS. (Backend code does not yet reference the new field, so this just confirms the generation is well-formed.)
+
+- [ ] **Step 4: Commit**
+
+```bash
+git add proto/store/instance_setting.proto proto/gen/store/ web/src/types/proto/store/
+git commit -m "feat(proto/store): add TranscriptionConfig to InstanceAISetting
+
+Adds provider_id / model / language / prompt fields for the new
+explicit transcription configuration. Schema-additive (field 2 on
+InstanceAISetting); existing instances default to provider_id=\"\"
+which means transcription is disabled until the operator selects
+a provider in settings."
+```
+
+---
+
+## Task 2: Mirror `TranscriptionConfig` into the API proto
+
+**Files:**
+- Modify: `proto/api/v1/instance_service.proto`
+
+The API-level message mirrors the store version. They live in different proto packages (`memos.api.v1` vs `memos.store`), matching the existing parallel-message pattern (`User`, `Memo`, `AIProviderConfig`, etc.).
+
+- [ ] **Step 1: Edit `proto/api/v1/instance_service.proto`**
+
+Locate the nested `message AISetting { ... }` block (around lines 226–230) and replace it with:
+
+```proto
+ // AI provider configuration settings.
+ message AISetting {
+ // providers is the list of AI provider configurations available instance-wide.
+ repeated AIProviderConfig providers = 1;
+
+ // transcription is the speech-to-text feature configuration.
+ // When unset or transcription.provider_id is empty, transcription is disabled.
+ TranscriptionConfig transcription = 2;
+ }
+```
+
+Immediately after the existing `enum AIProviderType { ... }` block (currently the last child of `InstanceSetting`, around lines 247–251), append the new nested message — keep the indentation: it lives inside `message InstanceSetting { ... }`:
+
+```proto
+ // TranscriptionConfig configures the speech-to-text feature.
+ message TranscriptionConfig {
+ // provider_id references an entry in AISetting.providers[].id.
+ // Empty string means transcription is disabled.
+ string provider_id = 1;
+
+ // model is the provider-specific model identifier.
+ // Empty string falls back to the engine default
+ // (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers).
+ string model = 2;
+
+ // language is the default ISO 639-1 language hint sent to the provider.
+ // Empty string lets the provider auto-detect.
+ string language = 3;
+
+ // prompt is a default spelling/vocabulary hint passed to the provider.
+ string prompt = 4;
+ }
+```
+
+- [ ] **Step 2: Regenerate**
+
+```bash
+cd proto && buf format -w && buf generate
+```
+
+Expected: PASS. Updates `proto/gen/api/v1/instance_service.pb.go`, `proto/gen/openapi.yaml`, and `web/src/types/proto/api/v1/instance_service_pb.ts`.
+
+- [ ] **Step 3: Verify Go still compiles**
+
+```bash
+go build ./...
+```
+
+Expected: PASS. Existing `convertInstanceAISetting*` functions still compile because the new field defaults to nil/zero on round-trip.
+
+- [ ] **Step 4: Commit**
+
+```bash
+git add proto/api/v1/instance_service.proto proto/gen/ web/src/types/proto/api/
+git commit -m "feat(proto/api): add TranscriptionConfig to AISetting
+
+Mirrors the store-level TranscriptionConfig. Both messages live in
+their own packages (memos.api.v1 vs memos.store) following the
+existing parallel-message pattern used for AIProviderConfig."
+```
+
+---
+
+## Task 3: Round-trip `transcription` through `convertInstanceAISetting{From,To}Store`
+
+**Files:**
+- Modify: `server/router/api/v1/instance_service.go:505-551`
+
+The existing converters drop unknown fields silently because they only copy named fields. Without explicit handling, `transcription` would be lost on every round-trip. This task is purely plumbing — no validation yet.
+
+- [ ] **Step 1: Edit `convertInstanceAISettingFromStore`**
+
+Replace the function body (currently lines 505–528) so the returned `aiSetting` carries the new field:
+
+```go
+func convertInstanceAISettingFromStore(setting *storepb.InstanceAISetting) *v1pb.InstanceSetting_AISetting {
+ if setting == nil {
+ return nil
+ }
+
+ aiSetting := &v1pb.InstanceSetting_AISetting{
+ Providers: make([]*v1pb.InstanceSetting_AIProviderConfig, 0, len(setting.Providers)),
+ Transcription: convertTranscriptionConfigFromStore(setting.GetTranscription()),
+ }
+ for _, provider := range setting.Providers {
+ if provider == nil {
+ continue
+ }
+ apiKey := provider.GetApiKey()
+ aiSetting.Providers = append(aiSetting.Providers, &v1pb.InstanceSetting_AIProviderConfig{
+ Id: provider.GetId(),
+ Title: provider.GetTitle(),
+ Type: v1pb.InstanceSetting_AIProviderType(provider.GetType()),
+ Endpoint: provider.GetEndpoint(),
+ ApiKeySet: apiKey != "",
+ ApiKeyHint: maskAPIKey(apiKey),
+ })
+ }
+ return aiSetting
+}
+```
+
+- [ ] **Step 2: Edit `convertInstanceAISettingToStore`**
+
+Replace the function body (currently lines 530–551):
+
+```go
+func convertInstanceAISettingToStore(setting *v1pb.InstanceSetting_AISetting) *storepb.InstanceAISetting {
+ if setting == nil {
+ return nil
+ }
+
+ aiSetting := &storepb.InstanceAISetting{
+ Providers: make([]*storepb.AIProviderConfig, 0, len(setting.Providers)),
+ Transcription: convertTranscriptionConfigToStore(setting.GetTranscription()),
+ }
+ for _, provider := range setting.Providers {
+ if provider == nil {
+ continue
+ }
+ aiSetting.Providers = append(aiSetting.Providers, &storepb.AIProviderConfig{
+ Id: provider.GetId(),
+ Title: provider.GetTitle(),
+ Type: storepb.AIProviderType(provider.GetType()),
+ Endpoint: provider.GetEndpoint(),
+ ApiKey: provider.GetApiKey(),
+ })
+ }
+ return aiSetting
+}
+```
+
+- [ ] **Step 3: Add the two new converter helpers**
+
+Append immediately after `convertInstanceAISettingToStore`:
+
+```go
+func convertTranscriptionConfigFromStore(setting *storepb.TranscriptionConfig) *v1pb.InstanceSetting_TranscriptionConfig {
+ if setting == nil {
+ return nil
+ }
+ return &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: setting.GetProviderId(),
+ Model: setting.GetModel(),
+ Language: setting.GetLanguage(),
+ Prompt: setting.GetPrompt(),
+ }
+}
+
+func convertTranscriptionConfigToStore(setting *v1pb.InstanceSetting_TranscriptionConfig) *storepb.TranscriptionConfig {
+ if setting == nil {
+ return nil
+ }
+ return &storepb.TranscriptionConfig{
+ ProviderId: setting.GetProviderId(),
+ Model: setting.GetModel(),
+ Language: setting.GetLanguage(),
+ Prompt: setting.GetPrompt(),
+ }
+}
+```
+
+- [ ] **Step 4: Build**
+
+```bash
+go build ./...
+```
+
+Expected: PASS.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add server/router/api/v1/instance_service.go
+git commit -m "feat(api/instance): round-trip transcription through AI setting converters"
+```
+
+---
+
+## Task 4: Validate `transcription` in `prepareInstanceAISettingForUpdate`
+
+**Files:**
+- Modify: `server/router/api/v1/instance_service.go:564-623`
+
+The spec lists four validation rules: `provider_id` must reference an existing entry in `providers[]` (when set); length caps on `model` (256), `language` (32), `prompt` (4096). Plus the "preserve previous on omit" rule that mirrors how API keys are preserved when a request omits them.
+
+- [ ] **Step 1: Write the failing test for unknown provider_id**
+
+Open `server/router/api/v1/test/instance_service_test.go` and append a new sub-test inside the existing top-level `TestUpdateInstanceSetting`-equivalent function (the same one that currently contains "UpdateInstanceSetting - AI provider keys are write-only and preserved on empty" near line 670). Find the closing brace of that sub-test and insert before it:
+
+```go
+ t.Run("UpdateInstanceSetting - transcription provider_id must reference an existing provider", func(t *testing.T) {
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ hostUser, err := ts.CreateHostUser(ctx, "admin")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, hostUser.ID)
+
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{
+ Setting: &v1pb.InstanceSetting{
+ Name: "instance/settings/AI",
+ Value: &v1pb.InstanceSetting_AiSetting{
+ AiSetting: &v1pb.InstanceSetting_AISetting{
+ Providers: []*v1pb.InstanceSetting_AIProviderConfig{
+ {
+ Id: "openai-main",
+ Title: "OpenAI",
+ Type: v1pb.InstanceSetting_OPENAI,
+ ApiKey: "sk-test",
+ },
+ },
+ Transcription: &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: "does-not-exist",
+ },
+ },
+ },
+ },
+ })
+ require.Error(t, err)
+ require.Contains(t, err.Error(), "transcription provider_id")
+ })
+
+ t.Run("UpdateInstanceSetting - transcription strings are length-capped", func(t *testing.T) {
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ hostUser, err := ts.CreateHostUser(ctx, "admin")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, hostUser.ID)
+
+ base := &v1pb.InstanceSetting{
+ Name: "instance/settings/AI",
+ Value: &v1pb.InstanceSetting_AiSetting{
+ AiSetting: &v1pb.InstanceSetting_AISetting{
+ Providers: []*v1pb.InstanceSetting_AIProviderConfig{
+ {
+ Id: "openai-main",
+ Title: "OpenAI",
+ Type: v1pb.InstanceSetting_OPENAI,
+ ApiKey: "sk-test",
+ },
+ },
+ },
+ },
+ }
+
+ oversizedModel := strings.Repeat("a", 257)
+ base.GetAiSetting().Transcription = &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: "openai-main",
+ Model: oversizedModel,
+ }
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: base})
+ require.Error(t, err)
+ require.Contains(t, err.Error(), "transcription model")
+
+ oversizedLanguage := strings.Repeat("a", 33)
+ base.GetAiSetting().Transcription = &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: "openai-main",
+ Language: oversizedLanguage,
+ }
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: base})
+ require.Error(t, err)
+ require.Contains(t, err.Error(), "transcription language")
+
+ oversizedPrompt := strings.Repeat("a", 4097)
+ base.GetAiSetting().Transcription = &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: "openai-main",
+ Prompt: oversizedPrompt,
+ }
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: base})
+ require.Error(t, err)
+ require.Contains(t, err.Error(), "transcription prompt")
+ })
+
+ t.Run("UpdateInstanceSetting - transcription is preserved when omitted on update", func(t *testing.T) {
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ hostUser, err := ts.CreateHostUser(ctx, "admin")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, hostUser.ID)
+
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{
+ Setting: &v1pb.InstanceSetting{
+ Name: "instance/settings/AI",
+ Value: &v1pb.InstanceSetting_AiSetting{
+ AiSetting: &v1pb.InstanceSetting_AISetting{
+ Providers: []*v1pb.InstanceSetting_AIProviderConfig{
+ {
+ Id: "openai-main",
+ Title: "OpenAI",
+ Type: v1pb.InstanceSetting_OPENAI,
+ ApiKey: "sk-test",
+ },
+ },
+ Transcription: &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: "openai-main",
+ Model: "whisper-1",
+ Language: "en",
+ Prompt: "names: Alice",
+ },
+ },
+ },
+ },
+ })
+ require.NoError(t, err)
+
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{
+ Setting: &v1pb.InstanceSetting{
+ Name: "instance/settings/AI",
+ Value: &v1pb.InstanceSetting_AiSetting{
+ AiSetting: &v1pb.InstanceSetting_AISetting{
+ Providers: []*v1pb.InstanceSetting_AIProviderConfig{
+ {
+ Id: "openai-main",
+ Title: "OpenAI",
+ Type: v1pb.InstanceSetting_OPENAI,
+ ApiKey: "",
+ },
+ },
+ },
+ },
+ },
+ })
+ require.NoError(t, err)
+
+ stored, err := ts.Store.GetInstanceAISetting(ctx)
+ require.NoError(t, err)
+ require.NotNil(t, stored.GetTranscription())
+ require.Equal(t, "openai-main", stored.GetTranscription().GetProviderId())
+ require.Equal(t, "whisper-1", stored.GetTranscription().GetModel())
+ require.Equal(t, "en", stored.GetTranscription().GetLanguage())
+ require.Equal(t, "names: Alice", stored.GetTranscription().GetPrompt())
+ })
+```
+
+Confirm `strings` is already imported in this test file. If not, add `"strings"` to its import block.
+
+- [ ] **Step 2: Run the tests to verify they fail**
+
+```bash
+go test -run TestUpdateInstanceSetting -v ./server/router/api/v1/test/... 2>&1 | tail -40
+```
+
+Expected: the three new sub-tests FAIL because `prepareInstanceAISettingForUpdate` does not yet validate or preserve `transcription`.
+
+- [ ] **Step 3: Add validation + preservation to `prepareInstanceAISettingForUpdate`**
+
+Open `server/router/api/v1/instance_service.go`. Add these constants near the top of the file (or next to existing instance setting constants — search for any existing length cap constants and place these alongside):
+
+```go
+const (
+ maxTranscriptionConfigModelLength = 256
+ maxTranscriptionConfigLanguageLength = 32
+ maxTranscriptionConfigPromptLength = 4096
+)
+```
+
+Then, at the very end of the existing `prepareInstanceAISettingForUpdate` function (immediately before its closing `return nil`), insert:
+
+```go
+ if err := preparePersistedTranscriptionConfig(setting, existing); err != nil {
+ return err
+ }
+```
+
+And add this new function next to `prepareInstanceAISettingForUpdate`:
+
+```go
+func preparePersistedTranscriptionConfig(setting *storepb.InstanceAISetting, existing *storepb.InstanceAISetting) error {
+ // Preserve the previously stored transcription config when the request omits it,
+ // matching the same "absence == keep" semantics used for API keys.
+ if setting.Transcription == nil {
+ if existing != nil {
+ setting.Transcription = existing.GetTranscription()
+ }
+ return nil
+ }
+
+ cfg := setting.Transcription
+ cfg.ProviderId = strings.TrimSpace(cfg.ProviderId)
+ cfg.Model = strings.TrimSpace(cfg.Model)
+ cfg.Language = strings.TrimSpace(cfg.Language)
+ cfg.Prompt = strings.TrimSpace(cfg.Prompt)
+
+ if cfg.ProviderId != "" {
+ referenced := false
+ for _, provider := range setting.Providers {
+ if provider != nil && provider.Id == cfg.ProviderId {
+ referenced = true
+ break
+ }
+ }
+ if !referenced {
+ return errors.Errorf("transcription provider_id %q does not reference any configured provider", cfg.ProviderId)
+ }
+ }
+
+ if len(cfg.Model) > maxTranscriptionConfigModelLength {
+ return errors.Errorf("transcription model is too long; maximum length is %d characters", maxTranscriptionConfigModelLength)
+ }
+ if len(cfg.Language) > maxTranscriptionConfigLanguageLength {
+ return errors.Errorf("transcription language is too long; maximum length is %d characters", maxTranscriptionConfigLanguageLength)
+ }
+ if len(cfg.Prompt) > maxTranscriptionConfigPromptLength {
+ return errors.Errorf("transcription prompt is too long; maximum length is %d characters", maxTranscriptionConfigPromptLength)
+ }
+ return nil
+}
+```
+
+- [ ] **Step 4: Run the tests to verify they pass**
+
+```bash
+go test -run TestUpdateInstanceSetting -v ./server/router/api/v1/test/... 2>&1 | tail -40
+```
+
+Expected: PASS for all three new sub-tests plus all existing sub-tests.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add server/router/api/v1/instance_service.go server/router/api/v1/test/instance_service_test.go
+git commit -m "feat(api/instance): validate and preserve transcription config
+
+Validates transcription.provider_id references an existing provider
+and length-caps model (256), language (32), and prompt (4096). When
+an update omits transcription, the previously stored config is
+preserved — same semantics as the existing API-key preservation."
+```
+
+---
+
+## Task 5: Make `TranscribeRequest.provider_id` optional
+
+**Files:**
+- Modify: `proto/api/v1/ai_service.proto:24`
+
+The persisted setting becomes the source of truth; the request field is now an override for advanced callers.
+
+- [ ] **Step 1: Edit `proto/api/v1/ai_service.proto`**
+
+Change line 24 from:
+
+```proto
+ // Required. The instance AI provider ID to use.
+ string provider_id = 1 [(google.api.field_behavior) = REQUIRED];
+```
+
+to:
+
+```proto
+ // Optional. The instance AI provider ID to use. When empty, the server
+ // resolves the provider from InstanceAISetting.transcription.provider_id.
+ string provider_id = 1 [(google.api.field_behavior) = OPTIONAL];
+```
+
+- [ ] **Step 2: Regenerate**
+
+```bash
+cd proto && buf format -w && buf generate
+```
+
+Expected: PASS.
+
+- [ ] **Step 3: Build**
+
+```bash
+go build ./...
+```
+
+Expected: PASS. (The Connect/gRPC stub regenerates with the same Go field shape; field_behavior is metadata only.)
+
+- [ ] **Step 4: Commit**
+
+```bash
+git add proto/api/v1/ai_service.proto proto/gen/
+git commit -m "feat(proto/api): make TranscribeRequest.provider_id optional
+
+When omitted, the server resolves the provider from the persisted
+InstanceAISetting.transcription configuration."
+```
+
+---
+
+## Task 6: Resolve transcription config in the `Transcribe` RPC
+
+**Files:**
+- Modify: `server/router/api/v1/ai_service.go`
+
+The current implementation requires `provider_id` and uses `DefaultTranscriptionModel` for the model. The new flow: per-call request → persisted `transcription` → engine default. Per-call `Config.prompt` and `Config.language` already exist; they should now fall through to the persisted defaults when empty.
+
+- [ ] **Step 1: Write a failing test — persisted provider resolves when request omits provider_id**
+
+Open `server/router/api/v1/test/ai_service_test.go` and append, inside the existing `TestTranscribe` function (before the closing brace of the function — currently line 280), a new sub-test:
+
+```go
+ t.Run("resolves provider from persisted transcription setting when request omits provider_id", func(t *testing.T) {
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ user, err := ts.CreateRegularUser(ctx, "alice-fallthrough")
+ require.NoError(t, err)
+ userCtx := ts.CreateUserContext(ctx, user.ID)
+
+ openAIServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ require.NoError(t, r.ParseMultipartForm(10<<20))
+ require.Equal(t, "whisper-1", r.FormValue("model"))
+ require.Equal(t, "fr", r.FormValue("language"))
+ require.Equal(t, "names: Alice", r.FormValue("prompt"))
+ w.Header().Set("Content-Type", "application/json")
+ require.NoError(t, json.NewEncoder(w).Encode(map[string]string{"text": "ok"}))
+ }))
+ defer openAIServer.Close()
+
+ _, err = ts.Store.UpsertInstanceSetting(ctx, &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey_AI,
+ Value: &storepb.InstanceSetting_AiSetting{
+ AiSetting: &storepb.InstanceAISetting{
+ Providers: []*storepb.AIProviderConfig{
+ {
+ Id: "openai-main",
+ Title: "OpenAI",
+ Type: storepb.AIProviderType_OPENAI,
+ Endpoint: openAIServer.URL,
+ ApiKey: "sk-test",
+ },
+ },
+ Transcription: &storepb.TranscriptionConfig{
+ ProviderId: "openai-main",
+ Model: "whisper-1",
+ Language: "fr",
+ Prompt: "names: Alice",
+ },
+ },
+ },
+ })
+ require.NoError(t, err)
+
+ resp, err := ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{
+ Config: &v1pb.TranscriptionConfig{},
+ Audio: &v1pb.TranscriptionAudio{
+ Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")},
+ Filename: "voice.wav",
+ ContentType: "audio/wav",
+ },
+ })
+ require.NoError(t, err)
+ require.Equal(t, "ok", resp.Text)
+ })
+
+ t.Run("per-call config overrides persisted prompt and language", func(t *testing.T) {
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ user, err := ts.CreateRegularUser(ctx, "alice-override")
+ require.NoError(t, err)
+ userCtx := ts.CreateUserContext(ctx, user.ID)
+
+ openAIServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ require.NoError(t, r.ParseMultipartForm(10<<20))
+ require.Equal(t, "de", r.FormValue("language"))
+ require.Equal(t, "override prompt", r.FormValue("prompt"))
+ w.Header().Set("Content-Type", "application/json")
+ require.NoError(t, json.NewEncoder(w).Encode(map[string]string{"text": "ok"}))
+ }))
+ defer openAIServer.Close()
+
+ _, err = ts.Store.UpsertInstanceSetting(ctx, &storepb.InstanceSetting{
+ Key: storepb.InstanceSettingKey_AI,
+ Value: &storepb.InstanceSetting_AiSetting{
+ AiSetting: &storepb.InstanceAISetting{
+ Providers: []*storepb.AIProviderConfig{
+ {
+ Id: "openai-main",
+ Title: "OpenAI",
+ Type: storepb.AIProviderType_OPENAI,
+ Endpoint: openAIServer.URL,
+ ApiKey: "sk-test",
+ },
+ },
+ Transcription: &storepb.TranscriptionConfig{
+ ProviderId: "openai-main",
+ Language: "fr",
+ Prompt: "names: Alice",
+ },
+ },
+ },
+ })
+ require.NoError(t, err)
+
+ _, err = ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{
+ Config: &v1pb.TranscriptionConfig{
+ Language: "de",
+ Prompt: "override prompt",
+ },
+ Audio: &v1pb.TranscriptionAudio{
+ Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")},
+ Filename: "voice.wav",
+ ContentType: "audio/wav",
+ },
+ })
+ require.NoError(t, err)
+ })
+
+ t.Run("returns FailedPrecondition when no provider configured", func(t *testing.T) {
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ user, err := ts.CreateRegularUser(ctx, "alice-empty")
+ require.NoError(t, err)
+ userCtx := ts.CreateUserContext(ctx, user.ID)
+
+ _, err = ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{
+ Config: &v1pb.TranscriptionConfig{},
+ Audio: &v1pb.TranscriptionAudio{
+ Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")},
+ Filename: "voice.wav",
+ ContentType: "audio/wav",
+ },
+ })
+ require.Error(t, err)
+ require.Contains(t, err.Error(), "transcription is not configured")
+ })
+```
+
+- [ ] **Step 2: Run the tests to verify they fail**
+
+```bash
+go test -run TestTranscribe -v ./server/router/api/v1/test/... 2>&1 | tail -60
+```
+
+Expected: the three new sub-tests FAIL — "resolves provider from persisted setting" fails because the current code requires `request.ProviderId`; "per-call config overrides" fails because the current code does not read the persisted prompt/language at all (so the persisted-only case isn't tested but the override path doesn't merge); "returns FailedPrecondition" fails because the current error is `InvalidArgument: provider_id is required`.
+
+- [ ] **Step 3: Refactor `Transcribe` to resolve from the persisted setting**
+
+In `server/router/api/v1/ai_service.go`, replace the block from the start of the `Transcribe` method that validates `provider_id` and resolves the provider — currently lines 54–101 — with the version below. Keep the audio validation block (lines 68–91) intact: it stays AFTER the provider resolution because audio errors should still surface as `InvalidArgument` regardless of transcription config.
+
+Specifically, replace lines 54–101 with:
+
+```go
+ if request.Config == nil {
+ return nil, status.Errorf(codes.InvalidArgument, "config is required")
+ }
+ if request.Audio == nil {
+ return nil, status.Errorf(codes.InvalidArgument, "audio is required")
+ }
+ if request.Audio.GetUri() != "" {
+ return nil, status.Errorf(codes.InvalidArgument, "audio uri is not supported")
+ }
+ content := request.Audio.GetContent()
+ if len(content) == 0 {
+ return nil, status.Errorf(codes.InvalidArgument, "audio content is required")
+ }
+ if len(content) > maxTranscriptionAudioSizeBytes {
+ return nil, status.Errorf(codes.InvalidArgument, "audio file is too large; maximum size is 25 MiB")
+ }
+ filename := strings.TrimSpace(request.Audio.GetFilename())
+ if len(filename) > maxTranscriptionFilenameLength {
+ return nil, status.Errorf(codes.InvalidArgument, "filename is too long; maximum length is %d characters", maxTranscriptionFilenameLength)
+ }
+ contentType := strings.TrimSpace(request.Audio.GetContentType())
+ if contentType == "" {
+ contentType = http.DetectContentType(content)
+ }
+ if !isSupportedTranscriptionContentType(contentType) {
+ return nil, status.Errorf(codes.InvalidArgument, "audio content type %q is not supported", contentType)
+ }
+
+ aiSetting, err := s.Store.GetInstanceAISetting(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get AI setting: %v", err)
+ }
+ persisted := aiSetting.GetTranscription()
+
+ providerID := strings.TrimSpace(request.GetProviderId())
+ if providerID == "" {
+ providerID = persisted.GetProviderId()
+ }
+ if providerID == "" {
+ return nil, status.Errorf(codes.FailedPrecondition, "transcription is not configured")
+ }
+
+ provider, err := s.resolveAIProvider(aiSetting, providerID)
+ if err != nil {
+ return nil, err
+ }
+
+ model := strings.TrimSpace(request.GetConfig().GetModel())
+ if model == "" {
+ model = persisted.GetModel()
+ }
+ if model == "" {
+ defaultModel, err := ai.DefaultTranscriptionModel(provider.Type)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ model = defaultModel
+ }
+
+ prompt := strings.TrimSpace(request.GetConfig().GetPrompt())
+ if prompt == "" {
+ prompt = persisted.GetPrompt()
+ }
+ if len(prompt) > maxTranscriptionPromptLength {
+ return nil, status.Errorf(codes.InvalidArgument, "prompt is too long; maximum length is %d characters", maxTranscriptionPromptLength)
+ }
+
+ language := strings.TrimSpace(request.GetConfig().GetLanguage())
+ if language == "" {
+ language = persisted.GetLanguage()
+ }
+ if len(language) > maxTranscriptionLanguageLength {
+ return nil, status.Errorf(codes.InvalidArgument, "language is too long; maximum length is %d characters", maxTranscriptionLanguageLength)
+ }
+```
+
+Note: `request.GetConfig().GetModel()` requires that the API-level `TranscriptionConfig` actually have a `model` field. The current proto only has `prompt` and `language`. We don't add a model override field at this step — the `GetModel()` accessor will not exist. Remove the model-override line entirely so the precedence is **persisted setting → engine default**, with no per-call override:
+
+Replace the model resolution block above with this simpler version (which is the actual code to commit):
+
+```go
+ model := persisted.GetModel()
+ if model == "" {
+ defaultModel, err := ai.DefaultTranscriptionModel(provider.Type)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ model = defaultModel
+ }
+```
+
+Also delete the existing helper `resolveAIProviderForTranscription` (currently lines 119–142) and replace it with this slimmer one that takes a pre-fetched setting:
+
+```go
+func (s *APIV1Service) resolveAIProvider(setting *storepb.InstanceAISetting, providerID string) (ai.ProviderConfig, error) {
+ providers := make([]ai.ProviderConfig, 0, len(setting.GetProviders()))
+ for _, provider := range setting.GetProviders() {
+ if provider == nil {
+ continue
+ }
+ providers = append(providers, convertAIProviderConfigFromStore(provider))
+ }
+
+ provider, err := ai.FindProvider(providers, providerID)
+ if err != nil {
+ return ai.ProviderConfig{}, status.Errorf(codes.NotFound, "AI provider not found")
+ }
+ return *provider, nil
+}
+```
+
+The remainder of `Transcribe` (the call to `ai.NewTranscriber`, the `transcriber.Transcribe(...)` call, the response construction) is unchanged — `prompt`, `language`, `model`, `provider` are all already in scope.
+
+- [ ] **Step 4: Run the tests**
+
+```bash
+go test -run TestTranscribe -v ./server/router/api/v1/test/... 2>&1 | tail -60
+```
+
+Expected: PASS for all old sub-tests plus the three new ones.
+
+- [ ] **Step 5: Run the full backend suite**
+
+```bash
+go test -race ./server/... ./internal/...
+```
+
+Expected: PASS.
+
+- [ ] **Step 6: Commit**
+
+```bash
+git add server/router/api/v1/ai_service.go server/router/api/v1/test/ai_service_test.go
+git commit -m "feat(api/ai): resolve transcription from persisted setting
+
+Transcribe now resolves provider, model, language, and prompt with
+this precedence: per-call request → persisted transcription config
+→ engine default. provider_id may be omitted from the request when
+the operator has selected a provider in settings. Returns
+FailedPrecondition when no provider can be resolved."
+```
+
+---
+
+## Task 7: Frontend — restructure `AISection` into Integrations + Transcription
+
+**Files:**
+- Modify: `web/src/components/Settings/AISection.tsx`
+- Modify: `web/src/locales/en.json`
+
+The existing provider list stays as-is in a renamed group. A new `TranscriptionForm` group is added below it. Both groups share a single Save action that writes the entire `AISetting` (this matches the existing pattern — the protobuf save is already whole-message).
+
+- [ ] **Step 1: Add new locale keys**
+
+Open `web/src/locales/en.json`. Locate the `"ai": { ... }` block (starting around line 411). Inside that block, add the following keys (alphabetically sorted to match the file's convention; most fall between `keep-api-key` and `label`):
+
+```json
+ "integrations-description": "Provider keys are supplied by the instance owner and used by server-side AI features.",
+ "integrations-title": "AI integrations",
+ "transcription-description": "Speech-to-text settings used when recording audio in the memo composer.",
+ "transcription-empty-providers": "Add an AI integration first to enable transcription.",
+ "transcription-language-help": "ISO 639-1 short code (e.g. en, de, zh). Leave empty to auto-detect.",
+ "transcription-language-placeholder": "auto-detect",
+ "transcription-language": "Default language",
+ "transcription-model-help": "Free text. Use the provider's model identifier — e.g. whisper-1, gpt-4o-transcribe, whisper-large-v3-turbo.",
+ "transcription-model-placeholder-gemini": "gemini-2.5-flash",
+ "transcription-model-placeholder-openai": "whisper-1",
+ "transcription-model": "Model",
+ "transcription-no-provider": "None — transcription disabled",
+ "transcription-prompt-help": "Improves spelling of proper nouns and jargon. Whisper limit is roughly 224 tokens.",
+ "transcription-prompt-placeholder": "Names: Alice, Bob. Glossary: kubernetes, OAuth.",
+ "transcription-prompt": "Prompt hints",
+ "transcription-provider": "Provider",
+ "transcription-title": "Transcription",
+ "transcription-warning-gemini-webm": "Gemini does not accept browser-recorded audio/webm. For in-editor recording, use an OpenAI-compatible provider.",
+ "transcription-warning-no-key": "The selected provider has no API key set. Edit the integration above to add one.",
+```
+
+Also leave the existing `"providers": "Providers"` key — `AISection.tsx` no longer uses it, but other locale files reference it; we won't churn translations for an unused string.
+
+- [ ] **Step 2: Restructure `AISection.tsx`**
+
+Open `web/src/components/Settings/AISection.tsx`. The strategy: keep the existing provider table inside a new `SettingGroup` titled with `setting.ai.integrations-title`, and add a sibling `SettingGroup` for transcription. Reuse `useState`/`isEqual` change tracking, but for both providers and transcription combined.
+
+Replace the file contents with the structure below. (This is a full rewrite of the file; the dialog component is unchanged from the existing implementation and is included verbatim at the bottom.)
+
+```tsx
+import { create } from "@bufbuild/protobuf";
+import { isEqual } from "lodash-es";
+import { MoreVerticalIcon, PlusIcon } from "lucide-react";
+import { useEffect, useMemo, useState } from "react";
+import { toast } from "react-hot-toast";
+import ConfirmDialog from "@/components/ConfirmDialog";
+import { Button } from "@/components/ui/button";
+import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
+import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+import { Textarea } from "@/components/ui/textarea";
+import { useInstance } from "@/contexts/InstanceContext";
+import {
+ InstanceSetting_AIProviderConfig,
+ InstanceSetting_AIProviderConfigSchema,
+ InstanceSetting_AIProviderType,
+ InstanceSetting_AISettingSchema,
+ InstanceSetting_Key,
+ InstanceSetting_TranscriptionConfig,
+ InstanceSetting_TranscriptionConfigSchema,
+ InstanceSettingSchema,
+} from "@/types/proto/api/v1/instance_service_pb";
+import { useTranslate } from "@/utils/i18n";
+import SettingGroup from "./SettingGroup";
+import { SettingPanel } from "./SettingList";
+import SettingSection from "./SettingSection";
+import SettingTable from "./SettingTable";
+import useInstanceSettingUpdater, { buildInstanceSettingName } from "./useInstanceSettingUpdater";
+
+type LocalAIProvider = {
+ id: string;
+ title: string;
+ type: InstanceSetting_AIProviderType;
+ endpoint: string;
+ apiKey: string;
+ apiKeySet: boolean;
+ apiKeyHint: string;
+};
+
+type LocalTranscription = {
+ providerId: string;
+ model: string;
+ language: string;
+ prompt: string;
+};
+
+const providerTypeOptions = [InstanceSetting_AIProviderType.OPENAI, InstanceSetting_AIProviderType.GEMINI];
+
+const byokNotes = ["setting.ai.byok-key-note", "setting.ai.byok-storage-note", "setting.ai.byok-model-note"] as const;
+
+const createProviderID = () => {
+ if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
+ return crypto.randomUUID();
+ }
+ return `ai-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
+};
+
+const getProviderTypeLabel = (type: InstanceSetting_AIProviderType) => {
+ return InstanceSetting_AIProviderType[type] ?? "UNKNOWN";
+};
+
+const toLocalProvider = (provider: InstanceSetting_AIProviderConfig): LocalAIProvider => ({
+ id: provider.id,
+ title: provider.title,
+ type: provider.type,
+ endpoint: provider.endpoint,
+ apiKey: "",
+ apiKeySet: provider.apiKeySet,
+ apiKeyHint: provider.apiKeyHint,
+});
+
+const toLocalTranscription = (config: InstanceSetting_TranscriptionConfig | undefined): LocalTranscription => ({
+ providerId: config?.providerId ?? "",
+ model: config?.model ?? "",
+ language: config?.language ?? "",
+ prompt: config?.prompt ?? "",
+});
+
+const newProvider = (): LocalAIProvider => ({
+ id: createProviderID(),
+ title: "",
+ type: InstanceSetting_AIProviderType.OPENAI,
+ endpoint: "",
+ apiKey: "",
+ apiKeySet: false,
+ apiKeyHint: "",
+});
+
+const toProviderConfig = (provider: LocalAIProvider) =>
+ create(InstanceSetting_AIProviderConfigSchema, {
+ id: provider.id,
+ title: provider.title.trim(),
+ type: provider.type,
+ endpoint: provider.endpoint.trim(),
+ apiKey: provider.apiKey,
+ });
+
+const toTranscriptionConfig = (transcription: LocalTranscription) =>
+ create(InstanceSetting_TranscriptionConfigSchema, {
+ providerId: transcription.providerId,
+ model: transcription.model.trim(),
+ language: transcription.language.trim(),
+ prompt: transcription.prompt,
+ });
+
+const AISection = () => {
+ const t = useTranslate();
+ const saveInstanceSetting = useInstanceSettingUpdater();
+ const { aiSetting: originalSetting } = useInstance();
+ const [providers, setProviders] = useState<LocalAIProvider[]>(() => originalSetting.providers.map(toLocalProvider));
+ const [transcription, setTranscription] = useState<LocalTranscription>(() => toLocalTranscription(originalSetting.transcription));
+ const [editingProvider, setEditingProvider] = useState<LocalAIProvider | undefined>();
+ const [deleteTarget, setDeleteTarget] = useState<LocalAIProvider | undefined>();
+
+ useEffect(() => {
+ setProviders(originalSetting.providers.map(toLocalProvider));
+ setTranscription(toLocalTranscription(originalSetting.transcription));
+ }, [originalSetting.providers, originalSetting.transcription]);
+
+ const originalProviders = useMemo(() => originalSetting.providers.map(toLocalProvider), [originalSetting.providers]);
+ const originalTranscription = useMemo(() => toLocalTranscription(originalSetting.transcription), [originalSetting.transcription]);
+ const hasChanges = !isEqual(providers, originalProviders) || !isEqual(transcription, originalTranscription);
+
+ const transcriptionProviderRef = useMemo(
+ () => providers.find((provider) => provider.id === transcription.providerId),
+ [providers, transcription.providerId],
+ );
+
+ const handleCreateProvider = () => {
+ setEditingProvider(newProvider());
+ };
+
+ const handleEditProvider = (provider: LocalAIProvider) => {
+ setEditingProvider({ ...provider, apiKey: "" });
+ };
+
+ const handleSaveProvider = (provider: LocalAIProvider) => {
+ const title = provider.title.trim();
+ const endpoint = provider.endpoint.trim();
+
+ if (!title) {
+ toast.error(t("setting.ai.provider-title-required"));
+ return;
+ }
+ if (!provider.apiKeySet && !provider.apiKey.trim()) {
+ toast.error(t("setting.ai.api-key-required"));
+ return;
+ }
+
+ const normalizedProvider = { ...provider, title, endpoint };
+ setProviders((prev) => {
+ const exists = prev.some((item) => item.id === normalizedProvider.id);
+ if (!exists) {
+ return [...prev, normalizedProvider];
+ }
+ return prev.map((item) => (item.id === normalizedProvider.id ? normalizedProvider : item));
+ });
+ setEditingProvider(undefined);
+ };
+
+ const handleDeleteProvider = () => {
+ if (!deleteTarget) return;
+ setProviders((prev) => prev.filter((provider) => provider.id !== deleteTarget.id));
+ if (transcription.providerId === deleteTarget.id) {
+ setTranscription((prev) => ({ ...prev, providerId: "" }));
+ }
+ setDeleteTarget(undefined);
+ };
+
+ const handleSaveSetting = async () => {
+ if (transcription.providerId && !transcriptionProviderRef) {
+ toast.error(t("setting.ai.transcription-empty-providers"));
+ return;
+ }
+ await saveInstanceSetting({
+ key: InstanceSetting_Key.AI,
+ setting: create(InstanceSettingSchema, {
+ name: buildInstanceSettingName(InstanceSetting_Key.AI),
+ value: {
+ case: "aiSetting",
+ value: create(InstanceSetting_AISettingSchema, {
+ providers: providers.map(toProviderConfig),
+ transcription: toTranscriptionConfig(transcription),
+ }),
+ },
+ }),
+ errorContext: "Update AI setting",
+ });
+ };
+
+ return (
+ <SettingSection
+ title={t("setting.ai.label")}
+ actions={
+ <Button onClick={handleCreateProvider}>
+ <PlusIcon className="w-4 h-4 mr-2" />
+ {t("setting.ai.add-provider")}
+ </Button>
+ }
+ >
+ <SettingPanel className="bg-muted/30 px-4 py-3">
+ <div className="flex max-w-3xl flex-col gap-2">
+ <div className="flex flex-wrap items-center gap-2">
+ <span className="rounded-md border border-border bg-background px-2 py-0.5 text-xs font-medium text-foreground">
+ {t("setting.ai.byok-label")}
+ </span>
+ <h4 className="text-sm font-semibold text-foreground">{t("setting.ai.byok-title")}</h4>
+ </div>
+ <p className="text-sm text-muted-foreground">{t("setting.ai.byok-description")}</p>
+ <ul className="space-y-1 text-sm text-muted-foreground">
+ {byokNotes.map((note) => (
+ <li key={note} className="flex gap-2">
+ <span className="mt-2 size-1 rounded-full bg-muted-foreground/60" aria-hidden />
+ <span>{t(note)}</span>
+ </li>
+ ))}
+ </ul>
+ </div>
+ </SettingPanel>
+
+ <SettingGroup title={t("setting.ai.integrations-title")} description={t("setting.ai.integrations-description")}>
+ <SettingTable
+ columns={[
+ {
+ key: "title",
+ header: t("common.name"),
+ render: (_, provider: LocalAIProvider) => (
+ <div className="flex flex-col gap-0.5">
+ <span className="text-foreground">{provider.title}</span>
+ <span className="font-mono text-xs text-muted-foreground">{provider.id}</span>
+ </div>
+ ),
+ },
+ {
+ key: "type",
+ header: t("setting.ai.provider-type"),
+ render: (_, provider: LocalAIProvider) => <span>{getProviderTypeLabel(provider.type)}</span>,
+ },
+ {
+ key: "endpoint",
+ header: t("setting.ai.endpoint"),
+ render: (_, provider: LocalAIProvider) => (
+ <span className="font-mono text-xs">{provider.endpoint || t("setting.ai.default-endpoint")}</span>
+ ),
+ },
+ {
+ key: "apiKeySet",
+ header: t("setting.ai.api-key"),
+ render: (_, provider: LocalAIProvider) => (
+ <span className="font-mono text-xs">{provider.apiKeySet ? provider.apiKeyHint || t("setting.ai.configured") : "-"}</span>
+ ),
+ },
+ {
+ key: "actions",
+ header: "",
+ className: "text-right",
+ render: (_, provider: LocalAIProvider) => (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="outline" size="sm">
+ <MoreVerticalIcon className="w-4 h-auto" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" sideOffset={2}>
+ <DropdownMenuItem onClick={() => handleEditProvider(provider)}>{t("common.edit")}</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => setDeleteTarget(provider)} className="text-destructive focus:text-destructive">
+ {t("common.delete")}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ),
+ },
+ ]}
+ data={providers}
+ emptyMessage={t("setting.ai.no-providers")}
+ getRowKey={(provider) => provider.id}
+ />
+ </SettingGroup>
+
+ <SettingGroup
+ title={t("setting.ai.transcription-title")}
+ description={t("setting.ai.transcription-description")}
+ showSeparator
+ >
+ <TranscriptionForm
+ providers={providers}
+ transcription={transcription}
+ onChange={setTranscription}
+ referencedProvider={transcriptionProviderRef}
+ />
+ </SettingGroup>
+
+ <div className="w-full flex justify-end">
+ <Button disabled={!hasChanges} onClick={handleSaveSetting}>
+ {t("common.save")}
+ </Button>
+ </div>
+
+ <AIProviderDialog
+ provider={editingProvider}
+ onOpenChange={(open) => !open && setEditingProvider(undefined)}
+ onSave={handleSaveProvider}
+ />
+
+ <ConfirmDialog
+ open={!!deleteTarget}
+ onOpenChange={(open) => !open && setDeleteTarget(undefined)}
+ title={deleteTarget ? t("setting.ai.delete-provider", { title: deleteTarget.title }) : ""}
+ confirmLabel={t("common.delete")}
+ cancelLabel={t("common.cancel")}
+ onConfirm={handleDeleteProvider}
+ confirmVariant="destructive"
+ />
+ </SettingSection>
+ );
+};
+
+interface TranscriptionFormProps {
+ providers: LocalAIProvider[];
+ transcription: LocalTranscription;
+ referencedProvider: LocalAIProvider | undefined;
+ onChange: (next: LocalTranscription) => void;
+}
+
+const TranscriptionForm = ({ providers, transcription, referencedProvider, onChange }: TranscriptionFormProps) => {
+ const t = useTranslate();
+ const noProviders = providers.length === 0;
+
+ const update = (partial: Partial<LocalTranscription>) => {
+ onChange({ ...transcription, ...partial });
+ };
+
+ const placeholderForProvider = (provider: LocalAIProvider | undefined) => {
+ if (!provider) return "";
+ return provider.type === InstanceSetting_AIProviderType.GEMINI
+ ? t("setting.ai.transcription-model-placeholder-gemini")
+ : t("setting.ai.transcription-model-placeholder-openai");
+ };
+
+ return (
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-3xl">
+ <div className="flex flex-col gap-1.5 sm:col-span-2">
+ <Label>{t("setting.ai.transcription-provider")}</Label>
+ <Select
+ value={transcription.providerId || "__none__"}
+ onValueChange={(value) => update({ providerId: value === "__none__" ? "" : value })}
+ disabled={noProviders}
+ >
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="__none__">{t("setting.ai.transcription-no-provider")}</SelectItem>
+ {providers.map((provider) => (
+ <SelectItem key={provider.id} value={provider.id}>
+ {provider.title || provider.id}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ {noProviders && <p className="text-xs text-muted-foreground">{t("setting.ai.transcription-empty-providers")}</p>}
+ {referencedProvider && !referencedProvider.apiKeySet && (
+ <p className="text-xs text-destructive">{t("setting.ai.transcription-warning-no-key")}</p>
+ )}
+ {referencedProvider?.type === InstanceSetting_AIProviderType.GEMINI && (
+ <p className="text-xs text-muted-foreground">{t("setting.ai.transcription-warning-gemini-webm")}</p>
+ )}
+ </div>
+
+ <div className="flex flex-col gap-1.5 sm:col-span-2">
+ <Label>{t("setting.ai.transcription-model")}</Label>
+ <Input
+ value={transcription.model}
+ onChange={(e) => update({ model: e.target.value })}
+ placeholder={placeholderForProvider(referencedProvider)}
+ disabled={!transcription.providerId}
+ />
+ <p className="text-xs text-muted-foreground">{t("setting.ai.transcription-model-help")}</p>
+ </div>
+
+ <div className="flex flex-col gap-1.5">
+ <Label>{t("setting.ai.transcription-language")}</Label>
+ <Input
+ value={transcription.language}
+ onChange={(e) => update({ language: e.target.value })}
+ placeholder={t("setting.ai.transcription-language-placeholder")}
+ disabled={!transcription.providerId}
+ />
+ <p className="text-xs text-muted-foreground">{t("setting.ai.transcription-language-help")}</p>
+ </div>
+
+ <div className="flex flex-col gap-1.5 sm:col-span-2">
+ <Label>{t("setting.ai.transcription-prompt")}</Label>
+ <Textarea
+ value={transcription.prompt}
+ onChange={(e) => update({ prompt: e.target.value })}
+ placeholder={t("setting.ai.transcription-prompt-placeholder")}
+ rows={3}
+ disabled={!transcription.providerId}
+ />
+ <p className="text-xs text-muted-foreground">{t("setting.ai.transcription-prompt-help")}</p>
+ </div>
+ </div>
+ );
+};
+
+interface AIProviderDialogProps {
+ provider?: LocalAIProvider;
+ onOpenChange: (open: boolean) => void;
+ onSave: (provider: LocalAIProvider) => void;
+}
+
+const AIProviderDialog = ({ provider, onOpenChange, onSave }: AIProviderDialogProps) => {
+ const t = useTranslate();
+ const [draft, setDraft] = useState<LocalAIProvider>(() => provider ?? newProvider());
+
+ useEffect(() => {
+ const next = provider ?? newProvider();
+ setDraft(next);
+ }, [provider]);
+
+ const updateDraft = (partial: Partial<LocalAIProvider>) => {
+ setDraft((prev) => ({ ...prev, ...partial }));
+ };
+
+ const handleSave = () => {
+ onSave(draft);
+ };
+
+ return (
+ <Dialog open={!!provider} onOpenChange={onOpenChange}>
+ <DialogContent size="2xl">
+ <DialogHeader>
+ <DialogTitle>{provider?.apiKeySet ? t("setting.ai.edit-provider") : t("setting.ai.add-provider")}</DialogTitle>
+ <DialogDescription>{t("setting.ai.dialog-description")}</DialogDescription>
+ </DialogHeader>
+
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
+ <div className="flex flex-col gap-1.5">
+ <Label>{t("setting.ai.provider-title")}</Label>
+ <Input value={draft.title} onChange={(e) => updateDraft({ title: e.target.value })} placeholder="OpenAI" />
+ </div>
+
+ <div className="flex flex-col gap-1.5">
+ <Label>{t("setting.ai.provider-type")}</Label>
+ <Select
+ value={String(draft.type)}
+ onValueChange={(value) => updateDraft({ type: Number(value) as InstanceSetting_AIProviderType })}
+ >
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {providerTypeOptions.map((type) => (
+ <SelectItem key={type} value={String(type)}>
+ {getProviderTypeLabel(type)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+
+ <div className="flex flex-col gap-1.5 sm:col-span-2">
+ <Label>{t("setting.ai.endpoint")}</Label>
+ <Input
+ value={draft.endpoint}
+ onChange={(e) => updateDraft({ endpoint: e.target.value })}
+ placeholder={getDefaultEndpointPlaceholder(draft.type)}
+ />
+ <p className="text-xs text-muted-foreground">{t("setting.ai.endpoint-hint")}</p>
+ </div>
+
+ <div className="flex flex-col gap-1.5 sm:col-span-2">
+ <Label>{t("setting.ai.api-key")}</Label>
+ <Input
+ type="password"
+ value={draft.apiKey}
+ onChange={(e) => updateDraft({ apiKey: e.target.value })}
+ placeholder={draft.apiKeySet ? t("setting.ai.keep-api-key") : ""}
+ />
+ {draft.apiKeySet && (
+ <p className="text-xs text-muted-foreground">{t("setting.ai.current-key", { key: draft.apiKeyHint || "-" })}</p>
+ )}
+ </div>
+ </div>
+
+ <DialogFooter>
+ <Button variant="ghost" onClick={() => onOpenChange(false)}>
+ {t("common.cancel")}
+ </Button>
+ <Button onClick={handleSave}>{t("common.save")}</Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+};
+
+const getDefaultEndpointPlaceholder = (type: InstanceSetting_AIProviderType) => {
+ switch (type) {
+ case InstanceSetting_AIProviderType.OPENAI:
+ return "https://api.openai.com/v1";
+ case InstanceSetting_AIProviderType.GEMINI:
+ return "https://generativelanguage.googleapis.com/v1beta";
+ default:
+ return "";
+ }
+};
+
+export default AISection;
+```
+
+Note: this references `Textarea` from `@/components/ui/textarea`. Verify that component exists by running:
+
+```bash
+ls web/src/components/ui/textarea.tsx
+```
+
+If the file is missing, the project doesn't have a Textarea primitive yet — fall back to the native `<textarea>` element with the same classes used by the project's `Input` for visual consistency. Keep the same props (`value`, `onChange`, `placeholder`, `rows`, `disabled`).
+
+- [ ] **Step 3: Type-check + lint**
+
+```bash
+cd web && pnpm lint 2>&1 | tail -40
+```
+
+Expected: PASS. Common failures: missing import, mismatch between schema name (`InstanceSetting_TranscriptionConfigSchema`) and what `buf generate` produced — verify the exact name in `web/src/types/proto/api/v1/instance_service_pb.ts` (it may be `InstanceSetting_TranscriptionConfig` paired with `InstanceSetting_TranscriptionConfigSchema`, matching the AISetting pattern).
+
+- [ ] **Step 4: Manual smoke test**
+
+Start backend and frontend:
+
+```bash
+go run ./cmd/memos --port 8081 &
+cd web && pnpm dev
+```
+
+Open `http://localhost:3001/`, sign in as the host user, navigate to Settings → AI:
+
+- Verify the **AI integrations** group shows the existing provider table (or empty state).
+- Verify the **Transcription** group renders with the four fields disabled when no provider is selected.
+- Add a provider with type OPENAI and a key. The transcription section now lets you select it. Pick the provider; the model placeholder shows `whisper-1`. Type `whisper-1` in the model field, leave language empty, leave prompt empty, save.
+- Refresh the page. The transcription section retains the saved provider and model.
+- Change the provider title → save. The transcription section still references the same provider by id (title in dropdown updates).
+- Delete the provider → the transcription section's `providerId` is cleared (model field becomes disabled).
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add web/src/components/Settings/AISection.tsx web/src/locales/en.json
+git commit -m "feat(settings): add Transcription configuration section
+
+Splits the AI settings page into 'AI integrations' (existing
+provider list) and 'Transcription' (new). The transcription form
+chooses a provider, model, default language, and prompt hint. Save
+writes the entire AI setting in one request."
+```
+
+---
+
+## Task 8: Wire `MemoEditor` to the persisted transcription config
+
+**Files:**
+- Modify: `web/src/components/MemoEditor/index.tsx:31-67,130-159`
+- Modify: `web/src/components/MemoEditor/services/transcriptionService.ts`
+
+The editor previously scanned `aiSetting.providers` for the first one with an API key. It now reads `aiSetting.transcription.providerId`, validates the reference, and calls the service without a provider argument.
+
+- [ ] **Step 1: Edit `transcriptionService.ts`**
+
+Replace the entire contents of `web/src/components/MemoEditor/services/transcriptionService.ts` with:
+
+```ts
+import { create } from "@bufbuild/protobuf";
+import { aiServiceClient } from "@/connect";
+import { TranscribeRequestSchema, TranscriptionAudioSchema, TranscriptionConfigSchema } from "@/types/proto/api/v1/ai_service_pb";
+
+export const transcriptionService = {
+ async transcribeFile(file: File): Promise<string> {
+ const content = new Uint8Array(await file.arrayBuffer());
+ const response = await aiServiceClient.transcribe(
+ create(TranscribeRequestSchema, {
+ config: create(TranscriptionConfigSchema, {}),
+ audio: create(TranscriptionAudioSchema, {
+ source: {
+ case: "content",
+ value: content,
+ },
+ filename: file.name,
+ contentType: file.type,
+ }),
+ }),
+ );
+
+ return response.text;
+ },
+};
+```
+
+Note: `providerId` is intentionally omitted — the server resolves it from `InstanceAISetting.transcription.providerId`.
+
+- [ ] **Step 2: Edit `MemoEditor/index.tsx`**
+
+Open the file. Two regions change:
+
+**Region A** — replace lines 31–67 (the `TRANSCRIPTION_PROVIDER_TYPES` constant, the `transcriptionProvider` lookup, and the unused `InstanceSetting_AIProviderType` import path) with:
+
+```tsx
+// (delete the TRANSCRIPTION_PROVIDER_TYPES constant entirely — no longer needed)
+```
+
+And inside `MemoEditorImpl`, replace:
+
+```tsx
+ const transcriptionProvider = useMemo(
+ () => aiSetting.providers.find((provider) => provider.apiKeySet && TRANSCRIPTION_PROVIDER_TYPES.includes(provider.type)),
+ [aiSetting.providers],
+ );
+```
+
+with:
+
+```tsx
+ const canTranscribe = useMemo(() => {
+ const providerId = aiSetting.transcription?.providerId ?? "";
+ if (!providerId) return false;
+ const provider = aiSetting.providers.find((p) => p.id === providerId);
+ return Boolean(provider?.apiKeySet);
+ }, [aiSetting.providers, aiSetting.transcription?.providerId]);
+```
+
+Then update the import line at the top of the file. Currently:
+
+```tsx
+import { InstanceSetting_AIProviderType, InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb";
+```
+
+Becomes (drop the `InstanceSetting_AIProviderType` import — it's no longer referenced in this file):
+
+```tsx
+import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb";
+```
+
+**Region B** — replace lines 130–159 (the `handleTranscribeRecordedAudio` callback and any guards) so it consults `canTranscribe` and calls the service without a provider arg:
+
+```tsx
+ const handleTranscribeRecordedAudio = useCallback(
+ async (localFile: LocalFile) => {
+ if (!canTranscribe) {
+ dispatch(actions.addLocalFile(localFile));
+ setIsTranscribingAudio(false);
+ setIsAudioRecorderOpen(false);
+ return;
+ }
+
+ try {
+ const text = (await transcriptionService.transcribeFile(localFile.file)).trim();
+ if (!text) {
+ dispatch(actions.addLocalFile(localFile));
+ toast.error(t("editor.audio-recorder.transcribe-empty"));
+ return;
+ }
+
+ insertTranscribedText(text);
+ toast.success(t("editor.audio-recorder.transcribe-success"));
+ } catch (error) {
+ console.error(error);
+ toast.error(errorService.getErrorMessage(error) || t("editor.audio-recorder.transcribe-error"));
+ dispatch(actions.addLocalFile(localFile));
+ } finally {
+ setIsTranscribingAudio(false);
+ setIsAudioRecorderOpen(false);
+ }
+ },
+ [actions, canTranscribe, dispatch, insertTranscribedText, t],
+ );
+```
+
+Then update `handleTranscribeAudioRecording` (currently around line 225) so its guard uses `canTranscribe`:
+
+```tsx
+ const handleTranscribeAudioRecording = () => {
+ if (!canTranscribe || isTranscribingAudio) {
+ return;
+ }
+
+ setIsTranscribingAudio(true);
+ const didStop = audioRecorder.stopRecording("transcribe");
+ if (!didStop) {
+ setIsTranscribingAudio(false);
+ }
+ };
+```
+
+Finally, search the file for any remaining references to `transcriptionProvider` and replace them with `canTranscribe`. Also update the prop passed to `<AudioRecorderPanel canTranscribe={...}>` if it currently uses `transcriptionProvider` — replace with `canTranscribe`.
+
+- [ ] **Step 3: Type-check**
+
+```bash
+cd web && pnpm lint 2>&1 | tail -20
+```
+
+Expected: PASS.
+
+- [ ] **Step 4: Manual smoke test**
+
+With the dev server running:
+
+1. **No transcription configured**: Settings → AI shows providers but no transcription selection. In the home editor, open the audio recorder. The Transcribe button (waveform icon) should be hidden — only Cancel and Stop visible.
+2. **Transcription configured with valid provider**: Select a provider in Transcription, set model to `whisper-1`, save. Open the recorder; the Transcribe button is now visible. Record a short clip in English, click Transcribe — text appears in the editor.
+3. **Provider deleted after transcription was configured**: Configure transcription, save, then delete the referenced provider in AI Integrations and save. Reload the editor; the Transcribe button is hidden.
+4. **API key cleared from referenced provider**: Edit a referenced provider so it has no API key (this requires backend support — currently impossible since save requires apiKey to be set; verify by writing setting directly via API or skip this case).
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add web/src/components/MemoEditor/index.tsx web/src/components/MemoEditor/services/transcriptionService.ts
+git commit -m "feat(memo-editor): use persisted transcription config
+
+The editor's transcribe button now reflects InstanceAISetting.
+transcription.providerId rather than an implicit \"first provider
+with apiKey\" pick. The transcribeFile service no longer takes a
+provider argument — the server resolves it from settings."
+```
+
+---
+
+## Task 9: Strip the now-unused REQUIRED gate on `provider_id` in the server
+
+**Files:**
+- Modify: `server/router/api/v1/ai_service.go` (clean-up only)
+
+Task 6 already deleted the `provider_id is required` `InvalidArgument` branch. This task confirms there's no orphaned helper or constant left behind.
+
+- [ ] **Step 1: Search for orphans**
+
+```bash
+grep -n "resolveAIProviderForTranscription\|provider_id is required" server/router/api/v1/ai_service.go
+```
+
+Expected: no matches (Task 6 should have removed both). If anything matches, delete it.
+
+- [ ] **Step 2: Run linter**
+
+```bash
+golangci-lint run ./server/router/api/v1/...
+```
+
+Expected: PASS.
+
+- [ ] **Step 3: Run the full backend suite once more**
+
+```bash
+go test -race ./server/... ./internal/...
+```
+
+Expected: PASS.
+
+- [ ] **Step 4: Commit (only if Step 1 found anything to clean up)**
+
+If Step 1 returned matches and you removed code, commit:
+
+```bash
+git add server/router/api/v1/ai_service.go
+git commit -m "chore(api/ai): remove orphaned helpers from old transcribe flow"
+```
+
+Otherwise, skip the commit — the task is a no-op verification.
+
+---
+
+## Task 10: End-to-end verification
+
+**Files:** none — verification only.
+
+- [ ] **Step 1: Full backend test suite**
+
+```bash
+go test -race ./...
+```
+
+Expected: PASS.
+
+- [ ] **Step 2: Frontend lint + build**
+
+```bash
+cd web && pnpm lint && pnpm build
+```
+
+Expected: PASS for both.
+
+- [ ] **Step 3: Manual end-to-end flow (single-instance smoke test)**
+
+With backend on `:8081` and frontend on `:3001`:
+
+1. Sign in as host user. Settings → AI.
+2. Add a provider: type OPENAI, title "OpenAI", endpoint blank (defaults to `https://api.openai.com/v1`), api-key `sk-...` (real or fake).
+3. In Transcription, select the provider, set model to `whisper-1`, leave language and prompt empty. Save. Toast confirms.
+4. Refresh — transcription section retains the values.
+5. Add a second provider: type OPENAI, title "Groq", endpoint `https://api.groq.com/openai/v1`, api-key `gsk_...`. Switch transcription's provider dropdown to Groq, set model to `whisper-large-v3-turbo`, save.
+6. Open the home editor. Open audio recorder. Transcribe button visible. (Don't actually call the network unless your test key works.)
+7. Switch transcription's provider to "None — transcription disabled". Save. Reopen the recorder — Transcribe button hidden.
+8. Set provider back to "OpenAI". Add a Gemini provider; switch transcription to Gemini. Verify the inline warning "Gemini does not accept browser-recorded audio/webm" appears under the provider dropdown.
+
+- [ ] **Step 4: Final commit (if anything was tweaked during verification)**
+
+If verification surfaced any minor fix (e.g., a string typo in the locale), commit it now:
+
+```bash
+git add -A
+git commit -m "chore(settings): polish transcription section copy"
+```
+
+---
+
+## Self-review checklist (run before opening the PR)
+
+1. **Spec coverage:**
+ - Schema additive `TranscriptionConfig` (store + api): Tasks 1, 2 ✓
+ - Backend: read setting at `Transcribe` start, fall-through resolution, `FailedPrecondition` when unconfigured: Task 6 ✓
+ - Validation: `provider_id` references existing provider; length caps on model/language/prompt: Task 4 ✓
+ - `TranscribeRequest.provider_id` becomes optional: Task 5 ✓
+ - Frontend: AI Integrations + Transcription split, Provider/Model/Language/Prompt fields, provider dropdown disabled when empty, "Add an AI integration first" hint, Gemini webm warning, no-key warning: Task 7 ✓
+ - Frontend: editor reads `aiSetting.transcription.providerId`, service drops provider arg: Task 8 ✓
+ - Backwards compat (no migration): covered — existing instances default to empty `provider_id` and fall into "transcription disabled" branch ✓
+ - Gemini webm: inline warning chosen, implemented as the `transcription-warning-gemini-webm` string in Task 7 ✓
+
+2. **Placeholder scan:** No "TBD", "TODO", or "implement later" markers in this plan. Each step contains exact file paths, exact code, exact commands, expected output.
+
+3. **Type / name consistency:**
+ - Store proto: `InstanceAISetting.transcription` → `TranscriptionConfig` (Task 1).
+ - Generated Go type: `storepb.TranscriptionConfig` (referenced in Tasks 3, 4, 6).
+ - API proto: `InstanceSetting.AISetting.transcription` → `InstanceSetting.TranscriptionConfig` (Task 2). Generated Go type: `v1pb.InstanceSetting_TranscriptionConfig` (Tasks 3, 4). Generated TS type: `InstanceSetting_TranscriptionConfig` and `InstanceSetting_TranscriptionConfigSchema` (Task 7).
+ - All uses match.
+
+4. **Things to watch during execution:**
+ - `buf generate` produces TS type names that differ slightly across generators. If `InstanceSetting_TranscriptionConfigSchema` doesn't exist after Task 2's regeneration, check the actual export name in `web/src/types/proto/api/v1/instance_service_pb.ts` and adjust Task 7's imports accordingly.
+ - The `Textarea` UI primitive existence is verified mid-Task 7. If absent, fall back to `<textarea>` with project styling.
+ - `prepareInstanceAISettingForUpdate` runs only when the AI setting key is being updated; the `existing` lookup uses `s.Store.GetInstanceAISetting(ctx)` which already returns the current state with transcription populated (after Task 1).
diff --git a/docs/superpowers/specs/2026-05-02-transcription-settings-design.md b/docs/superpowers/specs/2026-05-02-transcription-settings-design.md
new file mode 100644
index 000000000..d14536c33
--- /dev/null
+++ b/docs/superpowers/specs/2026-05-02-transcription-settings-design.md
@@ -0,0 +1,155 @@
+# Transcription (STT) settings — design
+
+**Date:** 2026-05-02
+**Scope:** Backend + frontend. Schema-additive (no migration required).
+
+## Problem
+
+Memos has one AI feature today: audio transcription (speech-to-text). The current design has three concrete problems:
+
+1. **Model is hard-coded per provider type.** `internal/ai/models.go` pins OpenAI to `gpt-4o-transcribe` and Gemini to `gemini-2.5-flash`. Users who want `whisper-1` (cheaper, often more accurate for non-English) or third-party Whisper-compatible endpoints (Groq's `whisper-large-v3-turbo`, self-hosted whisper.cpp / Speaches via OpenAI-compatible URL) cannot configure them at all.
+2. **No explicit transcription configuration.** `InstanceAISetting.providers` is a generic credentials list. The frontend (`MemoEditor/index.tsx:65`) implicitly picks "the first provider with an API key whose type is in TRANSCRIPTION_PROVIDER_TYPES." Users cannot:
+ - Choose which provider runs transcription when they have multiple.
+ - Set a default language (Whisper API supports it but it is never sent).
+ - Set a `prompt` hint to bias spelling of proper nouns / jargon (a documented Whisper feature, surfaced by every other STT product).
+3. **Gemini fails for browser-recorded audio.** `internal/ai/gemini.go:23` does not list `audio/webm` in `geminiSupportedContentTypes`, but `MediaRecorder` in browsers defaults to `audio/webm`. So selecting a Gemini provider for in-editor recording produces a content-type error every time.
+
+## Goal
+
+Let the operator configure transcription explicitly: which provider, which model, default language, and a spelling-hint prompt. Make the OpenAI provider work as a universal "OpenAI-compatible" engine so Groq / self-hosted Whisper / Speaches are reachable through endpoint override.
+
+## Non-goals
+
+- Adding STT engines beyond OpenAI and Gemini (Azure, Deepgram, AWS Transcribe — out of scope; the schema admits them later via `AIProviderType` enum).
+- Other AI features (summarization, embeddings, tag suggestion). The schema is shaped so they fit later, but none are designed here.
+- Per-call provider override at recording time. Research across all surveyed products (OpenWebUI, LibreChat, Whisper Memos, Superwhisper, etc.) confirms STT engine is a global preference, not an action-time choice. We follow the same pattern.
+- Server-side audio transcoding (e.g., webm → wav for Gemini). See "Gemini webm" below for the chosen mitigation.
+- Multi-user or per-user override of admin defaults. Memos' STT setting is instance-scoped, like every other instance setting.
+
+## Naming
+
+Field and message names follow cross-platform STT conventions, not Memos-internal shorthand:
+
+| Concept | Chosen name | Rationale |
+|---|---|---|
+| Config message | `TranscriptionConfig` | AssemblyAI uses this exact identifier; matches OpenAI's `CreateTranscription*` verb family and Memos' existing `Transcribe` RPC. The `STT` acronym is not used as a type name in any major STT API. |
+| Provider reference | `provider_id` (string) | Plain protobuf convention for a string-ID reference (`field_id`, `user_id` style). `engine` was rejected as an OpenWebUI-only term; typed message refs are not needed since providers are addressed by string ID. |
+| Model | `model` | Unanimous across OpenAI, Google v2, Deepgram, OpenWebUI, LibreChat. Not `model_id`. |
+| Default language | `language` | Bare `language` is the modern convention (OpenAI, Whisper family, Deepgram, Wyoming). `language_code` is the older Google/AWS form; we accept ISO 639-1 short codes the same way OpenAI does. |
+| Spelling hint | `prompt` | OpenAI's public API field name and AssemblyAI's. Whisper's internal name is `initial_prompt`, but `prompt` is what users of `audio.transcriptions.create` recognize. |
+
+A note on the message name collision: `proto/api/v1/ai_service.proto` already declares a `TranscriptionConfig` for **per-call** prompt/language overrides. The new store-level `TranscriptionConfig` lives in package `memos.store`, so the two compile cleanly. Memos already uses parallel `api.v1.X` / `store.X` message pairs (e.g. `User`, `Memo`); this matches that pattern.
+
+## Architecture
+
+### Schema (additive)
+
+`proto/store/instance_setting.proto`:
+
+```proto
+message InstanceAISetting {
+ repeated AIProviderConfig providers = 1; // unchanged — credential pool
+ TranscriptionConfig transcription = 2; // NEW — feature config
+}
+
+message TranscriptionConfig {
+ // References an entry in providers[].id. Empty string = transcription disabled.
+ string provider_id = 1;
+ // Free text. Empty string = engine default (whisper-1 for OPENAI, gemini-2.5-flash for GEMINI).
+ string model = 2;
+ // ISO 639-1 short code. Empty string = auto-detect.
+ string language = 3;
+ // Up to ~200 tokens. Used as the OpenAI Whisper `prompt` parameter and as
+ // a "Context and spelling hints:" block in the Gemini prompt.
+ string prompt = 4;
+}
+```
+
+`proto/api/v1/ai_service.proto`:
+
+- `TranscribeRequest.provider_id` becomes optional. When omitted, the server resolves the provider from `InstanceAISetting.transcription.provider_id`.
+- `TranscribeRequest.config` (per-call `TranscriptionConfig` with `prompt` / `language`) is kept for advanced overrides but its fields, when empty, fall back to the persisted defaults from `InstanceAISetting.transcription`.
+
+### Backend changes
+
+1. **`internal/ai/models.go`** — `DefaultTranscriptionModel` already exists; reuse it as the fallback when `TranscriptionConfig.model` is empty. No new code, just used from a new call site.
+2. **`server/router/api/v1/ai_service.go`**:
+ - Read `InstanceAISetting.transcription` at the start of `Transcribe`.
+ - Resolve `provider_id` from request → fall back to `transcription.provider_id`. If both empty, return `FailedPrecondition` with a clear "transcription not configured" message.
+ - Resolve `model` similarly: request override → `transcription.model` → engine default via `DefaultTranscriptionModel`.
+ - Merge `language` and `prompt`: per-call overrides win; otherwise fall through to persisted defaults.
+3. **`internal/ai/gemini.go`** — out of scope to fix the webm content-type list here. See mitigation below.
+
+### Frontend changes
+
+`web/src/components/Settings/AISection.tsx` is restructured into two settings groups inside the existing `SettingSection`:
+
+1. **AI Integrations** (renamed from "Providers" — current behavior): list of credential entries (id, title, type, endpoint, api key). No functional changes; the rename communicates that this section is just credentials.
+2. **Transcription** (new): three-segment form
+ - **Provider** — Select dropdown listing entries from group 1 by `title`. First option is "None — transcription disabled". Disabled with a hint "Add an AI integration first ↑" when group 1 is empty.
+ - **Model** — text input. Placeholder updates dynamically based on the selected provider's type (`whisper-1` for OPENAI, `gemini-2.5-flash` for GEMINI). Help text below: "Free text. Use the provider's model identifier — e.g., whisper-1, gpt-4o-transcribe, whisper-large-v3-turbo."
+ - **Default language** — text input, ISO 639-1 placeholder, empty = auto.
+ - **Prompt hints** — textarea, ~200 token soft limit, help text "Improves spelling of proper nouns and jargon. Whisper limit is ~224 tokens."
+
+`web/src/components/MemoEditor/index.tsx:65` changes:
+
+- Replace the "first provider with apiKey in TRANSCRIPTION_PROVIDER_TYPES" lookup with this enable rule: transcribe button shows iff `aiSetting.transcription.providerId` is non-empty AND the referenced provider exists in `aiSetting.providers` AND that provider has `apiKeySet === true`.
+- The editor no longer needs to know the provider object itself for the call — see service change below.
+
+`web/src/components/MemoEditor/services/transcriptionService.ts` is simplified: it stops accepting a `provider` argument and simply omits `provider_id` from the request. The server resolves the provider, model, language, and prompt from `InstanceAISetting.transcription`. (No override path is exposed at the editor layer; advanced callers can still pass `provider_id` directly via the proto if needed in the future.)
+
+### How "OpenAI-compatible" backends work
+
+To use Groq, Speaches, or self-hosted whisper.cpp:
+
+1. In **AI Integrations**, add a provider with type `OPENAI`, set `endpoint` to e.g. `https://api.groq.com/openai/v1` or `http://speaches:8000/v1`, set the API key, give it a recognizable title ("Groq", "Self-hosted Whisper").
+2. In **Transcription**, select that provider and set `model` to the backend's model identifier (`whisper-large-v3-turbo`, `Systran/faster-distil-whisper-large-v3`, etc.).
+
+This is the universal escape hatch confirmed across OpenWebUI, LibreChat, and Whisper Obsidian plugin: don't enumerate every backend — let the OpenAI engine be a transport, not a brand.
+
+## Gemini webm mitigation
+
+The Gemini `audio/webm` failure is a real user-blocking bug but separate from the settings redesign. Three options were considered:
+
+- **(a) Server-side transcode** with ffmpeg. Adds a heavy runtime dep; rejected as YAGNI.
+- **(b) Switch MediaRecorder format** when STT engine is Gemini. Browser support for `audio/mp4` and `audio/wav` in `MediaRecorder` is patchy across Firefox / Safari / Chrome; rejected as fragile.
+- **(c) Inline hint + accept the limitation.** Selected. The Transcription section shows a small warning under the model field when the chosen provider type is `GEMINI`: "Gemini does not accept browser-recorded `audio/webm`. For in-editor recording, use an OpenAI-compatible provider."
+
+Server-side transcoding can be revisited later as a self-contained change if Gemini demand grows.
+
+## Validation
+
+Server validation (`server/router/api/v1/ai_service.go`):
+
+- `transcription.provider_id`, when set, must reference an existing entry in `providers[]`. On `UpdateInstanceSetting` for the AI key, reject with `InvalidArgument` if it doesn't.
+- `transcription.model` length cap: 256 chars (covers `Systran/faster-distil-whisper-large-v3`-style names with margin).
+- `transcription.language` length cap: 32 chars (existing constant `maxTranscriptionLanguageLength`).
+- `transcription.prompt` length cap: 4096 chars (existing constant `maxTranscriptionPromptLength`).
+
+Frontend validation in `AISection.tsx`:
+
+- "Save" disabled if `transcription.providerId` is set but the referenced provider was just deleted from the integrations list (in the same unsaved edit).
+- Inline warning shown (but Save still allowed) if the referenced provider exists but has `apiKeySet === false` — surfacing the broken state so the operator can fix it without blocking unrelated edits to other settings.
+
+## Backwards compatibility
+
+The schema change is purely additive. Existing instances with `providers` configured but no `transcription` field default to `provider_id = ""`, which means transcription is disabled until the operator visits the new Transcription section and selects a provider.
+
+This is a small UX regression for instances that were relying on the implicit "first provider wins" behavior — they now must make a one-click selection. Acceptable trade-off because:
+
+- It makes the choice explicit (the implicit pick was the source of confusion when users had multiple providers).
+- A one-time migration that auto-fills `transcription.provider_id` with the first STT-capable provider is feasible but adds complexity for a one-line user action. Skip the migration; document the change in the release notes.
+
+## Testing
+
+- `internal/ai/transcription_test.go` (existing) covers the transcribe RPC. Add cases for: empty `provider_id` falls back to setting; empty `model` falls back to `DefaultTranscriptionModel`; per-call overrides win over settings.
+- `server/router/api/v1/test/ai_service_test.go` (existing) covers the API service. Add cases for the validation rules above (unknown provider_id, oversized model/language/prompt).
+- Frontend: manual verification via the dev server (`pnpm dev` in `web/`) — load Settings, add a provider, configure transcription, verify the home editor's record button enables/disables based on `provider_id`. No new component tests required (existing AISection has none).
+
+## Out of scope, explicitly
+
+- Multiple transcription configurations / per-tag or per-user routing.
+- Per-call provider override exposed in the editor UI.
+- Test-transcription button in settings (worth doing later; deferred to keep this scope tight).
+- Glossary / vocabulary list as a separate field — folded into `prompt` for now (Joplin/Superwhisper split this; we can add later if users ask).
+- TTS settings. Memos has none today and none planned.
diff --git a/internal/ai/models.go b/internal/ai/models.go
index b0855c321..4f6e8ee69 100644
--- a/internal/ai/models.go
+++ b/internal/ai/models.go
@@ -4,7 +4,7 @@ import "github.com/pkg/errors"
const (
// DefaultOpenAITranscriptionModel is the built-in OpenAI transcription model.
- DefaultOpenAITranscriptionModel = "gpt-4o-transcribe"
+ DefaultOpenAITranscriptionModel = "whisper-1"
// DefaultGeminiTranscriptionModel is the built-in Gemini transcription model.
DefaultGeminiTranscriptionModel = "gemini-2.5-flash"
)
diff --git a/proto/api/v1/ai_service.proto b/proto/api/v1/ai_service.proto
index 82c9386eb..1aeb1e63e 100644
--- a/proto/api/v1/ai_service.proto
+++ b/proto/api/v1/ai_service.proto
@@ -15,27 +15,13 @@ service AIService {
post: "/api/v1/ai:transcribe"
body: "*"
};
- option (google.api.method_signature) = "provider_id,config,audio";
+ option (google.api.method_signature) = "audio";
}
}
message TranscribeRequest {
- // Required. The instance AI provider ID to use.
- string provider_id = 1 [(google.api.field_behavior) = REQUIRED];
-
- // Required. Transcription options.
- TranscriptionConfig config = 2 [(google.api.field_behavior) = REQUIRED];
-
// Required. Audio input.
- TranscriptionAudio audio = 3 [(google.api.field_behavior) = REQUIRED];
-}
-
-message TranscriptionConfig {
- // Optional. A prompt to improve transcription quality.
- string prompt = 1 [(google.api.field_behavior) = OPTIONAL];
-
- // Optional. The language of the input audio.
- string language = 2 [(google.api.field_behavior) = OPTIONAL];
+ TranscriptionAudio audio = 1 [(google.api.field_behavior) = REQUIRED];
}
message TranscriptionAudio {
diff --git a/proto/api/v1/instance_service.proto b/proto/api/v1/instance_service.proto
index aa3cdd7a2..6b4bcbaa4 100644
--- a/proto/api/v1/instance_service.proto
+++ b/proto/api/v1/instance_service.proto
@@ -227,6 +227,10 @@ message InstanceSetting {
message AISetting {
// providers is the list of AI provider configurations available instance-wide.
repeated AIProviderConfig providers = 1;
+
+ // transcription is the speech-to-text feature configuration.
+ // When unset or transcription.provider_id is empty, transcription is disabled.
+ TranscriptionConfig transcription = 2;
}
// AIProviderConfig represents one callable AI provider connection.
@@ -249,6 +253,25 @@ message InstanceSetting {
OPENAI = 1;
GEMINI = 2;
}
+
+ // TranscriptionConfig configures the speech-to-text feature.
+ message TranscriptionConfig {
+ // provider_id references an entry in AISetting.providers[].id.
+ // Empty string means transcription is disabled.
+ string provider_id = 1;
+
+ // model is the provider-specific model identifier.
+ // Empty string falls back to the engine default
+ // (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers).
+ string model = 2;
+
+ // language is the default ISO 639-1 language hint sent to the provider.
+ // Empty string lets the provider auto-detect.
+ string language = 3;
+
+ // prompt is a default spelling/vocabulary hint passed to the provider.
+ string prompt = 4;
+ }
}
// Request message for GetInstanceSetting method.
diff --git a/proto/gen/api/v1/ai_service.pb.go b/proto/gen/api/v1/ai_service.pb.go
index 6656c0953..8f526a136 100644
--- a/proto/gen/api/v1/ai_service.pb.go
+++ b/proto/gen/api/v1/ai_service.pb.go
@@ -24,12 +24,8 @@ const (
type TranscribeRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The instance AI provider ID to use.
- ProviderId string `protobuf:"bytes,1,opt,name=provider_id,json=providerId,proto3" json:"provider_id,omitempty"`
- // Required. Transcription options.
- Config *TranscriptionConfig `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
// Required. Audio input.
- Audio *TranscriptionAudio `protobuf:"bytes,3,opt,name=audio,proto3" json:"audio,omitempty"`
+ Audio *TranscriptionAudio `protobuf:"bytes,1,opt,name=audio,proto3" json:"audio,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -64,20 +60,6 @@ func (*TranscribeRequest) Descriptor() ([]byte, []int) {
return file_api_v1_ai_service_proto_rawDescGZIP(), []int{0}
}
-func (x *TranscribeRequest) GetProviderId() string {
- if x != nil {
- return x.ProviderId
- }
- return ""
-}
-
-func (x *TranscribeRequest) GetConfig() *TranscriptionConfig {
- if x != nil {
- return x.Config
- }
- return nil
-}
-
func (x *TranscribeRequest) GetAudio() *TranscriptionAudio {
if x != nil {
return x.Audio
@@ -85,60 +67,6 @@ func (x *TranscribeRequest) GetAudio() *TranscriptionAudio {
return nil
}
-type TranscriptionConfig struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Optional. A prompt to improve transcription quality.
- Prompt string `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"`
- // Optional. The language of the input audio.
- Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *TranscriptionConfig) Reset() {
- *x = TranscriptionConfig{}
- mi := &file_api_v1_ai_service_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *TranscriptionConfig) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*TranscriptionConfig) ProtoMessage() {}
-
-func (x *TranscriptionConfig) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_ai_service_proto_msgTypes[1]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use TranscriptionConfig.ProtoReflect.Descriptor instead.
-func (*TranscriptionConfig) Descriptor() ([]byte, []int) {
- return file_api_v1_ai_service_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *TranscriptionConfig) GetPrompt() string {
- if x != nil {
- return x.Prompt
- }
- return ""
-}
-
-func (x *TranscriptionConfig) GetLanguage() string {
- if x != nil {
- return x.Language
- }
- return ""
-}
-
type TranscriptionAudio struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Types that are valid to be assigned to Source:
@@ -156,7 +84,7 @@ type TranscriptionAudio struct {
func (x *TranscriptionAudio) Reset() {
*x = TranscriptionAudio{}
- mi := &file_api_v1_ai_service_proto_msgTypes[2]
+ mi := &file_api_v1_ai_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -168,7 +96,7 @@ func (x *TranscriptionAudio) String() string {
func (*TranscriptionAudio) ProtoMessage() {}
func (x *TranscriptionAudio) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_ai_service_proto_msgTypes[2]
+ mi := &file_api_v1_ai_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -181,7 +109,7 @@ func (x *TranscriptionAudio) ProtoReflect() protoreflect.Message {
// Deprecated: Use TranscriptionAudio.ProtoReflect.Descriptor instead.
func (*TranscriptionAudio) Descriptor() ([]byte, []int) {
- return file_api_v1_ai_service_proto_rawDescGZIP(), []int{2}
+ return file_api_v1_ai_service_proto_rawDescGZIP(), []int{1}
}
func (x *TranscriptionAudio) GetSource() isTranscriptionAudio_Source {
@@ -251,7 +179,7 @@ type TranscribeResponse struct {
func (x *TranscribeResponse) Reset() {
*x = TranscribeResponse{}
- mi := &file_api_v1_ai_service_proto_msgTypes[3]
+ mi := &file_api_v1_ai_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -263,7 +191,7 @@ func (x *TranscribeResponse) String() string {
func (*TranscribeResponse) ProtoMessage() {}
func (x *TranscribeResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_ai_service_proto_msgTypes[3]
+ mi := &file_api_v1_ai_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -276,7 +204,7 @@ func (x *TranscribeResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use TranscribeResponse.ProtoReflect.Descriptor instead.
func (*TranscribeResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_ai_service_proto_rawDescGZIP(), []int{3}
+ return file_api_v1_ai_service_proto_rawDescGZIP(), []int{2}
}
func (x *TranscribeResponse) GetText() string {
@@ -290,15 +218,9 @@ var File_api_v1_ai_service_proto protoreflect.FileDescriptor
const file_api_v1_ai_service_proto_rawDesc = "" +
"\n" +
- "\x17api/v1/ai_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\"\xb6\x01\n" +
- "\x11TranscribeRequest\x12$\n" +
- "\vprovider_id\x18\x01 \x01(\tB\x03\xe0A\x02R\n" +
- "providerId\x12>\n" +
- "\x06config\x18\x02 \x01(\v2!.memos.api.v1.TranscriptionConfigB\x03\xe0A\x02R\x06config\x12;\n" +
- "\x05audio\x18\x03 \x01(\v2 .memos.api.v1.TranscriptionAudioB\x03\xe0A\x02R\x05audio\"S\n" +
- "\x13TranscriptionConfig\x12\x1b\n" +
- "\x06prompt\x18\x01 \x01(\tB\x03\xe0A\x01R\x06prompt\x12\x1f\n" +
- "\blanguage\x18\x02 \x01(\tB\x03\xe0A\x01R\blanguage\"\x9c\x01\n" +
+ "\x17api/v1/ai_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\"P\n" +
+ "\x11TranscribeRequest\x12;\n" +
+ "\x05audio\x18\x01 \x01(\v2 .memos.api.v1.TranscriptionAudioB\x03\xe0A\x02R\x05audio\"\x9c\x01\n" +
"\x12TranscriptionAudio\x12\x1f\n" +
"\acontent\x18\x01 \x01(\fB\x03\xe0A\x04H\x00R\acontent\x12\x12\n" +
"\x03uri\x18\x02 \x01(\tH\x00R\x03uri\x12\x1f\n" +
@@ -306,10 +228,10 @@ const file_api_v1_ai_service_proto_rawDesc = "" +
"\fcontent_type\x18\x04 \x01(\tB\x03\xe0A\x01R\vcontentTypeB\b\n" +
"\x06source\"(\n" +
"\x12TranscribeResponse\x12\x12\n" +
- "\x04text\x18\x01 \x01(\tR\x04text2\x9a\x01\n" +
- "\tAIService\x12\x8c\x01\n" +
+ "\x04text\x18\x01 \x01(\tR\x04text2\x86\x01\n" +
+ "\tAIService\x12y\n" +
"\n" +
- "Transcribe\x12\x1f.memos.api.v1.TranscribeRequest\x1a .memos.api.v1.TranscribeResponse\";\xdaA\x18provider_id,config,audio\x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/api/v1/ai:transcribeB\xa6\x01\n" +
+ "Transcribe\x12\x1f.memos.api.v1.TranscribeRequest\x1a .memos.api.v1.TranscribeResponse\"(\xdaA\x05audio\x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/api/v1/ai:transcribeB\xa6\x01\n" +
"\x10com.memos.api.v1B\x0eAiServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
var (
@@ -324,23 +246,21 @@ func file_api_v1_ai_service_proto_rawDescGZIP() []byte {
return file_api_v1_ai_service_proto_rawDescData
}
-var file_api_v1_ai_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
+var file_api_v1_ai_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_api_v1_ai_service_proto_goTypes = []any{
- (*TranscribeRequest)(nil), // 0: memos.api.v1.TranscribeRequest
- (*TranscriptionConfig)(nil), // 1: memos.api.v1.TranscriptionConfig
- (*TranscriptionAudio)(nil), // 2: memos.api.v1.TranscriptionAudio
- (*TranscribeResponse)(nil), // 3: memos.api.v1.TranscribeResponse
+ (*TranscribeRequest)(nil), // 0: memos.api.v1.TranscribeRequest
+ (*TranscriptionAudio)(nil), // 1: memos.api.v1.TranscriptionAudio
+ (*TranscribeResponse)(nil), // 2: memos.api.v1.TranscribeResponse
}
var file_api_v1_ai_service_proto_depIdxs = []int32{
- 1, // 0: memos.api.v1.TranscribeRequest.config:type_name -> memos.api.v1.TranscriptionConfig
- 2, // 1: memos.api.v1.TranscribeRequest.audio:type_name -> memos.api.v1.TranscriptionAudio
- 0, // 2: memos.api.v1.AIService.Transcribe:input_type -> memos.api.v1.TranscribeRequest
- 3, // 3: memos.api.v1.AIService.Transcribe:output_type -> memos.api.v1.TranscribeResponse
- 3, // [3:4] is the sub-list for method output_type
- 2, // [2:3] is the sub-list for method input_type
- 2, // [2:2] is the sub-list for extension type_name
- 2, // [2:2] is the sub-list for extension extendee
- 0, // [0:2] is the sub-list for field type_name
+ 1, // 0: memos.api.v1.TranscribeRequest.audio:type_name -> memos.api.v1.TranscriptionAudio
+ 0, // 1: memos.api.v1.AIService.Transcribe:input_type -> memos.api.v1.TranscribeRequest
+ 2, // 2: memos.api.v1.AIService.Transcribe:output_type -> memos.api.v1.TranscribeResponse
+ 2, // [2:3] is the sub-list for method output_type
+ 1, // [1:2] is the sub-list for method input_type
+ 1, // [1:1] is the sub-list for extension type_name
+ 1, // [1:1] is the sub-list for extension extendee
+ 0, // [0:1] is the sub-list for field type_name
}
func init() { file_api_v1_ai_service_proto_init() }
@@ -348,7 +268,7 @@ func file_api_v1_ai_service_proto_init() {
if File_api_v1_ai_service_proto != nil {
return
}
- file_api_v1_ai_service_proto_msgTypes[2].OneofWrappers = []any{
+ file_api_v1_ai_service_proto_msgTypes[1].OneofWrappers = []any{
(*TranscriptionAudio_Content)(nil),
(*TranscriptionAudio_Uri)(nil),
}
@@ -358,7 +278,7 @@ func file_api_v1_ai_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_ai_service_proto_rawDesc), len(file_api_v1_ai_service_proto_rawDesc)),
NumEnums: 0,
- NumMessages: 4,
+ NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/gen/api/v1/instance_service.pb.go b/proto/gen/api/v1/instance_service.pb.go
index 593ae148b..312c13cb3 100644
--- a/proto/gen/api/v1/instance_service.pb.go
+++ b/proto/gen/api/v1/instance_service.pb.go
@@ -1137,7 +1137,10 @@ func (x *InstanceSetting_NotificationSetting) GetEmail() *InstanceSetting_Notifi
type InstanceSetting_AISetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
// providers is the list of AI provider configurations available instance-wide.
- Providers []*InstanceSetting_AIProviderConfig `protobuf:"bytes,1,rep,name=providers,proto3" json:"providers,omitempty"`
+ Providers []*InstanceSetting_AIProviderConfig `protobuf:"bytes,1,rep,name=providers,proto3" json:"providers,omitempty"`
+ // transcription is the speech-to-text feature configuration.
+ // When unset or transcription.provider_id is empty, transcription is disabled.
+ Transcription *InstanceSetting_TranscriptionConfig `protobuf:"bytes,2,opt,name=transcription,proto3" json:"transcription,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -1179,6 +1182,13 @@ func (x *InstanceSetting_AISetting) GetProviders() []*InstanceSetting_AIProvider
return nil
}
+func (x *InstanceSetting_AISetting) GetTranscription() *InstanceSetting_TranscriptionConfig {
+ if x != nil {
+ return x.Transcription
+ }
+ return nil
+}
+
// AIProviderConfig represents one callable AI provider connection.
type InstanceSetting_AIProviderConfig struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -1275,6 +1285,83 @@ func (x *InstanceSetting_AIProviderConfig) GetApiKeyHint() string {
return ""
}
+// TranscriptionConfig configures the speech-to-text feature.
+type InstanceSetting_TranscriptionConfig struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // provider_id references an entry in AISetting.providers[].id.
+ // Empty string means transcription is disabled.
+ ProviderId string `protobuf:"bytes,1,opt,name=provider_id,json=providerId,proto3" json:"provider_id,omitempty"`
+ // model is the provider-specific model identifier.
+ // Empty string falls back to the engine default
+ // (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers).
+ Model string `protobuf:"bytes,2,opt,name=model,proto3" json:"model,omitempty"`
+ // language is the default ISO 639-1 language hint sent to the provider.
+ // Empty string lets the provider auto-detect.
+ Language string `protobuf:"bytes,3,opt,name=language,proto3" json:"language,omitempty"`
+ // prompt is a default spelling/vocabulary hint passed to the provider.
+ Prompt string `protobuf:"bytes,4,opt,name=prompt,proto3" json:"prompt,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *InstanceSetting_TranscriptionConfig) Reset() {
+ *x = InstanceSetting_TranscriptionConfig{}
+ mi := &file_api_v1_instance_service_proto_msgTypes[16]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *InstanceSetting_TranscriptionConfig) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*InstanceSetting_TranscriptionConfig) ProtoMessage() {}
+
+func (x *InstanceSetting_TranscriptionConfig) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_instance_service_proto_msgTypes[16]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use InstanceSetting_TranscriptionConfig.ProtoReflect.Descriptor instead.
+func (*InstanceSetting_TranscriptionConfig) Descriptor() ([]byte, []int) {
+ return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 8}
+}
+
+func (x *InstanceSetting_TranscriptionConfig) GetProviderId() string {
+ if x != nil {
+ return x.ProviderId
+ }
+ return ""
+}
+
+func (x *InstanceSetting_TranscriptionConfig) GetModel() string {
+ if x != nil {
+ return x.Model
+ }
+ return ""
+}
+
+func (x *InstanceSetting_TranscriptionConfig) GetLanguage() string {
+ if x != nil {
+ return x.Language
+ }
+ return ""
+}
+
+func (x *InstanceSetting_TranscriptionConfig) GetPrompt() string {
+ if x != nil {
+ return x.Prompt
+ }
+ return ""
+}
+
// Custom profile configuration for instance branding.
type InstanceSetting_GeneralSetting_CustomProfile struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -1287,7 +1374,7 @@ type InstanceSetting_GeneralSetting_CustomProfile struct {
func (x *InstanceSetting_GeneralSetting_CustomProfile) Reset() {
*x = InstanceSetting_GeneralSetting_CustomProfile{}
- mi := &file_api_v1_instance_service_proto_msgTypes[16]
+ mi := &file_api_v1_instance_service_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1299,7 +1386,7 @@ func (x *InstanceSetting_GeneralSetting_CustomProfile) String() string {
func (*InstanceSetting_GeneralSetting_CustomProfile) ProtoMessage() {}
func (x *InstanceSetting_GeneralSetting_CustomProfile) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_instance_service_proto_msgTypes[16]
+ mi := &file_api_v1_instance_service_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1352,7 +1439,7 @@ type InstanceSetting_StorageSetting_S3Config struct {
func (x *InstanceSetting_StorageSetting_S3Config) Reset() {
*x = InstanceSetting_StorageSetting_S3Config{}
- mi := &file_api_v1_instance_service_proto_msgTypes[17]
+ mi := &file_api_v1_instance_service_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1364,7 +1451,7 @@ func (x *InstanceSetting_StorageSetting_S3Config) String() string {
func (*InstanceSetting_StorageSetting_S3Config) ProtoMessage() {}
func (x *InstanceSetting_StorageSetting_S3Config) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_instance_service_proto_msgTypes[17]
+ mi := &file_api_v1_instance_service_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1441,7 +1528,7 @@ type InstanceSetting_NotificationSetting_EmailSetting struct {
func (x *InstanceSetting_NotificationSetting_EmailSetting) Reset() {
*x = InstanceSetting_NotificationSetting_EmailSetting{}
- mi := &file_api_v1_instance_service_proto_msgTypes[19]
+ mi := &file_api_v1_instance_service_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1453,7 +1540,7 @@ func (x *InstanceSetting_NotificationSetting_EmailSetting) String() string {
func (*InstanceSetting_NotificationSetting_EmailSetting) ProtoMessage() {}
func (x *InstanceSetting_NotificationSetting_EmailSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_instance_service_proto_msgTypes[19]
+ mi := &file_api_v1_instance_service_proto_msgTypes[20]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1552,7 +1639,7 @@ type InstanceStats_DatabaseStats struct {
func (x *InstanceStats_DatabaseStats) Reset() {
*x = InstanceStats_DatabaseStats{}
- mi := &file_api_v1_instance_service_proto_msgTypes[20]
+ mi := &file_api_v1_instance_service_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1564,7 +1651,7 @@ func (x *InstanceStats_DatabaseStats) String() string {
func (*InstanceStats_DatabaseStats) ProtoMessage() {}
func (x *InstanceStats_DatabaseStats) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_instance_service_proto_msgTypes[20]
+ mi := &file_api_v1_instance_service_proto_msgTypes[21]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1605,7 +1692,7 @@ const file_api_v1_instance_service_proto_rawDesc = "" +
"\finstance_url\x18\x06 \x01(\tR\vinstanceUrl\x12(\n" +
"\x05admin\x18\a \x01(\v2\x12.memos.api.v1.UserR\x05admin\x12\x16\n" +
"\x06commit\x18\b \x01(\tR\x06commit\"\x1b\n" +
- "\x19GetInstanceProfileRequest\"\xf0\x19\n" +
+ "\x19GetInstanceProfileRequest\"\xcd\x1b\n" +
"\x0fInstanceSetting\x12\x17\n" +
"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12W\n" +
"\x0fgeneral_setting\x18\x02 \x01(\v2,.memos.api.v1.InstanceSetting.GeneralSettingH\x00R\x0egeneralSetting\x12W\n" +
@@ -1671,9 +1758,10 @@ const file_api_v1_instance_service_proto_rawDesc = "" +
"\breply_to\x18\b \x01(\tR\areplyTo\x12\x17\n" +
"\ause_tls\x18\t \x01(\bR\x06useTls\x12\x17\n" +
"\ause_ssl\x18\n" +
- " \x01(\bR\x06useSsl\x1aY\n" +
+ " \x01(\bR\x06useSsl\x1a\xb2\x01\n" +
"\tAISetting\x12L\n" +
- "\tproviders\x18\x01 \x03(\v2..memos.api.v1.InstanceSetting.AIProviderConfigR\tproviders\x1a\x80\x02\n" +
+ "\tproviders\x18\x01 \x03(\v2..memos.api.v1.InstanceSetting.AIProviderConfigR\tproviders\x12W\n" +
+ "\rtranscription\x18\x02 \x01(\v21.memos.api.v1.InstanceSetting.TranscriptionConfigR\rtranscription\x1a\x80\x02\n" +
"\x10AIProviderConfig\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" +
"\x05title\x18\x02 \x01(\tR\x05title\x12@\n" +
@@ -1682,7 +1770,13 @@ const file_api_v1_instance_service_proto_rawDesc = "" +
"\aapi_key\x18\x05 \x01(\tB\x03\xe0A\x04R\x06apiKey\x12#\n" +
"\vapi_key_set\x18\b \x01(\bB\x03\xe0A\x03R\tapiKeySet\x12%\n" +
"\fapi_key_hint\x18\t \x01(\tB\x03\xe0A\x03R\n" +
- "apiKeyHint\"j\n" +
+ "apiKeyHint\x1a\x80\x01\n" +
+ "\x13TranscriptionConfig\x12\x1f\n" +
+ "\vprovider_id\x18\x01 \x01(\tR\n" +
+ "providerId\x12\x14\n" +
+ "\x05model\x18\x02 \x01(\tR\x05model\x12\x1a\n" +
+ "\blanguage\x18\x03 \x01(\tR\blanguage\x12\x16\n" +
+ "\x06prompt\x18\x04 \x01(\tR\x06prompt\"j\n" +
"\x03Key\x12\x13\n" +
"\x0fKEY_UNSPECIFIED\x10\x00\x12\v\n" +
"\aGENERAL\x10\x01\x12\v\n" +
@@ -1739,7 +1833,7 @@ func file_api_v1_instance_service_proto_rawDescGZIP() []byte {
}
var file_api_v1_instance_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
-var file_api_v1_instance_service_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
+var file_api_v1_instance_service_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_api_v1_instance_service_proto_goTypes = []any{
(InstanceSetting_Key)(0), // 0: memos.api.v1.InstanceSetting.Key
(InstanceSetting_AIProviderType)(0), // 1: memos.api.v1.InstanceSetting.AIProviderType
@@ -1760,19 +1854,20 @@ var file_api_v1_instance_service_proto_goTypes = []any{
(*InstanceSetting_NotificationSetting)(nil), // 16: memos.api.v1.InstanceSetting.NotificationSetting
(*InstanceSetting_AISetting)(nil), // 17: memos.api.v1.InstanceSetting.AISetting
(*InstanceSetting_AIProviderConfig)(nil), // 18: memos.api.v1.InstanceSetting.AIProviderConfig
- (*InstanceSetting_GeneralSetting_CustomProfile)(nil), // 19: memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile
- (*InstanceSetting_StorageSetting_S3Config)(nil), // 20: memos.api.v1.InstanceSetting.StorageSetting.S3Config
- nil, // 21: memos.api.v1.InstanceSetting.TagsSetting.TagsEntry
- (*InstanceSetting_NotificationSetting_EmailSetting)(nil), // 22: memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting
- (*InstanceStats_DatabaseStats)(nil), // 23: memos.api.v1.InstanceStats.DatabaseStats
- (*User)(nil), // 24: memos.api.v1.User
- (*fieldmaskpb.FieldMask)(nil), // 25: google.protobuf.FieldMask
- (*timestamppb.Timestamp)(nil), // 26: google.protobuf.Timestamp
- (*color.Color)(nil), // 27: google.type.Color
- (*emptypb.Empty)(nil), // 28: google.protobuf.Empty
+ (*InstanceSetting_TranscriptionConfig)(nil), // 19: memos.api.v1.InstanceSetting.TranscriptionConfig
+ (*InstanceSetting_GeneralSetting_CustomProfile)(nil), // 20: memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile
+ (*InstanceSetting_StorageSetting_S3Config)(nil), // 21: memos.api.v1.InstanceSetting.StorageSetting.S3Config
+ nil, // 22: memos.api.v1.InstanceSetting.TagsSetting.TagsEntry
+ (*InstanceSetting_NotificationSetting_EmailSetting)(nil), // 23: memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting
+ (*InstanceStats_DatabaseStats)(nil), // 24: memos.api.v1.InstanceStats.DatabaseStats
+ (*User)(nil), // 25: memos.api.v1.User
+ (*fieldmaskpb.FieldMask)(nil), // 26: google.protobuf.FieldMask
+ (*timestamppb.Timestamp)(nil), // 27: google.protobuf.Timestamp
+ (*color.Color)(nil), // 28: google.type.Color
+ (*emptypb.Empty)(nil), // 29: google.protobuf.Empty
}
var file_api_v1_instance_service_proto_depIdxs = []int32{
- 24, // 0: memos.api.v1.InstanceProfile.admin:type_name -> memos.api.v1.User
+ 25, // 0: memos.api.v1.InstanceProfile.admin:type_name -> memos.api.v1.User
11, // 1: memos.api.v1.InstanceSetting.general_setting:type_name -> memos.api.v1.InstanceSetting.GeneralSetting
12, // 2: memos.api.v1.InstanceSetting.storage_setting:type_name -> memos.api.v1.InstanceSetting.StorageSetting
13, // 3: memos.api.v1.InstanceSetting.memo_related_setting:type_name -> memos.api.v1.InstanceSetting.MemoRelatedSetting
@@ -1780,34 +1875,35 @@ var file_api_v1_instance_service_proto_depIdxs = []int32{
16, // 5: memos.api.v1.InstanceSetting.notification_setting:type_name -> memos.api.v1.InstanceSetting.NotificationSetting
17, // 6: memos.api.v1.InstanceSetting.ai_setting:type_name -> memos.api.v1.InstanceSetting.AISetting
5, // 7: memos.api.v1.UpdateInstanceSettingRequest.setting:type_name -> memos.api.v1.InstanceSetting
- 25, // 8: memos.api.v1.UpdateInstanceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
- 22, // 9: memos.api.v1.TestInstanceEmailSettingRequest.email:type_name -> memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting
- 23, // 10: memos.api.v1.InstanceStats.database:type_name -> memos.api.v1.InstanceStats.DatabaseStats
- 26, // 11: memos.api.v1.InstanceStats.generated_time:type_name -> google.protobuf.Timestamp
- 19, // 12: memos.api.v1.InstanceSetting.GeneralSetting.custom_profile:type_name -> memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile
+ 26, // 8: memos.api.v1.UpdateInstanceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 23, // 9: memos.api.v1.TestInstanceEmailSettingRequest.email:type_name -> memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting
+ 24, // 10: memos.api.v1.InstanceStats.database:type_name -> memos.api.v1.InstanceStats.DatabaseStats
+ 27, // 11: memos.api.v1.InstanceStats.generated_time:type_name -> google.protobuf.Timestamp
+ 20, // 12: memos.api.v1.InstanceSetting.GeneralSetting.custom_profile:type_name -> memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile
2, // 13: memos.api.v1.InstanceSetting.StorageSetting.storage_type:type_name -> memos.api.v1.InstanceSetting.StorageSetting.StorageType
- 20, // 14: memos.api.v1.InstanceSetting.StorageSetting.s3_config:type_name -> memos.api.v1.InstanceSetting.StorageSetting.S3Config
- 27, // 15: memos.api.v1.InstanceSetting.TagMetadata.background_color:type_name -> google.type.Color
- 21, // 16: memos.api.v1.InstanceSetting.TagsSetting.tags:type_name -> memos.api.v1.InstanceSetting.TagsSetting.TagsEntry
- 22, // 17: memos.api.v1.InstanceSetting.NotificationSetting.email:type_name -> memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting
+ 21, // 14: memos.api.v1.InstanceSetting.StorageSetting.s3_config:type_name -> memos.api.v1.InstanceSetting.StorageSetting.S3Config
+ 28, // 15: memos.api.v1.InstanceSetting.TagMetadata.background_color:type_name -> google.type.Color
+ 22, // 16: memos.api.v1.InstanceSetting.TagsSetting.tags:type_name -> memos.api.v1.InstanceSetting.TagsSetting.TagsEntry
+ 23, // 17: memos.api.v1.InstanceSetting.NotificationSetting.email:type_name -> memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting
18, // 18: memos.api.v1.InstanceSetting.AISetting.providers:type_name -> memos.api.v1.InstanceSetting.AIProviderConfig
- 1, // 19: memos.api.v1.InstanceSetting.AIProviderConfig.type:type_name -> memos.api.v1.InstanceSetting.AIProviderType
- 14, // 20: memos.api.v1.InstanceSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.v1.InstanceSetting.TagMetadata
- 4, // 21: memos.api.v1.InstanceService.GetInstanceProfile:input_type -> memos.api.v1.GetInstanceProfileRequest
- 6, // 22: memos.api.v1.InstanceService.GetInstanceSetting:input_type -> memos.api.v1.GetInstanceSettingRequest
- 7, // 23: memos.api.v1.InstanceService.UpdateInstanceSetting:input_type -> memos.api.v1.UpdateInstanceSettingRequest
- 8, // 24: memos.api.v1.InstanceService.TestInstanceEmailSetting:input_type -> memos.api.v1.TestInstanceEmailSettingRequest
- 9, // 25: memos.api.v1.InstanceService.GetInstanceStats:input_type -> memos.api.v1.GetInstanceStatsRequest
- 3, // 26: memos.api.v1.InstanceService.GetInstanceProfile:output_type -> memos.api.v1.InstanceProfile
- 5, // 27: memos.api.v1.InstanceService.GetInstanceSetting:output_type -> memos.api.v1.InstanceSetting
- 5, // 28: memos.api.v1.InstanceService.UpdateInstanceSetting:output_type -> memos.api.v1.InstanceSetting
- 28, // 29: memos.api.v1.InstanceService.TestInstanceEmailSetting:output_type -> google.protobuf.Empty
- 10, // 30: memos.api.v1.InstanceService.GetInstanceStats:output_type -> memos.api.v1.InstanceStats
- 26, // [26:31] is the sub-list for method output_type
- 21, // [21:26] is the sub-list for method input_type
- 21, // [21:21] is the sub-list for extension type_name
- 21, // [21:21] is the sub-list for extension extendee
- 0, // [0:21] is the sub-list for field type_name
+ 19, // 19: memos.api.v1.InstanceSetting.AISetting.transcription:type_name -> memos.api.v1.InstanceSetting.TranscriptionConfig
+ 1, // 20: memos.api.v1.InstanceSetting.AIProviderConfig.type:type_name -> memos.api.v1.InstanceSetting.AIProviderType
+ 14, // 21: memos.api.v1.InstanceSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.v1.InstanceSetting.TagMetadata
+ 4, // 22: memos.api.v1.InstanceService.GetInstanceProfile:input_type -> memos.api.v1.GetInstanceProfileRequest
+ 6, // 23: memos.api.v1.InstanceService.GetInstanceSetting:input_type -> memos.api.v1.GetInstanceSettingRequest
+ 7, // 24: memos.api.v1.InstanceService.UpdateInstanceSetting:input_type -> memos.api.v1.UpdateInstanceSettingRequest
+ 8, // 25: memos.api.v1.InstanceService.TestInstanceEmailSetting:input_type -> memos.api.v1.TestInstanceEmailSettingRequest
+ 9, // 26: memos.api.v1.InstanceService.GetInstanceStats:input_type -> memos.api.v1.GetInstanceStatsRequest
+ 3, // 27: memos.api.v1.InstanceService.GetInstanceProfile:output_type -> memos.api.v1.InstanceProfile
+ 5, // 28: memos.api.v1.InstanceService.GetInstanceSetting:output_type -> memos.api.v1.InstanceSetting
+ 5, // 29: memos.api.v1.InstanceService.UpdateInstanceSetting:output_type -> memos.api.v1.InstanceSetting
+ 29, // 30: memos.api.v1.InstanceService.TestInstanceEmailSetting:output_type -> google.protobuf.Empty
+ 10, // 31: memos.api.v1.InstanceService.GetInstanceStats:output_type -> memos.api.v1.InstanceStats
+ 27, // [27:32] is the sub-list for method output_type
+ 22, // [22:27] is the sub-list for method input_type
+ 22, // [22:22] is the sub-list for extension type_name
+ 22, // [22:22] is the sub-list for extension extendee
+ 0, // [0:22] is the sub-list for field type_name
}
func init() { file_api_v1_instance_service_proto_init() }
@@ -1830,7 +1926,7 @@ func file_api_v1_instance_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_instance_service_proto_rawDesc), len(file_api_v1_instance_service_proto_rawDesc)),
NumEnums: 3,
- NumMessages: 21,
+ NumMessages: 22,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yaml
index 50668ccaf..3610c6e4a 100644
--- a/proto/gen/openapi.yaml
+++ b/proto/gen/openapi.yaml
@@ -2701,6 +2701,12 @@ components:
items:
$ref: '#/components/schemas/InstanceSetting_AIProviderConfig'
description: providers is the list of AI provider configurations available instance-wide.
+ transcription:
+ allOf:
+ - $ref: '#/components/schemas/InstanceSetting_TranscriptionConfig'
+ description: |-
+ transcription is the speech-to-text feature configuration.
+ When unset or transcription.provider_id is empty, transcription is disabled.
description: AI provider configuration settings.
InstanceSetting_GeneralSetting:
type: object
@@ -2808,6 +2814,29 @@ components:
so a single entry like "project/.*" matches all tags under that prefix.
Exact tag names are also valid (they are trivially valid regex patterns).
description: Tag metadata configuration.
+ InstanceSetting_TranscriptionConfig:
+ type: object
+ properties:
+ providerId:
+ type: string
+ description: |-
+ provider_id references an entry in AISetting.providers[].id.
+ Empty string means transcription is disabled.
+ model:
+ type: string
+ description: |-
+ model is the provider-specific model identifier.
+ Empty string falls back to the engine default
+ (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers).
+ language:
+ type: string
+ description: |-
+ language is the default ISO 639-1 language hint sent to the provider.
+ Empty string lets the provider auto-detect.
+ prompt:
+ type: string
+ description: prompt is a default spelling/vocabulary hint passed to the provider.
+ description: TranscriptionConfig configures the speech-to-text feature.
InstanceStats:
type: object
properties:
@@ -3538,18 +3567,9 @@ components:
description: Request message for TestInstanceEmailSetting method.
TranscribeRequest:
required:
- - providerId
- - config
- audio
type: object
properties:
- providerId:
- type: string
- description: Required. The instance AI provider ID to use.
- config:
- allOf:
- - $ref: '#/components/schemas/TranscriptionConfig'
- description: Required. Transcription options.
audio:
allOf:
- $ref: '#/components/schemas/TranscriptionAudio'
@@ -3577,15 +3597,6 @@ components:
contentType:
type: string
description: Optional. The MIME type of the input audio.
- TranscriptionConfig:
- type: object
- properties:
- prompt:
- type: string
- description: Optional. A prompt to improve transcription quality.
- language:
- type: string
- description: Optional. The language of the input audio.
UpsertMemoReactionRequest:
required:
- name
diff --git a/proto/gen/store/instance_setting.pb.go b/proto/gen/store/instance_setting.pb.go
index e0f08e75f..9514295f6 100644
--- a/proto/gen/store/instance_setting.pb.go
+++ b/proto/gen/store/instance_setting.pb.go
@@ -962,7 +962,10 @@ func (x *InstanceNotificationSetting) GetEmail() *InstanceNotificationSetting_Em
type InstanceAISetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
// providers is the list of AI provider configurations available instance-wide.
- Providers []*AIProviderConfig `protobuf:"bytes,1,rep,name=providers,proto3" json:"providers,omitempty"`
+ Providers []*AIProviderConfig `protobuf:"bytes,1,rep,name=providers,proto3" json:"providers,omitempty"`
+ // transcription is the speech-to-text feature configuration.
+ // When unset or transcription.provider_id is empty, transcription is disabled.
+ Transcription *TranscriptionConfig `protobuf:"bytes,2,opt,name=transcription,proto3" json:"transcription,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -1004,6 +1007,13 @@ func (x *InstanceAISetting) GetProviders() []*AIProviderConfig {
return nil
}
+func (x *InstanceAISetting) GetTranscription() *TranscriptionConfig {
+ if x != nil {
+ return x.Transcription
+ }
+ return nil
+}
+
type AIProviderConfig struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
@@ -1081,6 +1091,85 @@ func (x *AIProviderConfig) GetApiKey() string {
return ""
}
+// TranscriptionConfig configures the speech-to-text feature.
+type TranscriptionConfig struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // provider_id references an entry in InstanceAISetting.providers[].id.
+ // Empty string means transcription is disabled.
+ ProviderId string `protobuf:"bytes,1,opt,name=provider_id,json=providerId,proto3" json:"provider_id,omitempty"`
+ // model is the provider-specific model identifier.
+ // Empty string falls back to the engine default
+ // (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers).
+ Model string `protobuf:"bytes,2,opt,name=model,proto3" json:"model,omitempty"`
+ // language is the default ISO 639-1 language hint sent to the provider.
+ // Empty string lets the provider auto-detect.
+ Language string `protobuf:"bytes,3,opt,name=language,proto3" json:"language,omitempty"`
+ // prompt is a default spelling/vocabulary hint passed to the provider.
+ // Used as the OpenAI Whisper "prompt" parameter and folded into the Gemini
+ // generation prompt as a "Context and spelling hints" block.
+ Prompt string `protobuf:"bytes,4,opt,name=prompt,proto3" json:"prompt,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *TranscriptionConfig) Reset() {
+ *x = TranscriptionConfig{}
+ mi := &file_store_instance_setting_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *TranscriptionConfig) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TranscriptionConfig) ProtoMessage() {}
+
+func (x *TranscriptionConfig) ProtoReflect() protoreflect.Message {
+ mi := &file_store_instance_setting_proto_msgTypes[12]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use TranscriptionConfig.ProtoReflect.Descriptor instead.
+func (*TranscriptionConfig) Descriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *TranscriptionConfig) GetProviderId() string {
+ if x != nil {
+ return x.ProviderId
+ }
+ return ""
+}
+
+func (x *TranscriptionConfig) GetModel() string {
+ if x != nil {
+ return x.Model
+ }
+ return ""
+}
+
+func (x *TranscriptionConfig) GetLanguage() string {
+ if x != nil {
+ return x.Language
+ }
+ return ""
+}
+
+func (x *TranscriptionConfig) GetPrompt() string {
+ if x != nil {
+ return x.Prompt
+ }
+ return ""
+}
+
type InstanceNotificationSetting_EmailSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
@@ -1099,7 +1188,7 @@ type InstanceNotificationSetting_EmailSetting struct {
func (x *InstanceNotificationSetting_EmailSetting) Reset() {
*x = InstanceNotificationSetting_EmailSetting{}
- mi := &file_store_instance_setting_proto_msgTypes[13]
+ mi := &file_store_instance_setting_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1111,7 +1200,7 @@ func (x *InstanceNotificationSetting_EmailSetting) String() string {
func (*InstanceNotificationSetting_EmailSetting) ProtoMessage() {}
func (x *InstanceNotificationSetting_EmailSetting) ProtoReflect() protoreflect.Message {
- mi := &file_store_instance_setting_proto_msgTypes[13]
+ mi := &file_store_instance_setting_proto_msgTypes[14]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1273,15 +1362,22 @@ const file_store_instance_setting_proto_rawDesc = "" +
"\breply_to\x18\b \x01(\tR\areplyTo\x12\x17\n" +
"\ause_tls\x18\t \x01(\bR\x06useTls\x12\x17\n" +
"\ause_ssl\x18\n" +
- " \x01(\bR\x06useSsl\"P\n" +
+ " \x01(\bR\x06useSsl\"\x98\x01\n" +
"\x11InstanceAISetting\x12;\n" +
- "\tproviders\x18\x01 \x03(\v2\x1d.memos.store.AIProviderConfigR\tproviders\"\x9e\x01\n" +
+ "\tproviders\x18\x01 \x03(\v2\x1d.memos.store.AIProviderConfigR\tproviders\x12F\n" +
+ "\rtranscription\x18\x02 \x01(\v2 .memos.store.TranscriptionConfigR\rtranscription\"\x9e\x01\n" +
"\x10AIProviderConfig\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" +
"\x05title\x18\x02 \x01(\tR\x05title\x12/\n" +
"\x04type\x18\x03 \x01(\x0e2\x1b.memos.store.AIProviderTypeR\x04type\x12\x1a\n" +
"\bendpoint\x18\x04 \x01(\tR\bendpoint\x12\x17\n" +
- "\aapi_key\x18\x05 \x01(\tR\x06apiKey*\x95\x01\n" +
+ "\aapi_key\x18\x05 \x01(\tR\x06apiKey\"\x80\x01\n" +
+ "\x13TranscriptionConfig\x12\x1f\n" +
+ "\vprovider_id\x18\x01 \x01(\tR\n" +
+ "providerId\x12\x14\n" +
+ "\x05model\x18\x02 \x01(\tR\x05model\x12\x1a\n" +
+ "\blanguage\x18\x03 \x01(\tR\blanguage\x12\x16\n" +
+ "\x06prompt\x18\x04 \x01(\tR\x06prompt*\x95\x01\n" +
"\x12InstanceSettingKey\x12$\n" +
" INSTANCE_SETTING_KEY_UNSPECIFIED\x10\x00\x12\t\n" +
"\x05BASIC\x10\x01\x12\v\n" +
@@ -1312,7 +1408,7 @@ func file_store_instance_setting_proto_rawDescGZIP() []byte {
}
var file_store_instance_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
-var file_store_instance_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
+var file_store_instance_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_store_instance_setting_proto_goTypes = []any{
(InstanceSettingKey)(0), // 0: memos.store.InstanceSettingKey
(AIProviderType)(0), // 1: memos.store.AIProviderType
@@ -1329,9 +1425,10 @@ var file_store_instance_setting_proto_goTypes = []any{
(*InstanceNotificationSetting)(nil), // 12: memos.store.InstanceNotificationSetting
(*InstanceAISetting)(nil), // 13: memos.store.InstanceAISetting
(*AIProviderConfig)(nil), // 14: memos.store.AIProviderConfig
- nil, // 15: memos.store.InstanceTagsSetting.TagsEntry
- (*InstanceNotificationSetting_EmailSetting)(nil), // 16: memos.store.InstanceNotificationSetting.EmailSetting
- (*color.Color)(nil), // 17: google.type.Color
+ (*TranscriptionConfig)(nil), // 15: memos.store.TranscriptionConfig
+ nil, // 16: memos.store.InstanceTagsSetting.TagsEntry
+ (*InstanceNotificationSetting_EmailSetting)(nil), // 17: memos.store.InstanceNotificationSetting.EmailSetting
+ (*color.Color)(nil), // 18: google.type.Color
}
var file_store_instance_setting_proto_depIdxs = []int32{
0, // 0: memos.store.InstanceSetting.key:type_name -> memos.store.InstanceSettingKey
@@ -1345,17 +1442,18 @@ var file_store_instance_setting_proto_depIdxs = []int32{
6, // 8: memos.store.InstanceGeneralSetting.custom_profile:type_name -> memos.store.InstanceCustomProfile
2, // 9: memos.store.InstanceStorageSetting.storage_type:type_name -> memos.store.InstanceStorageSetting.StorageType
8, // 10: memos.store.InstanceStorageSetting.s3_config:type_name -> memos.store.StorageS3Config
- 17, // 11: memos.store.InstanceTagMetadata.background_color:type_name -> google.type.Color
- 15, // 12: memos.store.InstanceTagsSetting.tags:type_name -> memos.store.InstanceTagsSetting.TagsEntry
- 16, // 13: memos.store.InstanceNotificationSetting.email:type_name -> memos.store.InstanceNotificationSetting.EmailSetting
+ 18, // 11: memos.store.InstanceTagMetadata.background_color:type_name -> google.type.Color
+ 16, // 12: memos.store.InstanceTagsSetting.tags:type_name -> memos.store.InstanceTagsSetting.TagsEntry
+ 17, // 13: memos.store.InstanceNotificationSetting.email:type_name -> memos.store.InstanceNotificationSetting.EmailSetting
14, // 14: memos.store.InstanceAISetting.providers:type_name -> memos.store.AIProviderConfig
- 1, // 15: memos.store.AIProviderConfig.type:type_name -> memos.store.AIProviderType
- 10, // 16: memos.store.InstanceTagsSetting.TagsEntry.value:type_name -> memos.store.InstanceTagMetadata
- 17, // [17:17] is the sub-list for method output_type
- 17, // [17:17] is the sub-list for method input_type
- 17, // [17:17] is the sub-list for extension type_name
- 17, // [17:17] is the sub-list for extension extendee
- 0, // [0:17] is the sub-list for field type_name
+ 15, // 15: memos.store.InstanceAISetting.transcription:type_name -> memos.store.TranscriptionConfig
+ 1, // 16: memos.store.AIProviderConfig.type:type_name -> memos.store.AIProviderType
+ 10, // 17: memos.store.InstanceTagsSetting.TagsEntry.value:type_name -> memos.store.InstanceTagMetadata
+ 18, // [18:18] is the sub-list for method output_type
+ 18, // [18:18] is the sub-list for method input_type
+ 18, // [18:18] is the sub-list for extension type_name
+ 18, // [18:18] is the sub-list for extension extendee
+ 0, // [0:18] is the sub-list for field type_name
}
func init() { file_store_instance_setting_proto_init() }
@@ -1378,7 +1476,7 @@ func file_store_instance_setting_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_instance_setting_proto_rawDesc), len(file_store_instance_setting_proto_rawDesc)),
NumEnums: 3,
- NumMessages: 14,
+ NumMessages: 15,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/proto/store/instance_setting.proto b/proto/store/instance_setting.proto
index 6d63e5182..5feea68f3 100644
--- a/proto/store/instance_setting.proto
+++ b/proto/store/instance_setting.proto
@@ -149,6 +149,10 @@ message InstanceNotificationSetting {
message InstanceAISetting {
// providers is the list of AI provider configurations available instance-wide.
repeated AIProviderConfig providers = 1;
+
+ // transcription is the speech-to-text feature configuration.
+ // When unset or transcription.provider_id is empty, transcription is disabled.
+ TranscriptionConfig transcription = 2;
}
message AIProviderConfig {
@@ -165,3 +169,24 @@ enum AIProviderType {
OPENAI = 1;
GEMINI = 2;
}
+
+// TranscriptionConfig configures the speech-to-text feature.
+message TranscriptionConfig {
+ // provider_id references an entry in InstanceAISetting.providers[].id.
+ // Empty string means transcription is disabled.
+ string provider_id = 1;
+
+ // model is the provider-specific model identifier.
+ // Empty string falls back to the engine default
+ // (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers).
+ string model = 2;
+
+ // language is the default ISO 639-1 language hint sent to the provider.
+ // Empty string lets the provider auto-detect.
+ string language = 3;
+
+ // prompt is a default spelling/vocabulary hint passed to the provider.
+ // Used as the OpenAI Whisper "prompt" parameter and folded into the Gemini
+ // generation prompt as a "Context and spelling hints" block.
+ string prompt = 4;
+}
diff --git a/server/router/api/v1/ai_service.go b/server/router/api/v1/ai_service.go
index ad70b6e3f..35a094ea4 100644
--- a/server/router/api/v1/ai_service.go
+++ b/server/router/api/v1/ai_service.go
@@ -17,8 +17,6 @@ import (
const (
maxTranscriptionAudioSizeBytes = 25 * MebiByte
- maxTranscriptionPromptLength = 4096
- maxTranscriptionLanguageLength = 32
maxTranscriptionFilenameLength = 255
)
@@ -51,20 +49,6 @@ func (s *APIV1Service) Transcribe(ctx context.Context, request *v1pb.TranscribeR
return nil, status.Errorf(codes.Unauthenticated, "user not authenticated")
}
- if strings.TrimSpace(request.ProviderId) == "" {
- return nil, status.Errorf(codes.InvalidArgument, "provider_id is required")
- }
- if request.Config == nil {
- return nil, status.Errorf(codes.InvalidArgument, "config is required")
- }
- prompt := strings.TrimSpace(request.Config.GetPrompt())
- if len(prompt) > maxTranscriptionPromptLength {
- return nil, status.Errorf(codes.InvalidArgument, "prompt is too long; maximum length is %d characters", maxTranscriptionPromptLength)
- }
- language := strings.TrimSpace(request.Config.GetLanguage())
- if len(language) > maxTranscriptionLanguageLength {
- return nil, status.Errorf(codes.InvalidArgument, "language is too long; maximum length is %d characters", maxTranscriptionLanguageLength)
- }
if request.Audio == nil {
return nil, status.Errorf(codes.InvalidArgument, "audio is required")
}
@@ -90,10 +74,31 @@ func (s *APIV1Service) Transcribe(ctx context.Context, request *v1pb.TranscribeR
return nil, status.Errorf(codes.InvalidArgument, "audio content type %q is not supported", contentType)
}
- provider, model, err := s.resolveAIProviderForTranscription(ctx, request.ProviderId)
+ aiSetting, err := s.Store.GetInstanceAISetting(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get AI setting: %v", err)
+ }
+ persisted := aiSetting.GetTranscription()
+
+ providerID := persisted.GetProviderId()
+ if providerID == "" {
+ return nil, status.Errorf(codes.FailedPrecondition, "transcription is not configured")
+ }
+
+ provider, err := s.resolveAIProvider(aiSetting, providerID)
if err != nil {
return nil, err
}
+
+ model := persisted.GetModel()
+ if model == "" {
+ defaultModel, err := ai.DefaultTranscriptionModel(provider.Type)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ model = defaultModel
+ }
+
transcriber, err := ai.NewTranscriber(provider)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "failed to create AI transcriber: %v", err)
@@ -105,8 +110,8 @@ func (s *APIV1Service) Transcribe(ctx context.Context, request *v1pb.TranscribeR
ContentType: contentType,
Audio: bytes.NewReader(content),
Size: int64(len(content)),
- Prompt: prompt,
- Language: language,
+ Prompt: persisted.GetPrompt(),
+ Language: persisted.GetLanguage(),
})
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to transcribe audio: %v", err)
@@ -116,12 +121,7 @@ func (s *APIV1Service) Transcribe(ctx context.Context, request *v1pb.TranscribeR
}, nil
}
-func (s *APIV1Service) resolveAIProviderForTranscription(ctx context.Context, providerID string) (ai.ProviderConfig, string, error) {
- setting, err := s.Store.GetInstanceAISetting(ctx)
- if err != nil {
- return ai.ProviderConfig{}, "", status.Errorf(codes.Internal, "failed to get AI setting: %v", err)
- }
-
+func (*APIV1Service) resolveAIProvider(setting *storepb.InstanceAISetting, providerID string) (ai.ProviderConfig, error) {
providers := make([]ai.ProviderConfig, 0, len(setting.GetProviders()))
for _, provider := range setting.GetProviders() {
if provider == nil {
@@ -132,13 +132,9 @@ func (s *APIV1Service) resolveAIProviderForTranscription(ctx context.Context, pr
provider, err := ai.FindProvider(providers, providerID)
if err != nil {
- return ai.ProviderConfig{}, "", status.Errorf(codes.NotFound, "AI provider not found")
- }
- selectedModel, err := ai.DefaultTranscriptionModel(provider.Type)
- if err != nil {
- return ai.ProviderConfig{}, "", status.Errorf(codes.InvalidArgument, "%v", err)
+ return ai.ProviderConfig{}, status.Errorf(codes.FailedPrecondition, "transcription provider is not configured")
}
- return *provider, selectedModel, nil
+ return *provider, nil
}
func convertAIProviderConfigFromStore(provider *storepb.AIProviderConfig) ai.ProviderConfig {
diff --git a/server/router/api/v1/instance_service.go b/server/router/api/v1/instance_service.go
index 7a89ec38e..3d0cfa2cf 100644
--- a/server/router/api/v1/instance_service.go
+++ b/server/router/api/v1/instance_service.go
@@ -20,6 +20,12 @@ import (
"github.com/usememos/memos/store"
)
+const (
+ maxTranscriptionConfigModelLength = 256
+ maxTranscriptionConfigLanguageLength = 32
+ maxTranscriptionConfigPromptLength = 4096
+)
+
// GetInstanceProfile returns the instance profile.
func (s *APIV1Service) GetInstanceProfile(ctx context.Context, _ *v1pb.GetInstanceProfileRequest) (*v1pb.InstanceProfile, error) {
admin, err := s.GetInstanceAdmin(ctx)
@@ -91,6 +97,7 @@ func (s *APIV1Service) GetInstanceSetting(ctx context.Context, request *v1pb.Get
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
}
}
+ isAdminCaller := false
if instanceSetting.Key == storepb.InstanceSettingKey_AI {
user, err := s.fetchCurrentUser(ctx)
if err != nil {
@@ -99,9 +106,22 @@ func (s *APIV1Service) GetInstanceSetting(ctx context.Context, request *v1pb.Get
if user == nil {
return nil, status.Errorf(codes.Unauthenticated, "user not authenticated")
}
+ isAdminCaller = user.Role == store.RoleAdmin
}
- return convertInstanceSettingFromStore(instanceSetting), nil
+ result := convertInstanceSettingFromStore(instanceSetting)
+ if instanceSetting.Key == storepb.InstanceSettingKey_AI && !isAdminCaller {
+ // Non-admin callers only need transcription.provider_id to gate the
+ // editor's Transcribe button. Model / language / prompt are
+ // admin-entered defaults that may contain proprietary glossary terms,
+ // so they are redacted from non-admin responses.
+ if ai := result.GetAiSetting(); ai != nil && ai.Transcription != nil {
+ ai.Transcription.Model = ""
+ ai.Transcription.Language = ""
+ ai.Transcription.Prompt = ""
+ }
+ }
+ return result, nil
}
func (s *APIV1Service) UpdateInstanceSetting(ctx context.Context, request *v1pb.UpdateInstanceSettingRequest) (*v1pb.InstanceSetting, error) {
@@ -508,7 +528,8 @@ func convertInstanceAISettingFromStore(setting *storepb.InstanceAISetting) *v1pb
}
aiSetting := &v1pb.InstanceSetting_AISetting{
- Providers: make([]*v1pb.InstanceSetting_AIProviderConfig, 0, len(setting.Providers)),
+ Providers: make([]*v1pb.InstanceSetting_AIProviderConfig, 0, len(setting.Providers)),
+ Transcription: convertTranscriptionConfigFromStore(setting.GetTranscription()),
}
for _, provider := range setting.Providers {
if provider == nil {
@@ -533,7 +554,8 @@ func convertInstanceAISettingToStore(setting *v1pb.InstanceSetting_AISetting) *s
}
aiSetting := &storepb.InstanceAISetting{
- Providers: make([]*storepb.AIProviderConfig, 0, len(setting.Providers)),
+ Providers: make([]*storepb.AIProviderConfig, 0, len(setting.Providers)),
+ Transcription: convertTranscriptionConfigToStore(setting.GetTranscription()),
}
for _, provider := range setting.Providers {
if provider == nil {
@@ -550,6 +572,30 @@ func convertInstanceAISettingToStore(setting *v1pb.InstanceSetting_AISetting) *s
return aiSetting
}
+func convertTranscriptionConfigFromStore(setting *storepb.TranscriptionConfig) *v1pb.InstanceSetting_TranscriptionConfig {
+ if setting == nil {
+ return nil
+ }
+ return &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: setting.GetProviderId(),
+ Model: setting.GetModel(),
+ Language: setting.GetLanguage(),
+ Prompt: setting.GetPrompt(),
+ }
+}
+
+func convertTranscriptionConfigToStore(setting *v1pb.InstanceSetting_TranscriptionConfig) *storepb.TranscriptionConfig {
+ if setting == nil {
+ return nil
+ }
+ return &storepb.TranscriptionConfig{
+ ProviderId: setting.GetProviderId(),
+ Model: setting.GetModel(),
+ Language: setting.GetLanguage(),
+ Prompt: setting.GetPrompt(),
+ }
+}
+
func validateInstanceSetting(setting *v1pb.InstanceSetting) error {
key, err := ExtractInstanceSettingKeyFromName(setting.Name)
if err != nil {
@@ -619,6 +665,53 @@ func (s *APIV1Service) prepareInstanceAISettingForUpdate(ctx context.Context, se
return errors.Errorf("provider %q API key is required", provider.Id)
}
}
+
+ if err := preparePersistedTranscriptionConfig(setting, existing); err != nil {
+ return err
+ }
+ return nil
+}
+
+func preparePersistedTranscriptionConfig(setting *storepb.InstanceAISetting, existing *storepb.InstanceAISetting) error {
+ // Preserve the previously stored transcription config when the request omits it,
+ // matching the same "absence == keep" semantics used for API keys. The preserved
+ // config still falls through to validation below, so a stale provider_id is
+ // rejected if the same update removed or renamed its referenced provider.
+ if setting.Transcription == nil && existing != nil {
+ setting.Transcription = existing.GetTranscription()
+ }
+ if setting.Transcription == nil {
+ return nil
+ }
+
+ cfg := setting.Transcription
+ cfg.ProviderId = strings.TrimSpace(cfg.ProviderId)
+ cfg.Model = strings.TrimSpace(cfg.Model)
+ cfg.Language = strings.TrimSpace(cfg.Language)
+ cfg.Prompt = strings.TrimSpace(cfg.Prompt)
+
+ if cfg.ProviderId != "" {
+ referenced := false
+ for _, provider := range setting.Providers {
+ if provider != nil && provider.Id == cfg.ProviderId {
+ referenced = true
+ break
+ }
+ }
+ if !referenced {
+ return errors.Errorf("transcription provider_id %q does not reference any configured provider", cfg.ProviderId)
+ }
+ }
+
+ if len(cfg.Model) > maxTranscriptionConfigModelLength {
+ return errors.Errorf("transcription model is too long; maximum length is %d characters", maxTranscriptionConfigModelLength)
+ }
+ if len(cfg.Language) > maxTranscriptionConfigLanguageLength {
+ return errors.Errorf("transcription language is too long; maximum length is %d characters", maxTranscriptionConfigLanguageLength)
+ }
+ if len(cfg.Prompt) > maxTranscriptionConfigPromptLength {
+ return errors.Errorf("transcription prompt is too long; maximum length is %d characters", maxTranscriptionConfigPromptLength)
+ }
return nil
}
diff --git a/server/router/api/v1/test/ai_service_test.go b/server/router/api/v1/test/ai_service_test.go
index aac7d0644..96739df35 100644
--- a/server/router/api/v1/test/ai_service_test.go
+++ b/server/router/api/v1/test/ai_service_test.go
@@ -21,8 +21,6 @@ func TestTranscribe(t *testing.T) {
defer ts.Cleanup()
_, err := ts.Service.Transcribe(ctx, &v1pb.TranscribeRequest{
- ProviderId: "openai-main",
- Config: &v1pb.TranscriptionConfig{},
Audio: &v1pb.TranscriptionAudio{
Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")},
Filename: "voice.wav",
@@ -33,7 +31,7 @@ func TestTranscribe(t *testing.T) {
require.Contains(t, err.Error(), "user not authenticated")
})
- t.Run("transcribes audio file with configured provider", func(t *testing.T) {
+ t.Run("transcribes audio file using persisted transcription setting", func(t *testing.T) {
ts := NewTestService(t)
defer ts.Cleanup()
@@ -45,7 +43,8 @@ func TestTranscribe(t *testing.T) {
require.Equal(t, "/audio/transcriptions", r.URL.Path)
require.Equal(t, "Bearer sk-test", r.Header.Get("Authorization"))
require.NoError(t, r.ParseMultipartForm(10<<20))
- require.Equal(t, "gpt-4o-transcribe", r.FormValue("model"))
+ require.Equal(t, "whisper-1", r.FormValue("model"))
+ require.Equal(t, "fr", r.FormValue("language"))
require.Equal(t, "names: Alice", r.FormValue("prompt"))
file, header, err := r.FormFile("file")
@@ -73,16 +72,18 @@ func TestTranscribe(t *testing.T) {
ApiKey: "sk-test",
},
},
+ Transcription: &storepb.TranscriptionConfig{
+ ProviderId: "openai-main",
+ Model: "whisper-1",
+ Language: "fr",
+ Prompt: "names: Alice",
+ },
},
},
})
require.NoError(t, err)
resp, err := ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{
- ProviderId: "openai-main",
- Config: &v1pb.TranscriptionConfig{
- Prompt: "names: Alice",
- },
Audio: &v1pb.TranscriptionAudio{
Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")},
Filename: "voice.wav",
@@ -117,14 +118,15 @@ func TestTranscribe(t *testing.T) {
ApiKey: "sk-test",
},
},
+ Transcription: &storepb.TranscriptionConfig{
+ ProviderId: "openai-main",
+ },
},
},
})
require.NoError(t, err)
_, err = ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{
- ProviderId: "openai-main",
- Config: &v1pb.TranscriptionConfig{},
Audio: &v1pb.TranscriptionAudio{
Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")},
Filename: "voice.wav",
@@ -172,14 +174,15 @@ func TestTranscribe(t *testing.T) {
ApiKey: "gemini-key",
},
},
+ Transcription: &storepb.TranscriptionConfig{
+ ProviderId: "gemini-main",
+ },
},
},
})
require.NoError(t, err)
resp, err := ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{
- ProviderId: "gemini-main",
- Config: &v1pb.TranscriptionConfig{},
Audio: &v1pb.TranscriptionAudio{
Source: &v1pb.TranscriptionAudio_Content{Content: []byte("mp3 bytes")},
Filename: "voice.mp3",
@@ -190,7 +193,7 @@ func TestTranscribe(t *testing.T) {
require.Equal(t, "gemini transcript", resp.Text)
})
- t.Run("uses built-in transcription model", func(t *testing.T) {
+ t.Run("falls back to engine default model when transcription model is empty", func(t *testing.T) {
ts := NewTestService(t)
defer ts.Cleanup()
@@ -200,7 +203,7 @@ func TestTranscribe(t *testing.T) {
openAIServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
require.NoError(t, r.ParseMultipartForm(10<<20))
- require.Equal(t, "gpt-4o-transcribe", r.FormValue("model"))
+ require.Equal(t, "whisper-1", r.FormValue("model"))
w.Header().Set("Content-Type", "application/json")
require.NoError(t, json.NewEncoder(w).Encode(map[string]string{
"text": "built-in model",
@@ -221,14 +224,15 @@ func TestTranscribe(t *testing.T) {
ApiKey: "sk-test",
},
},
+ Transcription: &storepb.TranscriptionConfig{
+ ProviderId: "openai-main",
+ },
},
},
})
require.NoError(t, err)
resp, err := ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{
- ProviderId: "openai-main",
- Config: &v1pb.TranscriptionConfig{},
Audio: &v1pb.TranscriptionAudio{
Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")},
Filename: "voice.wav",
@@ -247,27 +251,7 @@ func TestTranscribe(t *testing.T) {
require.NoError(t, err)
userCtx := ts.CreateUserContext(ctx, user.ID)
- _, err = ts.Store.UpsertInstanceSetting(ctx, &storepb.InstanceSetting{
- Key: storepb.InstanceSettingKey_AI,
- Value: &storepb.InstanceSetting_AiSetting{
- AiSetting: &storepb.InstanceAISetting{
- Providers: []*storepb.AIProviderConfig{
- {
- Id: "openai-main",
- Title: "OpenAI",
- Type: storepb.AIProviderType_OPENAI,
- Endpoint: "https://example.com/v1",
- ApiKey: "sk-test",
- },
- },
- },
- },
- })
- require.NoError(t, err)
-
_, err = ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{
- ProviderId: "openai-main",
- Config: &v1pb.TranscriptionConfig{},
Audio: &v1pb.TranscriptionAudio{
Source: &v1pb.TranscriptionAudio_Content{Content: []byte("not audio")},
Filename: "notes.txt",
@@ -277,4 +261,23 @@ func TestTranscribe(t *testing.T) {
require.Error(t, err)
require.Contains(t, err.Error(), "not supported")
})
+
+ t.Run("returns FailedPrecondition when transcription is not configured", func(t *testing.T) {
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ user, err := ts.CreateRegularUser(ctx, "alice-empty")
+ require.NoError(t, err)
+ userCtx := ts.CreateUserContext(ctx, user.ID)
+
+ _, err = ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{
+ Audio: &v1pb.TranscriptionAudio{
+ Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")},
+ Filename: "voice.wav",
+ ContentType: "audio/wav",
+ },
+ })
+ require.Error(t, err)
+ require.Contains(t, err.Error(), "transcription is not configured")
+ })
}
diff --git a/server/router/api/v1/test/instance_service_test.go b/server/router/api/v1/test/instance_service_test.go
index c282d52b6..c52dbae94 100644
--- a/server/router/api/v1/test/instance_service_test.go
+++ b/server/router/api/v1/test/instance_service_test.go
@@ -2,6 +2,7 @@ package test
import (
"context"
+ "strings"
"testing"
"github.com/stretchr/testify/require"
@@ -731,4 +732,149 @@ func TestUpdateInstanceSetting(t *testing.T) {
"existing AI provider API key must be preserved when an empty value is sent")
require.Equal(t, "OpenAI primary", stored.GetProviders()[0].GetTitle())
})
+
+ t.Run("UpdateInstanceSetting - transcription provider_id must reference an existing provider", func(t *testing.T) {
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ hostUser, err := ts.CreateHostUser(ctx, "admin")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, hostUser.ID)
+
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{
+ Setting: &v1pb.InstanceSetting{
+ Name: "instance/settings/AI",
+ Value: &v1pb.InstanceSetting_AiSetting{
+ AiSetting: &v1pb.InstanceSetting_AISetting{
+ Providers: []*v1pb.InstanceSetting_AIProviderConfig{
+ {
+ Id: "openai-main",
+ Title: "OpenAI",
+ Type: v1pb.InstanceSetting_OPENAI,
+ ApiKey: "sk-test",
+ },
+ },
+ Transcription: &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: "does-not-exist",
+ },
+ },
+ },
+ },
+ })
+ require.Error(t, err)
+ require.Contains(t, err.Error(), "transcription provider_id")
+ })
+
+ t.Run("UpdateInstanceSetting - transcription strings are length-capped", func(t *testing.T) {
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ hostUser, err := ts.CreateHostUser(ctx, "admin")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, hostUser.ID)
+
+ base := &v1pb.InstanceSetting{
+ Name: "instance/settings/AI",
+ Value: &v1pb.InstanceSetting_AiSetting{
+ AiSetting: &v1pb.InstanceSetting_AISetting{
+ Providers: []*v1pb.InstanceSetting_AIProviderConfig{
+ {
+ Id: "openai-main",
+ Title: "OpenAI",
+ Type: v1pb.InstanceSetting_OPENAI,
+ ApiKey: "sk-test",
+ },
+ },
+ },
+ },
+ }
+
+ oversizedModel := strings.Repeat("a", 257)
+ base.GetAiSetting().Transcription = &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: "openai-main",
+ Model: oversizedModel,
+ }
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: base})
+ require.Error(t, err)
+ require.Contains(t, err.Error(), "transcription model")
+
+ oversizedLanguage := strings.Repeat("a", 33)
+ base.GetAiSetting().Transcription = &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: "openai-main",
+ Language: oversizedLanguage,
+ }
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: base})
+ require.Error(t, err)
+ require.Contains(t, err.Error(), "transcription language")
+
+ oversizedPrompt := strings.Repeat("a", 4097)
+ base.GetAiSetting().Transcription = &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: "openai-main",
+ Prompt: oversizedPrompt,
+ }
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: base})
+ require.Error(t, err)
+ require.Contains(t, err.Error(), "transcription prompt")
+ })
+
+ t.Run("UpdateInstanceSetting - transcription is preserved when omitted on update", func(t *testing.T) {
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ hostUser, err := ts.CreateHostUser(ctx, "admin")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, hostUser.ID)
+
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{
+ Setting: &v1pb.InstanceSetting{
+ Name: "instance/settings/AI",
+ Value: &v1pb.InstanceSetting_AiSetting{
+ AiSetting: &v1pb.InstanceSetting_AISetting{
+ Providers: []*v1pb.InstanceSetting_AIProviderConfig{
+ {
+ Id: "openai-main",
+ Title: "OpenAI",
+ Type: v1pb.InstanceSetting_OPENAI,
+ ApiKey: "sk-test",
+ },
+ },
+ Transcription: &v1pb.InstanceSetting_TranscriptionConfig{
+ ProviderId: "openai-main",
+ Model: "whisper-1",
+ Language: "en",
+ Prompt: "names: Alice",
+ },
+ },
+ },
+ },
+ })
+ require.NoError(t, err)
+
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{
+ Setting: &v1pb.InstanceSetting{
+ Name: "instance/settings/AI",
+ Value: &v1pb.InstanceSetting_AiSetting{
+ AiSetting: &v1pb.InstanceSetting_AISetting{
+ Providers: []*v1pb.InstanceSetting_AIProviderConfig{
+ {
+ Id: "openai-main",
+ Title: "OpenAI",
+ Type: v1pb.InstanceSetting_OPENAI,
+ ApiKey: "",
+ },
+ },
+ },
+ },
+ },
+ })
+ require.NoError(t, err)
+
+ stored, err := ts.Store.GetInstanceAISetting(ctx)
+ require.NoError(t, err)
+ require.NotNil(t, stored.GetTranscription())
+ require.Equal(t, "openai-main", stored.GetTranscription().GetProviderId())
+ require.Equal(t, "whisper-1", stored.GetTranscription().GetModel())
+ require.Equal(t, "en", stored.GetTranscription().GetLanguage())
+ require.Equal(t, "names: Alice", stored.GetTranscription().GetPrompt())
+ })
}
diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx
index 319689653..abd1c06f1 100644
--- a/web/src/components/MemoEditor/index.tsx
+++ b/web/src/components/MemoEditor/index.tsx
@@ -8,7 +8,7 @@ import { memoKeys } from "@/hooks/useMemoQueries";
import { userKeys } from "@/hooks/useUserQueries";
import { handleError } from "@/lib/error";
import { cn } from "@/lib/utils";
-import { InstanceSetting_AIProviderType, InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb";
+import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb";
import { useTranslate } from "@/utils/i18n";
import { convertVisibilityFromString } from "@/utils/memo";
import {
@@ -28,11 +28,6 @@ import { EditorProvider, useEditorContext } from "./state";
import type { MemoEditorProps } from "./types";
import type { LocalFile } from "./types/attachment";
-const TRANSCRIPTION_PROVIDER_TYPES: InstanceSetting_AIProviderType[] = [
- InstanceSetting_AIProviderType.OPENAI,
- InstanceSetting_AIProviderType.GEMINI,
-];
-
const MemoEditor = (props: MemoEditorProps) => (
<EditorProvider>
<MemoEditorImpl {...props} />
@@ -61,10 +56,12 @@ const MemoEditorImpl: React.FC<MemoEditorProps> = ({
const [isTranscribingAudio, setIsTranscribingAudio] = useState(false);
const memoName = memo?.name;
- const transcriptionProvider = useMemo(
- () => aiSetting.providers.find((provider) => provider.apiKeySet && TRANSCRIPTION_PROVIDER_TYPES.includes(provider.type)),
- [aiSetting.providers],
- );
+ const canTranscribe = useMemo(() => {
+ const providerId = aiSetting.transcription?.providerId ?? "";
+ if (!providerId) return false;
+ const provider = aiSetting.providers.find((p) => p.id === providerId);
+ return Boolean(provider?.apiKeySet);
+ }, [aiSetting.providers, aiSetting.transcription?.providerId]);
// Get default visibility from user settings
const defaultVisibility = userGeneralSetting?.memoVisibility ? convertVisibilityFromString(userGeneralSetting.memoVisibility) : undefined;
@@ -129,7 +126,7 @@ const MemoEditorImpl: React.FC<MemoEditorProps> = ({
const handleTranscribeRecordedAudio = useCallback(
async (localFile: LocalFile) => {
- if (!transcriptionProvider) {
+ if (!canTranscribe) {
dispatch(actions.addLocalFile(localFile));
setIsTranscribingAudio(false);
setIsAudioRecorderOpen(false);
@@ -137,7 +134,7 @@ const MemoEditorImpl: React.FC<MemoEditorProps> = ({
}
try {
- const text = (await transcriptionService.transcribeFile(localFile.file, transcriptionProvider)).trim();
+ const text = (await transcriptionService.transcribeFile(localFile.file)).trim();
if (!text) {
dispatch(actions.addLocalFile(localFile));
toast.error(t("editor.audio-recorder.transcribe-empty"));
@@ -155,7 +152,7 @@ const MemoEditorImpl: React.FC<MemoEditorProps> = ({
setIsAudioRecorderOpen(false);
}
},
- [actions, dispatch, insertTranscribedText, t, transcriptionProvider],
+ [actions, canTranscribe, dispatch, insertTranscribedText, t],
);
const audioRecorderActions = useMemo(
@@ -223,7 +220,7 @@ const MemoEditorImpl: React.FC<MemoEditorProps> = ({
};
const handleTranscribeAudioRecording = () => {
- if (!transcriptionProvider || isTranscribingAudio) {
+ if (!canTranscribe || isTranscribingAudio) {
return;
}
@@ -340,7 +337,7 @@ const MemoEditorImpl: React.FC<MemoEditorProps> = ({
onStop={audioRecorder.stopRecording}
onCancel={handleCancelAudioRecording}
onTranscribe={handleTranscribeAudioRecording}
- canTranscribe={!!transcriptionProvider}
+ canTranscribe={canTranscribe}
isTranscribing={isTranscribingAudio}
/>
)}
diff --git a/web/src/components/MemoEditor/services/transcriptionService.ts b/web/src/components/MemoEditor/services/transcriptionService.ts
index ea4fc9f82..c4a191e2a 100644
--- a/web/src/components/MemoEditor/services/transcriptionService.ts
+++ b/web/src/components/MemoEditor/services/transcriptionService.ts
@@ -1,15 +1,12 @@
import { create } from "@bufbuild/protobuf";
import { aiServiceClient } from "@/connect";
-import { TranscribeRequestSchema, TranscriptionAudioSchema, TranscriptionConfigSchema } from "@/types/proto/api/v1/ai_service_pb";
-import type { InstanceSetting_AIProviderConfig } from "@/types/proto/api/v1/instance_service_pb";
+import { TranscribeRequestSchema, TranscriptionAudioSchema } from "@/types/proto/api/v1/ai_service_pb";
export const transcriptionService = {
- async transcribeFile(file: File, provider: InstanceSetting_AIProviderConfig): Promise<string> {
+ async transcribeFile(file: File): Promise<string> {
const content = new Uint8Array(await file.arrayBuffer());
const response = await aiServiceClient.transcribe(
create(TranscribeRequestSchema, {
- providerId: provider.id,
- config: create(TranscriptionConfigSchema, {}),
audio: create(TranscriptionAudioSchema, {
source: {
case: "content",
diff --git a/web/src/components/Settings/AISection.tsx b/web/src/components/Settings/AISection.tsx
index 459b2842f..ba393684e 100644
--- a/web/src/components/Settings/AISection.tsx
+++ b/web/src/components/Settings/AISection.tsx
@@ -1,7 +1,7 @@
import { create } from "@bufbuild/protobuf";
import { isEqual } from "lodash-es";
import { MoreVerticalIcon, PlusIcon } from "lucide-react";
-import { useEffect, useMemo, useState } from "react";
+import { useEffect, useMemo, useRef, useState } from "react";
import { toast } from "react-hot-toast";
import ConfirmDialog from "@/components/ConfirmDialog";
import { Button } from "@/components/ui/button";
@@ -10,6 +10,7 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigge
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+import { Textarea } from "@/components/ui/textarea";
import { useInstance } from "@/contexts/InstanceContext";
import {
InstanceSetting_AIProviderConfig,
@@ -17,6 +18,8 @@ import {
InstanceSetting_AIProviderType,
InstanceSetting_AISettingSchema,
InstanceSetting_Key,
+ InstanceSetting_TranscriptionConfig,
+ InstanceSetting_TranscriptionConfigSchema,
InstanceSettingSchema,
} from "@/types/proto/api/v1/instance_service_pb";
import { useTranslate } from "@/utils/i18n";
@@ -36,6 +39,13 @@ type LocalAIProvider = {
apiKeyHint: string;
};
+type LocalTranscription = {
+ providerId: string;
+ model: string;
+ language: string;
+ prompt: string;
+};
+
const providerTypeOptions = [InstanceSetting_AIProviderType.OPENAI, InstanceSetting_AIProviderType.GEMINI];
const byokNotes = ["setting.ai.byok-key-note", "setting.ai.byok-storage-note", "setting.ai.byok-model-note"] as const;
@@ -61,6 +71,13 @@ const toLocalProvider = (provider: InstanceSetting_AIProviderConfig): LocalAIPro
apiKeyHint: provider.apiKeyHint,
});
+const toLocalTranscription = (config: InstanceSetting_TranscriptionConfig | undefined): LocalTranscription => ({
+ providerId: config?.providerId ?? "",
+ model: config?.model ?? "",
+ language: config?.language ?? "",
+ prompt: config?.prompt ?? "",
+});
+
const newProvider = (): LocalAIProvider => ({
id: createProviderID(),
title: "",
@@ -80,11 +97,20 @@ const toProviderConfig = (provider: LocalAIProvider) =>
apiKey: provider.apiKey,
});
+const toTranscriptionConfig = (transcription: LocalTranscription) =>
+ create(InstanceSetting_TranscriptionConfigSchema, {
+ providerId: transcription.providerId,
+ model: transcription.model.trim(),
+ language: transcription.language.trim(),
+ prompt: transcription.prompt,
+ });
+
const AISection = () => {
const t = useTranslate();
const saveInstanceSetting = useInstanceSettingUpdater();
const { aiSetting: originalSetting } = useInstance();
const [providers, setProviders] = useState<LocalAIProvider[]>(() => originalSetting.providers.map(toLocalProvider));
+ const [transcription, setTranscription] = useState<LocalTranscription>(() => toLocalTranscription(originalSetting.transcription));
const [editingProvider, setEditingProvider] = useState<LocalAIProvider | undefined>();
const [deleteTarget, setDeleteTarget] = useState<LocalAIProvider | undefined>();
@@ -92,8 +118,50 @@ const AISection = () => {
setProviders(originalSetting.providers.map(toLocalProvider));
}, [originalSetting.providers]);
- const originalProviders = useMemo(() => originalSetting.providers.map(toLocalProvider), [originalSetting.providers]);
- const hasChanges = !isEqual(providers, originalProviders);
+ // Only re-sync the transcription draft when the server-side content actually
+ // changes — not on every originalSetting identity change. This prevents
+ // provider-side saves (which keep transcription unchanged on the server) from
+ // wiping an in-progress transcription draft.
+ const lastSyncedTranscription = useRef<LocalTranscription>(toLocalTranscription(originalSetting.transcription));
+ useEffect(() => {
+ const next = toLocalTranscription(originalSetting.transcription);
+ if (!isEqual(lastSyncedTranscription.current, next)) {
+ setTranscription(next);
+ lastSyncedTranscription.current = next;
+ }
+ }, [originalSetting.transcription]);
+
+ const originalTranscription = useMemo(() => toLocalTranscription(originalSetting.transcription), [originalSetting.transcription]);
+ const transcriptionHasChanges = !isEqual(transcription, originalTranscription);
+
+ const transcriptionProviderRef = useMemo(
+ () => providers.find((provider) => provider.id === transcription.providerId),
+ [providers, transcription.providerId],
+ );
+
+ // Persists the AI setting using a specific providers list and transcription
+ // value. Provider operations pass originalSetting.transcription so an
+ // in-progress transcription draft is never accidentally committed.
+ const persistAISetting = async (
+ nextProviders: LocalAIProvider[],
+ nextTranscription: InstanceSetting_TranscriptionConfig | undefined,
+ errorContext: string,
+ ) => {
+ return saveInstanceSetting({
+ key: InstanceSetting_Key.AI,
+ setting: create(InstanceSettingSchema, {
+ name: buildInstanceSettingName(InstanceSetting_Key.AI),
+ value: {
+ case: "aiSetting",
+ value: create(InstanceSetting_AISettingSchema, {
+ providers: nextProviders.map(toProviderConfig),
+ transcription: nextTranscription,
+ }),
+ },
+ }),
+ errorContext,
+ });
+ };
const handleCreateProvider = () => {
setEditingProvider(newProvider());
@@ -103,7 +171,7 @@ const AISection = () => {
setEditingProvider({ ...provider, apiKey: "" });
};
- const handleSaveProvider = (provider: LocalAIProvider) => {
+ const handleSaveProvider = async (provider: LocalAIProvider) => {
const title = provider.title.trim();
const endpoint = provider.endpoint.trim();
@@ -116,41 +184,47 @@ const AISection = () => {
return;
}
- const normalizedProvider = {
- ...provider,
- title,
- endpoint,
- };
- setProviders((prev) => {
- const exists = prev.some((item) => item.id === normalizedProvider.id);
- if (!exists) {
- return [...prev, normalizedProvider];
- }
- return prev.map((item) => (item.id === normalizedProvider.id ? normalizedProvider : item));
- });
+ const normalizedProvider = { ...provider, title, endpoint };
+ const exists = providers.some((item) => item.id === normalizedProvider.id);
+ const nextProviders = exists
+ ? providers.map((item) => (item.id === normalizedProvider.id ? normalizedProvider : item))
+ : [...providers, normalizedProvider];
+
+ const ok = await persistAISetting(nextProviders, originalSetting.transcription, "Update AI provider");
+ if (!ok) return;
+ setProviders(nextProviders);
setEditingProvider(undefined);
};
- const handleDeleteProvider = () => {
+ const handleDeleteProvider = async () => {
if (!deleteTarget) return;
- setProviders((prev) => prev.filter((provider) => provider.id !== deleteTarget.id));
+ const target = deleteTarget;
+ const nextProviders = providers.filter((provider) => provider.id !== target.id);
+
+ // If the persisted transcription references the deleted provider, the
+ // server would reject the save (provider_id must reference an existing
+ // provider). Send a cleared transcription in that case.
+ const persistedTranscription = originalSetting.transcription;
+ const nextTranscription =
+ persistedTranscription && persistedTranscription.providerId === target.id
+ ? create(InstanceSetting_TranscriptionConfigSchema, {})
+ : persistedTranscription;
+
+ const ok = await persistAISetting(nextProviders, nextTranscription, "Delete AI provider");
+ if (!ok) return;
+ setProviders(nextProviders);
+ if (transcription.providerId === target.id) {
+ setTranscription((prev) => ({ ...prev, providerId: "" }));
+ }
setDeleteTarget(undefined);
};
- const handleSaveSetting = async () => {
- await saveInstanceSetting({
- key: InstanceSetting_Key.AI,
- setting: create(InstanceSettingSchema, {
- name: buildInstanceSettingName(InstanceSetting_Key.AI),
- value: {
- case: "aiSetting",
- value: create(InstanceSetting_AISettingSchema, {
- providers: providers.map(toProviderConfig),
- }),
- },
- }),
- errorContext: "Update AI providers",
- });
+ const handleSaveTranscription = async () => {
+ if (transcription.providerId && !transcriptionProviderRef) {
+ toast.error(t("setting.ai.transcription-empty-providers"));
+ return;
+ }
+ await persistAISetting(providers, toTranscriptionConfig(transcription), "Update transcription");
};
return (
@@ -183,7 +257,7 @@ const AISection = () => {
</div>
</SettingPanel>
- <SettingGroup title={t("setting.ai.providers")} description={t("setting.ai.description")}>
+ <SettingGroup title={t("setting.ai.integrations-title")} description={t("setting.ai.integrations-description")}>
<SettingTable
columns={[
{
@@ -242,11 +316,23 @@ const AISection = () => {
/>
</SettingGroup>
- <div className="w-full flex justify-end">
- <Button disabled={!hasChanges} onClick={handleSaveSetting}>
- {t("common.save")}
- </Button>
- </div>
+ <SettingGroup
+ title={t("setting.ai.transcription-title")}
+ description={t("setting.ai.transcription-description")}
+ showSeparator
+ actions={
+ <Button disabled={!transcriptionHasChanges} onClick={handleSaveTranscription}>
+ {t("common.save")}
+ </Button>
+ }
+ >
+ <TranscriptionForm
+ providers={providers}
+ transcription={transcription}
+ onChange={setTranscription}
+ referencedProvider={transcriptionProviderRef}
+ />
+ </SettingGroup>
<AIProviderDialog
provider={editingProvider}
@@ -267,6 +353,98 @@ const AISection = () => {
);
};
+interface TranscriptionFormProps {
+ providers: LocalAIProvider[];
+ transcription: LocalTranscription;
+ referencedProvider: LocalAIProvider | undefined;
+ onChange: (next: LocalTranscription) => void;
+}
+
+const TranscriptionForm = ({ providers, transcription, referencedProvider, onChange }: TranscriptionFormProps) => {
+ const t = useTranslate();
+ const noProviders = providers.length === 0;
+
+ const update = (partial: Partial<LocalTranscription>) => {
+ onChange({ ...transcription, ...partial });
+ };
+
+ const placeholderForProvider = (provider: LocalAIProvider | undefined) => {
+ if (!provider) return "";
+ return provider.type === InstanceSetting_AIProviderType.GEMINI
+ ? t("setting.ai.transcription-model-placeholder-gemini")
+ : t("setting.ai.transcription-model-placeholder-openai");
+ };
+
+ return (
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-3xl">
+ <div className="flex flex-col gap-1.5 sm:col-span-2">
+ <Label>{t("setting.ai.transcription-provider")}</Label>
+ <Select
+ value={transcription.providerId || "__none__"}
+ onValueChange={(value) => update({ providerId: value === "__none__" ? "" : value })}
+ disabled={noProviders}
+ >
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="__none__">{t("setting.ai.transcription-no-provider")}</SelectItem>
+ {providers.map((provider) => (
+ <SelectItem key={provider.id} value={provider.id}>
+ {provider.title || provider.id}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ {noProviders && <p className="text-xs text-muted-foreground">{t("setting.ai.transcription-empty-providers")}</p>}
+ {referencedProvider && !referencedProvider.apiKeySet && (
+ <p className="text-xs text-destructive">{t("setting.ai.transcription-warning-no-key")}</p>
+ )}
+ {referencedProvider?.type === InstanceSetting_AIProviderType.GEMINI && (
+ <p className="text-xs text-muted-foreground">{t("setting.ai.transcription-warning-gemini-webm")}</p>
+ )}
+ </div>
+
+ <div className="flex flex-col gap-1.5 sm:col-span-2">
+ <Label>{t("setting.ai.transcription-model")}</Label>
+ <Input
+ value={transcription.model}
+ onChange={(e) => update({ model: e.target.value })}
+ placeholder={placeholderForProvider(referencedProvider)}
+ disabled={!transcription.providerId}
+ maxLength={256}
+ />
+ <p className="text-xs text-muted-foreground">{t("setting.ai.transcription-model-help")}</p>
+ </div>
+
+ <div className="flex flex-col gap-1.5">
+ <Label>{t("setting.ai.transcription-language")}</Label>
+ <Input
+ value={transcription.language}
+ onChange={(e) => update({ language: e.target.value })}
+ placeholder={t("setting.ai.transcription-language-placeholder")}
+ disabled={!transcription.providerId}
+ maxLength={32}
+ />
+ <p className="text-xs text-muted-foreground">{t("setting.ai.transcription-language-help")}</p>
+ </div>
+
+ <div className="flex flex-col gap-1.5 sm:col-span-2">
+ <Label>{t("setting.ai.transcription-prompt")}</Label>
+ <Textarea
+ value={transcription.prompt}
+ onChange={(e) => update({ prompt: e.target.value })}
+ placeholder={t("setting.ai.transcription-prompt-placeholder")}
+ rows={3}
+ disabled={!transcription.providerId}
+ maxLength={4096}
+ />
+ <p className="text-xs text-muted-foreground">{t("setting.ai.transcription-prompt-help")}</p>
+ </div>
+ </div>
+ );
+};
+
interface AIProviderDialogProps {
provider?: LocalAIProvider;
onOpenChange: (open: boolean) => void;
diff --git a/web/src/locales/en.json b/web/src/locales/en.json
index 7a3ec8a67..a87f3cf5a 100644
--- a/web/src/locales/en.json
+++ b/web/src/locales/en.json
@@ -427,13 +427,32 @@
"edit-provider": "Edit provider",
"endpoint": "Endpoint",
"endpoint-hint": "Leave empty to use the official provider endpoint.",
+ "integrations-description": "Provider keys are supplied by the instance owner and used by server-side AI features.",
+ "integrations-title": "AI integrations",
"keep-api-key": "Leave blank to keep the existing key",
"label": "AI",
"no-providers": "No AI providers configured.",
"provider-title": "Provider name",
"provider-title-required": "Provider name is required.",
"provider-type": "Provider type",
- "providers": "Providers"
+ "providers": "Providers",
+ "transcription-description": "Speech-to-text settings used when recording audio in the memo composer.",
+ "transcription-empty-providers": "Add an AI integration first to enable transcription.",
+ "transcription-language-help": "ISO 639-1 short code (e.g. en, de, zh). Leave empty to auto-detect.",
+ "transcription-language-placeholder": "auto-detect",
+ "transcription-language": "Default language",
+ "transcription-model-help": "Free text. Use the provider's model identifier — e.g. whisper-1, gpt-4o-transcribe, whisper-large-v3-turbo.",
+ "transcription-model-placeholder-gemini": "gemini-2.5-flash",
+ "transcription-model-placeholder-openai": "whisper-1",
+ "transcription-model": "Model",
+ "transcription-no-provider": "None — transcription disabled",
+ "transcription-prompt-help": "Improves spelling of proper nouns and jargon. Whisper limit is roughly 224 tokens.",
+ "transcription-prompt-placeholder": "Names: Alice, Bob. Glossary: kubernetes, OAuth.",
+ "transcription-prompt": "Prompt hints",
+ "transcription-provider": "Provider",
+ "transcription-title": "Transcription",
+ "transcription-warning-gemini-webm": "Gemini does not accept browser-recorded audio/webm. For in-editor recording, use an OpenAI-compatible provider.",
+ "transcription-warning-no-key": "The selected provider has no API key set. Edit the integration above to add one."
},
"instance": {
"access-description": "Control sign-up, authentication, profile editing, and calendar defaults for this instance.",
diff --git a/web/src/types/proto/api/v1/ai_service_pb.ts b/web/src/types/proto/api/v1/ai_service_pb.ts
index 059ff6a88..6a43b99c8 100644
--- a/web/src/types/proto/api/v1/ai_service_pb.ts
+++ b/web/src/types/proto/api/v1/ai_service_pb.ts
@@ -13,30 +13,16 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file api/v1/ai_service.proto.
*/
export const file_api_v1_ai_service: GenFile = /*@__PURE__*/
- fileDesc("ChdhcGkvdjEvYWlfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxIpsBChFUcmFuc2NyaWJlUmVxdWVzdBIYCgtwcm92aWRlcl9pZBgBIAEoCUID4EECEjYKBmNvbmZpZxgCIAEoCzIhLm1lbW9zLmFwaS52MS5UcmFuc2NyaXB0aW9uQ29uZmlnQgPgQQISNAoFYXVkaW8YAyABKAsyIC5tZW1vcy5hcGkudjEuVHJhbnNjcmlwdGlvbkF1ZGlvQgPgQQIiQQoTVHJhbnNjcmlwdGlvbkNvbmZpZxITCgZwcm9tcHQYASABKAlCA+BBARIVCghsYW5ndWFnZRgCIAEoCUID4EEBIncKElRyYW5zY3JpcHRpb25BdWRpbxIWCgdjb250ZW50GAEgASgMQgPgQQRIABINCgN1cmkYAiABKAlIABIVCghmaWxlbmFtZRgDIAEoCUID4EEBEhkKDGNvbnRlbnRfdHlwZRgEIAEoCUID4EEBQggKBnNvdXJjZSIiChJUcmFuc2NyaWJlUmVzcG9uc2USDAoEdGV4dBgBIAEoCTKaAQoJQUlTZXJ2aWNlEowBCgpUcmFuc2NyaWJlEh8ubWVtb3MuYXBpLnYxLlRyYW5zY3JpYmVSZXF1ZXN0GiAubWVtb3MuYXBpLnYxLlRyYW5zY3JpYmVSZXNwb25zZSI72kEYcHJvdmlkZXJfaWQsY29uZmlnLGF1ZGlvgtPkkwIaOgEqIhUvYXBpL3YxL2FpOnRyYW5zY3JpYmVCpgEKEGNvbS5tZW1vcy5hcGkudjFCDkFpU2VydmljZVByb3RvUAFaMGdpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaS92MTthcGl2MaICA01BWKoCDE1lbW9zLkFwaS5WMcoCDE1lbW9zXEFwaVxWMeICGE1lbW9zXEFwaVxWMVxHUEJNZXRhZGF0YeoCDk1lbW9zOjpBcGk6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior]);
+ fileDesc("ChdhcGkvdjEvYWlfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxIkkKEVRyYW5zY3JpYmVSZXF1ZXN0EjQKBWF1ZGlvGAEgASgLMiAubWVtb3MuYXBpLnYxLlRyYW5zY3JpcHRpb25BdWRpb0ID4EECIncKElRyYW5zY3JpcHRpb25BdWRpbxIWCgdjb250ZW50GAEgASgMQgPgQQRIABINCgN1cmkYAiABKAlIABIVCghmaWxlbmFtZRgDIAEoCUID4EEBEhkKDGNvbnRlbnRfdHlwZRgEIAEoCUID4EEBQggKBnNvdXJjZSIiChJUcmFuc2NyaWJlUmVzcG9uc2USDAoEdGV4dBgBIAEoCTKGAQoJQUlTZXJ2aWNlEnkKClRyYW5zY3JpYmUSHy5tZW1vcy5hcGkudjEuVHJhbnNjcmliZVJlcXVlc3QaIC5tZW1vcy5hcGkudjEuVHJhbnNjcmliZVJlc3BvbnNlIijaQQVhdWRpb4LT5JMCGjoBKiIVL2FwaS92MS9haTp0cmFuc2NyaWJlQqYBChBjb20ubWVtb3MuYXBpLnYxQg5BaVNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior]);
/**
* @generated from message memos.api.v1.TranscribeRequest
*/
export type TranscribeRequest = Message<"memos.api.v1.TranscribeRequest"> & {
- /**
- * Required. The instance AI provider ID to use.
- *
- * @generated from field: string provider_id = 1;
- */
- providerId: string;
-
- /**
- * Required. Transcription options.
- *
- * @generated from field: memos.api.v1.TranscriptionConfig config = 2;
- */
- config?: TranscriptionConfig | undefined;
-
/**
* Required. Audio input.
*
- * @generated from field: memos.api.v1.TranscriptionAudio audio = 3;
+ * @generated from field: memos.api.v1.TranscriptionAudio audio = 1;
*/
audio?: TranscriptionAudio | undefined;
};
@@ -48,32 +34,6 @@ export type TranscribeRequest = Message<"memos.api.v1.TranscribeRequest"> & {
export const TranscribeRequestSchema: GenMessage<TranscribeRequest> = /*@__PURE__*/
messageDesc(file_api_v1_ai_service, 0);
-/**
- * @generated from message memos.api.v1.TranscriptionConfig
- */
-export type TranscriptionConfig = Message<"memos.api.v1.TranscriptionConfig"> & {
- /**
- * Optional. A prompt to improve transcription quality.
- *
- * @generated from field: string prompt = 1;
- */
- prompt: string;
-
- /**
- * Optional. The language of the input audio.
- *
- * @generated from field: string language = 2;
- */
- language: string;
-};
-
-/**
- * Describes the message memos.api.v1.TranscriptionConfig.
- * Use `create(TranscriptionConfigSchema)` to create a new message.
- */
-export const TranscriptionConfigSchema: GenMessage<TranscriptionConfig> = /*@__PURE__*/
- messageDesc(file_api_v1_ai_service, 1);
-
/**
* @generated from message memos.api.v1.TranscriptionAudio
*/
@@ -119,7 +79,7 @@ export type TranscriptionAudio = Message<"memos.api.v1.TranscriptionAudio"> & {
* Use `create(TranscriptionAudioSchema)` to create a new message.
*/
export const TranscriptionAudioSchema: GenMessage<TranscriptionAudio> = /*@__PURE__*/
- messageDesc(file_api_v1_ai_service, 2);
+ messageDesc(file_api_v1_ai_service, 1);
/**
* @generated from message memos.api.v1.TranscribeResponse
@@ -138,7 +98,7 @@ export type TranscribeResponse = Message<"memos.api.v1.TranscribeResponse"> & {
* Use `create(TranscribeResponseSchema)` to create a new message.
*/
export const TranscribeResponseSchema: GenMessage<TranscribeResponse> = /*@__PURE__*/
- messageDesc(file_api_v1_ai_service, 3);
+ messageDesc(file_api_v1_ai_service, 2);
/**
* @generated from service memos.api.v1.AIService
diff --git a/web/src/types/proto/api/v1/instance_service_pb.ts b/web/src/types/proto/api/v1/instance_service_pb.ts
index 46a60a9a1..d2f96ebf7 100644
--- a/web/src/types/proto/api/v1/instance_service_pb.ts
+++ b/web/src/types/proto/api/v1/instance_service_pb.ts
@@ -20,7 +20,7 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file api/v1/instance_service.proto.
*/
export const file_api_v1_instance_service: GenFile = /*@__PURE__*/
- fileDesc("Ch1hcGkvdjEvaW5zdGFuY2Vfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxInkKD0luc3RhbmNlUHJvZmlsZRIPCgd2ZXJzaW9uGAIgASgJEgwKBGRlbW8YAyABKAgSFAoMaW5zdGFuY2VfdXJsGAYgASgJEiEKBWFkbWluGAcgASgLMhIubWVtb3MuYXBpLnYxLlVzZXISDgoGY29tbWl0GAggASgJIhsKGUdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3QiqxQKD0luc3RhbmNlU2V0dGluZxIRCgRuYW1lGAEgASgJQgPgQQgSRwoPZ2VuZXJhbF9zZXR0aW5nGAIgASgLMiwubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5HZW5lcmFsU2V0dGluZ0gAEkcKD3N0b3JhZ2Vfc2V0dGluZxgDIAEoCzIsLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmdIABJQChRtZW1vX3JlbGF0ZWRfc2V0dGluZxgEIAEoCzIwLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuTWVtb1JlbGF0ZWRTZXR0aW5nSAASQQoMdGFnc19zZXR0aW5nGAUgASgLMikubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5UYWdzU2V0dGluZ0gAElEKFG5vdGlmaWNhdGlvbl9zZXR0aW5nGAYgASgLMjEubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5Ob3RpZmljYXRpb25TZXR0aW5nSAASPQoKYWlfc2V0dGluZxgHIAEoCzInLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuQUlTZXR0aW5nSAAahwMKDkdlbmVyYWxTZXR0aW5nEiIKGmRpc2FsbG93X3VzZXJfcmVnaXN0cmF0aW9uGAIgASgIEh4KFmRpc2FsbG93X3Bhc3N3b3JkX2F1dGgYAyABKAgSGQoRYWRkaXRpb25hbF9zY3JpcHQYBCABKAkSGAoQYWRkaXRpb25hbF9zdHlsZRgFIAEoCRJSCg5jdXN0b21fcHJvZmlsZRgGIAEoCzI6Lm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuR2VuZXJhbFNldHRpbmcuQ3VzdG9tUHJvZmlsZRIdChV3ZWVrX3N0YXJ0X2RheV9vZmZzZXQYByABKAUSIAoYZGlzYWxsb3dfY2hhbmdlX3VzZXJuYW1lGAggASgIEiAKGGRpc2FsbG93X2NoYW5nZV9uaWNrbmFtZRgJIAEoCBpFCg1DdXN0b21Qcm9maWxlEg0KBXRpdGxlGAEgASgJEhMKC2Rlc2NyaXB0aW9uGAIgASgJEhAKCGxvZ29fdXJsGAMgASgJGr8DCg5TdG9yYWdlU2V0dGluZxJOCgxzdG9yYWdlX3R5cGUYASABKA4yOC5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLlN0b3JhZ2VTZXR0aW5nLlN0b3JhZ2VUeXBlEhkKEWZpbGVwYXRoX3RlbXBsYXRlGAIgASgJEhwKFHVwbG9hZF9zaXplX2xpbWl0X21iGAMgASgDEkgKCXMzX2NvbmZpZxgEIAEoCzI1Lm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmcuUzNDb25maWcaiwEKCFMzQ29uZmlnEhUKDWFjY2Vzc19rZXlfaWQYASABKAkSHgoRYWNjZXNzX2tleV9zZWNyZXQYAiABKAlCA+BBBBIQCghlbmRwb2ludBgDIAEoCRIOCgZyZWdpb24YBCABKAkSDgoGYnVja2V0GAUgASgJEhYKDnVzZV9wYXRoX3N0eWxlGAYgASgIIkwKC1N0b3JhZ2VUeXBlEhwKGFNUT1JBR0VfVFlQRV9VTlNQRUNJRklFRBAAEgwKCERBVEFCQVNFEAESCQoFTE9DQUwQAhIGCgJTMxADGocBChJNZW1vUmVsYXRlZFNldHRpbmcSHAoUY29udGVudF9sZW5ndGhfbGltaXQYAyABKAUSIAoYZW5hYmxlX2RvdWJsZV9jbGlja19lZGl0GAQgASgIEhEKCXJlYWN0aW9ucxgHIAMoCUoECAIQA1IYZGlzcGxheV93aXRoX3VwZGF0ZV90aW1lGlEKC1RhZ01ldGFkYXRhEiwKEGJhY2tncm91bmRfY29sb3IYASABKAsyEi5nb29nbGUudHlwZS5Db2xvchIUCgxibHVyX2NvbnRlbnQYAiABKAgaqAEKC1RhZ3NTZXR0aW5nEkEKBHRhZ3MYASADKAsyMy5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLlRhZ3NTZXR0aW5nLlRhZ3NFbnRyeRpWCglUYWdzRW50cnkSCwoDa2V5GAEgASgJEjgKBXZhbHVlGAIgASgLMikubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5UYWdNZXRhZGF0YToCOAEaugIKE05vdGlmaWNhdGlvblNldHRpbmcSTQoFZW1haWwYASABKAsyPi5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLk5vdGlmaWNhdGlvblNldHRpbmcuRW1haWxTZXR0aW5nGtMBCgxFbWFpbFNldHRpbmcSDwoHZW5hYmxlZBgBIAEoCBIRCglzbXRwX2hvc3QYAiABKAkSEQoJc210cF9wb3J0GAMgASgFEhUKDXNtdHBfdXNlcm5hbWUYBCABKAkSGgoNc210cF9wYXNzd29yZBgFIAEoCUID4EEEEhIKCmZyb21fZW1haWwYBiABKAkSEQoJZnJvbV9uYW1lGAcgASgJEhAKCHJlcGx5X3RvGAggASgJEg8KB3VzZV90bHMYCSABKAgSDwoHdXNlX3NzbBgKIAEoCBpOCglBSVNldHRpbmcSQQoJcHJvdmlkZXJzGAEgAygLMi4ubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5BSVByb3ZpZGVyQ29uZmlnGsYBChBBSVByb3ZpZGVyQ29uZmlnEgoKAmlkGAEgASgJEg0KBXRpdGxlGAIgASgJEjoKBHR5cGUYAyABKA4yLC5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLkFJUHJvdmlkZXJUeXBlEhAKCGVuZHBvaW50GAQgASgJEhQKB2FwaV9rZXkYBSABKAlCA+BBBBIYCgthcGlfa2V5X3NldBgIIAEoCEID4EEDEhkKDGFwaV9rZXlfaGludBgJIAEoCUID4EEDImoKA0tleRITCg9LRVlfVU5TUEVDSUZJRUQQABILCgdHRU5FUkFMEAESCwoHU1RPUkFHRRACEhAKDE1FTU9fUkVMQVRFRBADEggKBFRBR1MQBBIQCgxOT1RJRklDQVRJT04QBRIGCgJBSRAGIkoKDkFJUHJvdmlkZXJUeXBlEiAKHEFJX1BST1ZJREVSX1RZUEVfVU5TUEVDSUZJRUQQABIKCgZPUEVOQUkQARIKCgZHRU1JTkkQAjph6kFeChxtZW1vcy5hcGkudjEvSW5zdGFuY2VTZXR0aW5nEhtpbnN0YW5jZS9zZXR0aW5ncy97c2V0dGluZ30qEGluc3RhbmNlU2V0dGluZ3MyD2luc3RhbmNlU2V0dGluZ0IHCgV2YWx1ZSJPChlHZXRJbnN0YW5jZVNldHRpbmdSZXF1ZXN0EjIKBG5hbWUYASABKAlCJOBBAvpBHgocbWVtb3MuYXBpLnYxL0luc3RhbmNlU2V0dGluZyKJAQocVXBkYXRlSW5zdGFuY2VTZXR0aW5nUmVxdWVzdBIzCgdzZXR0aW5nGAEgASgLMh0ubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZ0ID4EECEjQKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza0ID4EEBIpMBCh9UZXN0SW5zdGFuY2VFbWFpbFNldHRpbmdSZXF1ZXN0ElIKBWVtYWlsGAEgASgLMj4ubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5Ob3RpZmljYXRpb25TZXR0aW5nLkVtYWlsU2V0dGluZ0ID4EEBEhwKD3JlY2lwaWVudF9lbWFpbBgCIAEoCUID4EEBIhkKF0dldEluc3RhbmNlU3RhdHNSZXF1ZXN0ItIBCg1JbnN0YW5jZVN0YXRzEjsKCGRhdGFiYXNlGAEgASgLMikubWVtb3MuYXBpLnYxLkluc3RhbmNlU3RhdHMuRGF0YWJhc2VTdGF0cxIbChNsb2NhbF9zdG9yYWdlX2J5dGVzGAIgASgDEjIKDmdlbmVyYXRlZF90aW1lGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBozCg1EYXRhYmFzZVN0YXRzEg4KBmRyaXZlchgBIAEoCRISCgpzaXplX2J5dGVzGAIgASgDMvQFCg9JbnN0YW5jZVNlcnZpY2USfgoSR2V0SW5zdGFuY2VQcm9maWxlEicubWVtb3MuYXBpLnYxLkdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3QaHS5tZW1vcy5hcGkudjEuSW5zdGFuY2VQcm9maWxlIiCC0+STAhoSGC9hcGkvdjEvaW5zdGFuY2UvcHJvZmlsZRKPAQoSR2V0SW5zdGFuY2VTZXR0aW5nEicubWVtb3MuYXBpLnYxLkdldEluc3RhbmNlU2V0dGluZ1JlcXVlc3QaHS5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nIjHaQQRuYW1lgtPkkwIkEiIvYXBpL3YxL3tuYW1lPWluc3RhbmNlL3NldHRpbmdzLyp9ErUBChVVcGRhdGVJbnN0YW5jZVNldHRpbmcSKi5tZW1vcy5hcGkudjEuVXBkYXRlSW5zdGFuY2VTZXR0aW5nUmVxdWVzdBodLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmciUdpBE3NldHRpbmcsdXBkYXRlX21hc2uC0+STAjU6B3NldHRpbmcyKi9hcGkvdjEve3NldHRpbmcubmFtZT1pbnN0YW5jZS9zZXR0aW5ncy8qfRKeAQoYVGVzdEluc3RhbmNlRW1haWxTZXR0aW5nEi0ubWVtb3MuYXBpLnYxLlRlc3RJbnN0YW5jZUVtYWlsU2V0dGluZ1JlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiO4LT5JMCNToBKiIwL2FwaS92MS9pbnN0YW5jZS9zZXR0aW5ncy9ub3RpZmljYXRpb246dGVzdEVtYWlsEnYKEEdldEluc3RhbmNlU3RhdHMSJS5tZW1vcy5hcGkudjEuR2V0SW5zdGFuY2VTdGF0c1JlcXVlc3QaGy5tZW1vcy5hcGkudjEuSW5zdGFuY2VTdGF0cyIegtPkkwIYEhYvYXBpL3YxL2luc3RhbmNlL3N0YXRzQqwBChBjb20ubWVtb3MuYXBpLnYxQhRJbnN0YW5jZVNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_api_v1_user_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]);
+ fileDesc("Ch1hcGkvdjEvaW5zdGFuY2Vfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxInkKD0luc3RhbmNlUHJvZmlsZRIPCgd2ZXJzaW9uGAIgASgJEgwKBGRlbW8YAyABKAgSFAoMaW5zdGFuY2VfdXJsGAYgASgJEiEKBWFkbWluGAcgASgLMhIubWVtb3MuYXBpLnYxLlVzZXISDgoGY29tbWl0GAggASgJIhsKGUdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3Qi0xUKD0luc3RhbmNlU2V0dGluZxIRCgRuYW1lGAEgASgJQgPgQQgSRwoPZ2VuZXJhbF9zZXR0aW5nGAIgASgLMiwubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5HZW5lcmFsU2V0dGluZ0gAEkcKD3N0b3JhZ2Vfc2V0dGluZxgDIAEoCzIsLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmdIABJQChRtZW1vX3JlbGF0ZWRfc2V0dGluZxgEIAEoCzIwLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuTWVtb1JlbGF0ZWRTZXR0aW5nSAASQQoMdGFnc19zZXR0aW5nGAUgASgLMikubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5UYWdzU2V0dGluZ0gAElEKFG5vdGlmaWNhdGlvbl9zZXR0aW5nGAYgASgLMjEubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5Ob3RpZmljYXRpb25TZXR0aW5nSAASPQoKYWlfc2V0dGluZxgHIAEoCzInLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuQUlTZXR0aW5nSAAahwMKDkdlbmVyYWxTZXR0aW5nEiIKGmRpc2FsbG93X3VzZXJfcmVnaXN0cmF0aW9uGAIgASgIEh4KFmRpc2FsbG93X3Bhc3N3b3JkX2F1dGgYAyABKAgSGQoRYWRkaXRpb25hbF9zY3JpcHQYBCABKAkSGAoQYWRkaXRpb25hbF9zdHlsZRgFIAEoCRJSCg5jdXN0b21fcHJvZmlsZRgGIAEoCzI6Lm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuR2VuZXJhbFNldHRpbmcuQ3VzdG9tUHJvZmlsZRIdChV3ZWVrX3N0YXJ0X2RheV9vZmZzZXQYByABKAUSIAoYZGlzYWxsb3dfY2hhbmdlX3VzZXJuYW1lGAggASgIEiAKGGRpc2FsbG93X2NoYW5nZV9uaWNrbmFtZRgJIAEoCBpFCg1DdXN0b21Qcm9maWxlEg0KBXRpdGxlGAEgASgJEhMKC2Rlc2NyaXB0aW9uGAIgASgJEhAKCGxvZ29fdXJsGAMgASgJGr8DCg5TdG9yYWdlU2V0dGluZxJOCgxzdG9yYWdlX3R5cGUYASABKA4yOC5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLlN0b3JhZ2VTZXR0aW5nLlN0b3JhZ2VUeXBlEhkKEWZpbGVwYXRoX3RlbXBsYXRlGAIgASgJEhwKFHVwbG9hZF9zaXplX2xpbWl0X21iGAMgASgDEkgKCXMzX2NvbmZpZxgEIAEoCzI1Lm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmcuUzNDb25maWcaiwEKCFMzQ29uZmlnEhUKDWFjY2Vzc19rZXlfaWQYASABKAkSHgoRYWNjZXNzX2tleV9zZWNyZXQYAiABKAlCA+BBBBIQCghlbmRwb2ludBgDIAEoCRIOCgZyZWdpb24YBCABKAkSDgoGYnVja2V0GAUgASgJEhYKDnVzZV9wYXRoX3N0eWxlGAYgASgIIkwKC1N0b3JhZ2VUeXBlEhwKGFNUT1JBR0VfVFlQRV9VTlNQRUNJRklFRBAAEgwKCERBVEFCQVNFEAESCQoFTE9DQUwQAhIGCgJTMxADGocBChJNZW1vUmVsYXRlZFNldHRpbmcSHAoUY29udGVudF9sZW5ndGhfbGltaXQYAyABKAUSIAoYZW5hYmxlX2RvdWJsZV9jbGlja19lZGl0GAQgASgIEhEKCXJlYWN0aW9ucxgHIAMoCUoECAIQA1IYZGlzcGxheV93aXRoX3VwZGF0ZV90aW1lGlEKC1RhZ01ldGFkYXRhEiwKEGJhY2tncm91bmRfY29sb3IYASABKAsyEi5nb29nbGUudHlwZS5Db2xvchIUCgxibHVyX2NvbnRlbnQYAiABKAgaqAEKC1RhZ3NTZXR0aW5nEkEKBHRhZ3MYASADKAsyMy5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLlRhZ3NTZXR0aW5nLlRhZ3NFbnRyeRpWCglUYWdzRW50cnkSCwoDa2V5GAEgASgJEjgKBXZhbHVlGAIgASgLMikubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5UYWdNZXRhZGF0YToCOAEaugIKE05vdGlmaWNhdGlvblNldHRpbmcSTQoFZW1haWwYASABKAsyPi5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLk5vdGlmaWNhdGlvblNldHRpbmcuRW1haWxTZXR0aW5nGtMBCgxFbWFpbFNldHRpbmcSDwoHZW5hYmxlZBgBIAEoCBIRCglzbXRwX2hvc3QYAiABKAkSEQoJc210cF9wb3J0GAMgASgFEhUKDXNtdHBfdXNlcm5hbWUYBCABKAkSGgoNc210cF9wYXNzd29yZBgFIAEoCUID4EEEEhIKCmZyb21fZW1haWwYBiABKAkSEQoJZnJvbV9uYW1lGAcgASgJEhAKCHJlcGx5X3RvGAggASgJEg8KB3VzZV90bHMYCSABKAgSDwoHdXNlX3NzbBgKIAEoCBqYAQoJQUlTZXR0aW5nEkEKCXByb3ZpZGVycxgBIAMoCzIuLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuQUlQcm92aWRlckNvbmZpZxJICg10cmFuc2NyaXB0aW9uGAIgASgLMjEubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5UcmFuc2NyaXB0aW9uQ29uZmlnGsYBChBBSVByb3ZpZGVyQ29uZmlnEgoKAmlkGAEgASgJEg0KBXRpdGxlGAIgASgJEjoKBHR5cGUYAyABKA4yLC5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLkFJUHJvdmlkZXJUeXBlEhAKCGVuZHBvaW50GAQgASgJEhQKB2FwaV9rZXkYBSABKAlCA+BBBBIYCgthcGlfa2V5X3NldBgIIAEoCEID4EEDEhkKDGFwaV9rZXlfaGludBgJIAEoCUID4EEDGlsKE1RyYW5zY3JpcHRpb25Db25maWcSEwoLcHJvdmlkZXJfaWQYASABKAkSDQoFbW9kZWwYAiABKAkSEAoIbGFuZ3VhZ2UYAyABKAkSDgoGcHJvbXB0GAQgASgJImoKA0tleRITCg9LRVlfVU5TUEVDSUZJRUQQABILCgdHRU5FUkFMEAESCwoHU1RPUkFHRRACEhAKDE1FTU9fUkVMQVRFRBADEggKBFRBR1MQBBIQCgxOT1RJRklDQVRJT04QBRIGCgJBSRAGIkoKDkFJUHJvdmlkZXJUeXBlEiAKHEFJX1BST1ZJREVSX1RZUEVfVU5TUEVDSUZJRUQQABIKCgZPUEVOQUkQARIKCgZHRU1JTkkQAjph6kFeChxtZW1vcy5hcGkudjEvSW5zdGFuY2VTZXR0aW5nEhtpbnN0YW5jZS9zZXR0aW5ncy97c2V0dGluZ30qEGluc3RhbmNlU2V0dGluZ3MyD2luc3RhbmNlU2V0dGluZ0IHCgV2YWx1ZSJPChlHZXRJbnN0YW5jZVNldHRpbmdSZXF1ZXN0EjIKBG5hbWUYASABKAlCJOBBAvpBHgocbWVtb3MuYXBpLnYxL0luc3RhbmNlU2V0dGluZyKJAQocVXBkYXRlSW5zdGFuY2VTZXR0aW5nUmVxdWVzdBIzCgdzZXR0aW5nGAEgASgLMh0ubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZ0ID4EECEjQKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza0ID4EEBIpMBCh9UZXN0SW5zdGFuY2VFbWFpbFNldHRpbmdSZXF1ZXN0ElIKBWVtYWlsGAEgASgLMj4ubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5Ob3RpZmljYXRpb25TZXR0aW5nLkVtYWlsU2V0dGluZ0ID4EEBEhwKD3JlY2lwaWVudF9lbWFpbBgCIAEoCUID4EEBIhkKF0dldEluc3RhbmNlU3RhdHNSZXF1ZXN0ItIBCg1JbnN0YW5jZVN0YXRzEjsKCGRhdGFiYXNlGAEgASgLMikubWVtb3MuYXBpLnYxLkluc3RhbmNlU3RhdHMuRGF0YWJhc2VTdGF0cxIbChNsb2NhbF9zdG9yYWdlX2J5dGVzGAIgASgDEjIKDmdlbmVyYXRlZF90aW1lGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBozCg1EYXRhYmFzZVN0YXRzEg4KBmRyaXZlchgBIAEoCRISCgpzaXplX2J5dGVzGAIgASgDMvQFCg9JbnN0YW5jZVNlcnZpY2USfgoSR2V0SW5zdGFuY2VQcm9maWxlEicubWVtb3MuYXBpLnYxLkdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3QaHS5tZW1vcy5hcGkudjEuSW5zdGFuY2VQcm9maWxlIiCC0+STAhoSGC9hcGkvdjEvaW5zdGFuY2UvcHJvZmlsZRKPAQoSR2V0SW5zdGFuY2VTZXR0aW5nEicubWVtb3MuYXBpLnYxLkdldEluc3RhbmNlU2V0dGluZ1JlcXVlc3QaHS5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nIjHaQQRuYW1lgtPkkwIkEiIvYXBpL3YxL3tuYW1lPWluc3RhbmNlL3NldHRpbmdzLyp9ErUBChVVcGRhdGVJbnN0YW5jZVNldHRpbmcSKi5tZW1vcy5hcGkudjEuVXBkYXRlSW5zdGFuY2VTZXR0aW5nUmVxdWVzdBodLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmciUdpBE3NldHRpbmcsdXBkYXRlX21hc2uC0+STAjU6B3NldHRpbmcyKi9hcGkvdjEve3NldHRpbmcubmFtZT1pbnN0YW5jZS9zZXR0aW5ncy8qfRKeAQoYVGVzdEluc3RhbmNlRW1haWxTZXR0aW5nEi0ubWVtb3MuYXBpLnYxLlRlc3RJbnN0YW5jZUVtYWlsU2V0dGluZ1JlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiO4LT5JMCNToBKiIwL2FwaS92MS9pbnN0YW5jZS9zZXR0aW5ncy9ub3RpZmljYXRpb246dGVzdEVtYWlsEnYKEEdldEluc3RhbmNlU3RhdHMSJS5tZW1vcy5hcGkudjEuR2V0SW5zdGFuY2VTdGF0c1JlcXVlc3QaGy5tZW1vcy5hcGkudjEuSW5zdGFuY2VTdGF0cyIegtPkkwIYEhYvYXBpL3YxL2luc3RhbmNlL3N0YXRzQqwBChBjb20ubWVtb3MuYXBpLnYxQhRJbnN0YW5jZVNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_api_v1_user_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]);
/**
* Instance profile message containing basic instance information.
@@ -561,6 +561,14 @@ export type InstanceSetting_AISetting = Message<"memos.api.v1.InstanceSetting.AI
* @generated from field: repeated memos.api.v1.InstanceSetting.AIProviderConfig providers = 1;
*/
providers: InstanceSetting_AIProviderConfig[];
+
+ /**
+ * transcription is the speech-to-text feature configuration.
+ * When unset or transcription.provider_id is empty, transcription is disabled.
+ *
+ * @generated from field: memos.api.v1.InstanceSetting.TranscriptionConfig transcription = 2;
+ */
+ transcription?: InstanceSetting_TranscriptionConfig | undefined;
};
/**
@@ -625,6 +633,52 @@ export type InstanceSetting_AIProviderConfig = Message<"memos.api.v1.InstanceSet
export const InstanceSetting_AIProviderConfigSchema: GenMessage<InstanceSetting_AIProviderConfig> = /*@__PURE__*/
messageDesc(file_api_v1_instance_service, 2, 7);
+/**
+ * TranscriptionConfig configures the speech-to-text feature.
+ *
+ * @generated from message memos.api.v1.InstanceSetting.TranscriptionConfig
+ */
+export type InstanceSetting_TranscriptionConfig = Message<"memos.api.v1.InstanceSetting.TranscriptionConfig"> & {
+ /**
+ * provider_id references an entry in AISetting.providers[].id.
+ * Empty string means transcription is disabled.
+ *
+ * @generated from field: string provider_id = 1;
+ */
+ providerId: string;
+
+ /**
+ * model is the provider-specific model identifier.
+ * Empty string falls back to the engine default
+ * (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers).
+ *
+ * @generated from field: string model = 2;
+ */
+ model: string;
+
+ /**
+ * language is the default ISO 639-1 language hint sent to the provider.
+ * Empty string lets the provider auto-detect.
+ *
+ * @generated from field: string language = 3;
+ */
+ language: string;
+
+ /**
+ * prompt is a default spelling/vocabulary hint passed to the provider.
+ *
+ * @generated from field: string prompt = 4;
+ */
+ prompt: string;
+};
+
+/**
+ * Describes the message memos.api.v1.InstanceSetting.TranscriptionConfig.
+ * Use `create(InstanceSetting_TranscriptionConfigSchema)` to create a new message.
+ */
+export const InstanceSetting_TranscriptionConfigSchema: GenMessage<InstanceSetting_TranscriptionConfig> = /*@__PURE__*/
+ messageDesc(file_api_v1_instance_service, 2, 8);
+
/**
* Enumeration of instance setting keys.
*