feat(wire): 地基④ wire.go 接 vision/voice/mcp/skill/exec 五个子系统,从死代码变可用
- vision:model.Router 绑 WithVisionModel(LLM_VISION_MODEL);vision.RegisterTools(VisualTool/OCRTool) 用同一 OpenAICompatibleAdapter(LLM_BASE_URL 为空则跳过并 Warn)。 - voice:voice.New(cfg.Voice) Chain(cloud→local→edge-tts/espeak→silent)存 a.voice。 - mcp:读 cfg.MCP.ServersJSON → 逐 Enabled server mcp.NewRegistry(...).Register(ctx)(Connect+ DiscoverTools+RegisterTool),注册 KindMCP 能力 mcp:<name> 供 adminListPlugins 枚举; close() 中 Unregister 防 stdio 子进程孤儿;每 server 15s connect 超时,失败 Warn 跳过。 - skills:LoadDir(configs/skills) → skills.Register 为 KindSkill(Runner.Run 仍 ErrRunPending, 执行留后续)。 - exec/terminal:新 terminalTool(sdk.Tool) 内部调 execProv.Execute,注册进 dispatcher; ExecSandbox.Enabled=false 默认拦截(授权默认关)。 - config:LLMConfig 增 VisionModel(LLM_VISION_MODEL);新增 MCPConfig/ServersJSON(MCPSERVERS_JSON)。 - 拆 5 个辅助文件(vision.go/voice.go/mcp.go/skills.go/terminal_tool.go)避免 wire.go 膨胀; wire.go 最终 535 行。 默认配置下各子系统干净跳过不阻断启动(LLM_BASE_URL 已配则 vision 用主模型降级)。 go build/vet/test 全绿(46 包),gofmt 干净。
This commit is contained in:
1 parent
9b207a31e8
commit
eddb9b9891
8 files changed
+362
-1
No files matched your search
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/logger"
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/multimodal/voice"
|
||||
)
|
||||
|
||||
// wireVoice builds the voice STT/TTS degrading chain from config and stores it
|
||||
// on the app for the WebSocket voice_input/voice_output paths to consume. The
|
||||
// chain degrades cloud → local → edge-tts/espeak → silent, so a missing endpoint
|
||||
// or API key never blocks startup (the design accepts the silent fallback).
|
||||
func (a *app) wireVoice() {
|
||||
a.voice = voice.New(a.cfg.Voice)
|
||||
logger.WithSource(a.log, "cmd/cyrene").Info("voice chain ready",
|
||||
"tts_provider", a.cfg.Voice.TTSProvider,
|
||||
"stt_provider", a.cfg.Voice.STTProvider,
|
||||
"dashscope_configured", a.cfg.Voice.DashscopeAPIKey != "")
|
||||
}
|
||||
Reference in new issue
Block a user