- 切换到 bigmodel_async endpoint 并启用 enable_nonstream - 第一遍流式识别提供实时文字预览 - VAD 分句后自动触发第二遍非流式识别提升准确率 - 修改文本处理逻辑从累加改为替换(适配 full 模式) - 统一配置字段命名:app_key → app_id, access_key → access_token
60 lines
1.2 KiB
Go
60 lines
1.2 KiB
Go
package config
|
|
|
|
import (
|
|
"sync/atomic"
|
|
)
|
|
|
|
// DoubaoConfig holds 火山引擎豆包 ASR credentials.
|
|
type DoubaoConfig struct {
|
|
AppID string `yaml:"app_id"`
|
|
AccessToken string `yaml:"access_token"`
|
|
ResourceID string `yaml:"resource_id"`
|
|
}
|
|
|
|
// SecurityConfig holds authentication settings.
|
|
type SecurityConfig struct {
|
|
Token string `yaml:"token"`
|
|
}
|
|
|
|
// ServerConfig holds server settings.
|
|
type ServerConfig struct {
|
|
Port int `yaml:"port"`
|
|
TLSAuto bool `yaml:"tls_auto"`
|
|
}
|
|
|
|
// Config is the top-level configuration.
|
|
type Config struct {
|
|
Doubao DoubaoConfig `yaml:"doubao"`
|
|
Server ServerConfig `yaml:"server"`
|
|
Security SecurityConfig `yaml:"security"`
|
|
}
|
|
|
|
// defaults returns a Config with default values.
|
|
func defaults() Config {
|
|
return Config{
|
|
Doubao: DoubaoConfig{
|
|
ResourceID: "volc.seedasr.sauc.duration",
|
|
},
|
|
Server: ServerConfig{
|
|
Port: 8443,
|
|
TLSAuto: true,
|
|
},
|
|
}
|
|
}
|
|
|
|
// global holds the current config atomically for concurrent reads.
|
|
var global atomic.Value
|
|
|
|
// Get returns the current config snapshot. Safe for concurrent use.
|
|
func Get() Config {
|
|
if v := global.Load(); v != nil {
|
|
return v.(Config)
|
|
}
|
|
return defaults()
|
|
}
|
|
|
|
// store updates the global config.
|
|
func store(cfg Config) {
|
|
global.Store(cfg)
|
|
}
|