feat(ai): Agent SSE + Anthropic/responses tools + P1 确认写

- Agent 支持 SSE(步骤边推、正文分块),JSON 非流式 fallback
- tool calling 覆盖 openai-chat / anthropic / responses(单测解析回灌)
- P1:mcp.json mode=read_write 才可写;需 confirm_danger;Agent 剥离模型自带令牌
- GET /api/ai/mcp-status、POST /api/ai/agent/confirm;审计 source=mcp|agent
This commit is contained in:
logan committed 2026-10-15 13:00:40 +08:00
1 parent 1d6e89449a
commit 2336c9433c
17 files changed
+1324 -197

No files matched your search

+16 -5
View File
@@ -7,12 +7,16 @@ import (
"strings"
)
// Config AI 配置;provider: stub|openai(OpenAI 兼容协议)。
// Config AI 配置;provider 为预设 id(stub|openai|deepseek|anthropic|ollama|custom…),
// protocol/authStyle/allowInsecureHTTP 决定远端调用行为(见 remote.go)。
type Config struct {
Provider string `json:"provider"`
BaseURL string `json:"baseURL"`
APIKey string `json:"apiKey,omitempty"`
Model string `json:"model"`
Provider string `json:"provider"`
BaseURL string `json:"baseURL"`
APIKey string `json:"apiKey,omitempty"`
Model string `json:"model"`
Protocol string `json:"protocol,omitempty"`
AuthStyle string `json:"authStyle,omitempty"`
AllowInsecureHTTP bool `json:"allowInsecureHttp,omitempty"`
}
func configPath() (string, error) {
@@ -47,6 +51,13 @@ func LoadConfig() Config {
if f.Model != "" {
cfg.Model = f.Model
}
if f.Protocol != "" {
cfg.Protocol = f.Protocol
}
if f.AuthStyle != "" {
cfg.AuthStyle = f.AuthStyle
}
cfg.AllowInsecureHTTP = f.AllowInsecureHTTP
}
}
}