feat: 添加 TTS 语音朗读功能 (v0.2.0)
Some checks failed
Release / build (push) Failing after 6m27s

This commit is contained in:
2026-04-26 03:01:28 +08:00
parent 3f9443c14b
commit e4e5cd82c3
6 changed files with 167 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ type ProjectConfig struct {
Streaming StreamingConfig `yaml:"streaming"`
Markdown MarkdownConfig `yaml:"markdown"`
UI UIConfig `yaml:"ui"`
TTS TTSConfig `yaml:"tts"`
}
type StreamingConfig struct {
@@ -29,6 +30,12 @@ type UIConfig struct {
UserPrefix string `yaml:"user_prefix"`
}
type TTSConfig struct {
Enabled bool `yaml:"enabled"`
Port int `yaml:"port"`
Auto bool `yaml:"auto"`
}
var (
defaultCfg = ProjectConfig{
Streaming: StreamingConfig{
@@ -43,6 +50,11 @@ var (
Logo: "🦐",
UserPrefix: "👀 ",
},
TTS: TTSConfig{
Enabled: false,
Port: 9876,
Auto: true,
},
}
projCfg *ProjectConfig
projCfgLock sync.RWMutex
@@ -90,6 +102,9 @@ func LoadProjectConfig() error {
if cfg.UI.UserPrefix == "" {
cfg.UI.UserPrefix = defaultCfg.UI.UserPrefix
}
if cfg.TTS.Port <= 0 {
cfg.TTS.Port = defaultCfg.TTS.Port
}
projCfg = &cfg
return nil