M4b:ai_provider 删除手术①-⑥——神识全面接管模型出口
- ① 后端删除 app/ai_provider/(38 文件,含 anthropic/openai 格式、billing、audio、embedding)、services/ai_provider_admin.py、core/config/model_config.py、tests/ai_provider/(21 文件) - ② 连带退役 application/agent/(旧 Agent 循环/steer/follow-up/确认注册表)、application/skill_executor.py、app/skills/(python skills 孤儿)、endpoints/audio.py、application/imports.py(ProviderManager 消费方);settings 端点收敛为生成偏好 - ③ runs.py 修剪:AgentRunRegistry/steer/follow-up/confirmations 端点退役,保留 list/get/events/cancel/stream;safety 确认改为直接落库裁决(pending→approved/denied) - ④ 前端删除:models 页、ModelGatewayView、gateway.ts、GatewayPanel(玄关)、ModelGatewayPanel/ModelStrategyForm、audio.ts/useVoiceInput、网关类型与 mock;设置页收敛为外观/语言/通知 - ⑤ 配置收敛:config/models|providers|pricing.example.yaml 归档 shenshi/config/;.env.example 删 provider keys/MODEL_ENDPOINT_POOL/MODEL_CONFIG_PATH,收敛 SHENSHI_* - ⑥ 验收:rg 审计灵台 Provider SDK import 与 ai_provider 引用归零;后端 528 passed(2 个预存失败经 HEAD 复跑验证与本手术无关)、前端 type-check+201 passed、神识 go vet+test、BFF 4 passed
This commit is contained in:
1 parent
0d383725b5
commit
462d570751
129 files changed
+81
-15867
No files matched your search
@@ -1,239 +0,0 @@
|
||||
# 魂镜 AI Provider 模型配置
|
||||
# 提供商基础设施配置移到了 config/providers.yaml
|
||||
version: 1
|
||||
|
||||
models:
|
||||
# ==================== DeepSeek ====================
|
||||
|
||||
- name: deepseek-v4-flash
|
||||
display_name: DeepSeek V4 Flash
|
||||
provider: deepseek
|
||||
model: deepseek-v4-flash
|
||||
format: openai
|
||||
tags: [default]
|
||||
supports_tools: true
|
||||
supports_structured_output: true
|
||||
supports_streaming: true
|
||||
supports_thinking: true
|
||||
supports_reasoning_effort: true
|
||||
context_window: 1000000
|
||||
response_reserve: 8192
|
||||
max_output_tokens: 384000
|
||||
timeout_seconds: 300
|
||||
routing_strategy: priority_failover
|
||||
endpoint_pool_enabled: true
|
||||
endpoints:
|
||||
- name: primary
|
||||
model: deepseek-v4-flash
|
||||
priority: 10
|
||||
weight: 100
|
||||
rpm_limit: 2500
|
||||
- name: fallback
|
||||
model: deepseek-v4-pro
|
||||
priority: 20
|
||||
weight: 50
|
||||
|
||||
- name: deepseek-v4-pro
|
||||
display_name: DeepSeek V4 Pro
|
||||
provider: deepseek
|
||||
model: deepseek-v4-pro
|
||||
format: openai
|
||||
tags: [fallback]
|
||||
supports_tools: true
|
||||
supports_structured_output: true
|
||||
supports_streaming: true
|
||||
supports_thinking: true
|
||||
supports_reasoning_effort: true
|
||||
context_window: 1000000
|
||||
response_reserve: 8192
|
||||
max_output_tokens: 384000
|
||||
timeout_seconds: 300
|
||||
routing_strategy: priority_failover
|
||||
endpoint_pool_enabled: true
|
||||
endpoints:
|
||||
- name: primary
|
||||
model: deepseek-v4-pro
|
||||
priority: 10
|
||||
weight: 100
|
||||
|
||||
- name: deepseek-v4-pro-anthropic
|
||||
display_name: DeepSeek Pro(Anthropic 格式)
|
||||
provider: deepseek
|
||||
model: deepseek-v4-pro
|
||||
format: anthropic
|
||||
supports_tools: true
|
||||
supports_structured_output: true
|
||||
supports_streaming: true
|
||||
supports_thinking: true
|
||||
supports_reasoning_effort: true
|
||||
context_window: 1000000
|
||||
response_reserve: 8192
|
||||
max_output_tokens: 384000
|
||||
timeout_seconds: 300
|
||||
endpoints:
|
||||
- name: primary
|
||||
model: deepseek-v4-pro
|
||||
base_url_env: DEEPSEEK_ANTHROPIC_BASE_URL
|
||||
priority: 10
|
||||
weight: 100
|
||||
|
||||
# ==================== Anthropic / Claude ====================
|
||||
|
||||
- name: claude-sonnet
|
||||
display_name: Claude Sonnet
|
||||
provider: anthropic
|
||||
model: claude-sonnet-4-6
|
||||
format: anthropic
|
||||
supports_tools: true
|
||||
supports_structured_output: true
|
||||
supports_streaming: true
|
||||
supports_thinking: true
|
||||
supports_reasoning_effort: true
|
||||
supports_vision: true
|
||||
context_window: 1000000
|
||||
response_reserve: 16000
|
||||
max_output_tokens: 16000
|
||||
timeout_seconds: 60
|
||||
reasoning_effort: medium
|
||||
|
||||
- name: claude-haiku
|
||||
display_name: Claude Haiku
|
||||
provider: anthropic
|
||||
model: claude-haiku-4-5
|
||||
format: anthropic
|
||||
supports_tools: true
|
||||
supports_structured_output: true
|
||||
supports_streaming: true
|
||||
supports_vision: true
|
||||
context_window: 200000
|
||||
response_reserve: 4096
|
||||
max_output_tokens: 4096
|
||||
timeout_seconds: 60
|
||||
|
||||
- name: claude-fable
|
||||
display_name: Claude Fable 5
|
||||
provider: anthropic
|
||||
model: claude-fable-5
|
||||
format: anthropic
|
||||
supports_tools: true
|
||||
supports_structured_output: true
|
||||
supports_streaming: true
|
||||
supports_thinking: true
|
||||
supports_reasoning_effort: true
|
||||
supports_vision: true
|
||||
context_window: 1000000
|
||||
response_reserve: 16000
|
||||
max_output_tokens: 16000
|
||||
timeout_seconds: 120
|
||||
reasoning_effort: high
|
||||
|
||||
# ==================== Embedding ====================
|
||||
|
||||
# 本地元炁推理引擎(默认,零配置可用)
|
||||
- name: bge-m3
|
||||
display_name: BGE-M3 Embedding(元炁本地)
|
||||
provider: yuanqi
|
||||
model: bge-m3
|
||||
format: openai
|
||||
tags: [embedding]
|
||||
timeout_seconds: 30
|
||||
dimensions: 1024
|
||||
endpoints:
|
||||
- name: primary
|
||||
model: bge-m3
|
||||
base_url_env: YUANQI_BASE_URL
|
||||
api_key_env: YUANQI_API_KEY
|
||||
priority: 10
|
||||
weight: 100
|
||||
|
||||
# 云端备选(配好 API_KEY 后改为默认)
|
||||
# - name: text-embedding-3-small
|
||||
# display_name: Text Embedding 3 Small
|
||||
# provider: deepseek
|
||||
# model: text-embedding-3-small
|
||||
# format: openai
|
||||
# tags: [embedding]
|
||||
# timeout_seconds: 60
|
||||
# dimensions: 1536
|
||||
|
||||
# ==================== 小米 MiMo ====================
|
||||
|
||||
- name: mimo-v2.5-pro
|
||||
display_name: MiMo v2.5 Pro
|
||||
provider: xiaomi
|
||||
model: mimo-v2.5-pro
|
||||
format: openai
|
||||
supports_tools: true
|
||||
supports_structured_output: true
|
||||
supports_streaming: true
|
||||
supports_reasoning_effort: true
|
||||
supports_vision: true
|
||||
context_window: 128000
|
||||
response_reserve: 8192
|
||||
max_output_tokens: 32768
|
||||
timeout_seconds: 300
|
||||
routing_strategy: priority_failover
|
||||
endpoint_pool_enabled: true
|
||||
endpoints:
|
||||
- name: primary
|
||||
model: mimo-v2.5-pro
|
||||
priority: 10
|
||||
weight: 100
|
||||
|
||||
- name: mimo-v2.5
|
||||
display_name: MiMo v2.5
|
||||
provider: xiaomi
|
||||
model: mimo-v2.5
|
||||
format: openai
|
||||
supports_tools: true
|
||||
supports_structured_output: true
|
||||
supports_streaming: true
|
||||
supports_vision: true
|
||||
context_window: 128000
|
||||
response_reserve: 4096
|
||||
max_output_tokens: 16384
|
||||
timeout_seconds: 180
|
||||
|
||||
- name: mimo-v2.5-asr
|
||||
display_name: MiMo v2.5 ASR
|
||||
provider: xiaomi
|
||||
model: mimo-v2.5-asr
|
||||
format: openai
|
||||
tags: [asr]
|
||||
context_window: 0
|
||||
timeout_seconds: 120
|
||||
endpoints:
|
||||
- name: primary
|
||||
model: mimo-v2.5-asr
|
||||
priority: 10
|
||||
weight: 100
|
||||
|
||||
- name: mimo-v2.5-tts
|
||||
display_name: MiMo v2.5 TTS
|
||||
provider: xiaomi
|
||||
model: mimo-v2.5-tts
|
||||
format: openai
|
||||
tags: [tts]
|
||||
supports_streaming: true
|
||||
context_window: 0
|
||||
timeout_seconds: 120
|
||||
|
||||
- name: mimo-v2.5-tts-voiceclone
|
||||
display_name: MiMo v2.5 TTS 声纹克隆
|
||||
provider: xiaomi
|
||||
model: mimo-v2.5-tts-voiceclone
|
||||
format: openai
|
||||
tags: [tts, voice_clone]
|
||||
supports_streaming: true
|
||||
context_window: 0
|
||||
timeout_seconds: 300
|
||||
|
||||
- name: mimo-v2.5-tts-voicedesign
|
||||
display_name: MiMo v2.5 TTS 音色设计
|
||||
provider: xiaomi
|
||||
model: mimo-v2.5-tts-voicedesign
|
||||
format: openai
|
||||
tags: [tts, voice_design]
|
||||
supports_streaming: true
|
||||
context_window: 0
|
||||
timeout_seconds: 300
|
||||
@@ -1,52 +0,0 @@
|
||||
# 魂镜 AI Provider 定价配置
|
||||
# 独立于模型配置,按厂商嵌套组织,便于维护和更新。
|
||||
# 按模型逻辑名(models.yaml 中的 name 字段)索引。
|
||||
version: 1
|
||||
|
||||
pricing:
|
||||
# ==================== DeepSeek ====================
|
||||
deepseek:
|
||||
deepseek-v4-flash:
|
||||
currency: CNY
|
||||
input_per_1m: 1.0
|
||||
input_cache_read_per_1m: 0.02
|
||||
output_per_1m: 2.0
|
||||
deepseek-v4-pro:
|
||||
currency: CNY
|
||||
input_per_1m: 3.0
|
||||
input_cache_read_per_1m: 0.025
|
||||
output_per_1m: 6.0
|
||||
deepseek-v4-pro-anthropic:
|
||||
currency: CNY
|
||||
input_per_1m: 3.0
|
||||
output_per_1m: 6.0
|
||||
|
||||
# ==================== Anthropic / Claude ====================
|
||||
anthropic:
|
||||
claude-sonnet:
|
||||
currency: USD
|
||||
input_per_1m: 3.0
|
||||
output_per_1m: 15.0
|
||||
claude-haiku:
|
||||
currency: USD
|
||||
input_per_1m: 1.0
|
||||
output_per_1m: 5.0
|
||||
claude-fable:
|
||||
currency: USD
|
||||
input_per_1m: 10.0
|
||||
output_per_1m: 50.0
|
||||
|
||||
# ==================== 小米 MiMo ====================
|
||||
xiaomi:
|
||||
mimo-v2.5-pro:
|
||||
currency: CNY
|
||||
input_per_1m: 4.0
|
||||
output_per_1m: 12.0
|
||||
mimo-v2.5:
|
||||
currency: CNY
|
||||
input_per_1m: 1.0
|
||||
output_per_1m: 4.0
|
||||
mimo-v2.5-asr:
|
||||
currency: CNY
|
||||
input_per_1m: null
|
||||
output_per_1m: null
|
||||
@@ -1,58 +0,0 @@
|
||||
# Provider infrastructure configuration — base URL, API key env vars,
|
||||
# parameter mappings, retry/timeout settings.
|
||||
# Copy as config/providers.yaml and fill in your API keys in .env
|
||||
version: 1
|
||||
|
||||
providers:
|
||||
deepseek:
|
||||
format: openai
|
||||
base_url_env: DEEPSEEK_BASE_URL
|
||||
api_key_env: DEEPSEEK_API_KEY
|
||||
timeout_seconds: 300
|
||||
max_retries: 2
|
||||
parameter_mappings:
|
||||
temperature: { provider_param: temperature, min: 0, max: 2, default: 1.0 }
|
||||
max_tokens: { provider_param: max_tokens, min: 1 }
|
||||
top_p: { provider_param: top_p, min: 0, max: 1 }
|
||||
stop: { provider_param: stop }
|
||||
frequency_penalty: { provider_param: frequency_penalty, min: -2, max: 2 }
|
||||
presence_penalty: { provider_param: presence_penalty, min: -2, max: 2 }
|
||||
|
||||
anthropic:
|
||||
format: anthropic
|
||||
base_url_env: ANTHROPIC_BASE_URL
|
||||
api_key_env: ANTHROPIC_API_KEY
|
||||
timeout_seconds: 120
|
||||
max_retries: 1
|
||||
parameter_mappings:
|
||||
max_tokens: { provider_param: max_tokens, default: 4096 }
|
||||
thinking: { provider_param: thinking }
|
||||
metadata: { provider_param: metadata }
|
||||
|
||||
xiaomi:
|
||||
format: openai
|
||||
base_url_env: XIAOMI_MIMO_BASE_URL
|
||||
api_key_env: XIAOMI_MIMO_API_KEY
|
||||
timeout_seconds: 300
|
||||
max_retries: 2
|
||||
parameter_mappings:
|
||||
temperature: { provider_param: temperature, min: 0, max: 2, default: 1.0 }
|
||||
max_tokens: { provider_param: max_tokens, min: 1 }
|
||||
|
||||
google:
|
||||
format: openai
|
||||
base_url_env: GOOGLE_BASE_URL
|
||||
api_key_env: GOOGLE_API_KEY
|
||||
timeout_seconds: 60
|
||||
max_retries: 1
|
||||
parameter_mappings:
|
||||
temperature: { provider_param: temperature, min: 0, max: 2 }
|
||||
max_tokens: { provider_param: max_tokens, min: 1 }
|
||||
top_p: { provider_param: top_p, min: 0, max: 1 }
|
||||
|
||||
yuanqi:
|
||||
format: openai
|
||||
base_url_env: YUANQI_BASE_URL
|
||||
api_key_env: YUANQI_API_KEY
|
||||
timeout_seconds: 30
|
||||
max_retries: 1
|
||||
Reference in new issue
Block a user