Files
Memoh/internal/tts/types.go
T
Acbox a04b8fd564 refactor: unify providers and models tables
- Rename `llm_providers` → `providers`, `llm_provider_oauth_tokens` → `provider_oauth_tokens`
- Remove `tts_providers` and `tts_models` tables; speech models now live in the unified `models` table with `type = 'speech'`
- Replace top-level `api_key`/`base_url` columns with a JSONB `config` field on `providers`
- Rename `llm_provider_id` → `provider_id` across all references
- Add `edge-speech` client type and `conf/providers/edge.yaml` default provider
- Create new read-only speech endpoints (`/speech-providers`, `/speech-models`) backed by filtered views of the unified tables
- Remove old TTS CRUD handlers; simplify speech page to read-only + test
- Update registry loader to skip malformed YAML files instead of failing entirely
- Fix YAML quoting for model names containing colons in openrouter.yaml
- Regenerate sqlc, swagger, and TypeScript SDK
2026-04-07 00:26:06 +08:00

53 lines
1.8 KiB
Go

package tts
import "time"
// ProviderMetaResponse exposes adapter metadata (from the registry, not DB).
type ProviderMetaResponse struct {
Provider string `json:"provider"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
DefaultModel string `json:"default_model"`
Models []ModelInfo `json:"models"`
}
// SpeechProviderResponse represents a speech-capable provider from the unified providers table.
type SpeechProviderResponse struct {
ID string `json:"id"`
Name string `json:"name"`
ClientType string `json:"client_type"`
Enable bool `json:"enable"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// SpeechModelResponse represents a speech model from the unified models table.
type SpeechModelResponse struct {
ID string `json:"id"`
ModelID string `json:"model_id"`
Name string `json:"name"`
ProviderID string `json:"provider_id"`
ProviderType string `json:"provider_type,omitempty"`
Config map[string]any `json:"config,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// UpdateSpeechProviderRequest is used for updating a speech provider.
type UpdateSpeechProviderRequest struct {
Name *string `json:"name,omitempty"`
Enable *bool `json:"enable,omitempty"`
}
// UpdateSpeechModelRequest is used for updating a speech model.
type UpdateSpeechModelRequest struct {
Name *string `json:"name,omitempty"`
Config map[string]any `json:"config,omitempty"`
}
// TestSynthesizeRequest represents a text-to-speech test request.
type TestSynthesizeRequest struct {
Text string `json:"text"`
Config map[string]any `json:"config,omitempty"`
}