Commit Graph

3 Commits

Author SHA1 Message Date
selfrelease 96930b585c feat: 优化模型配置管理 - 动态使用优先级最高的Provider
## 主要改进

### 1. 数据库驱动的模型配置
- 新增 GetActiveProviderWithModel() 方法,从数据库获取优先级最高的 Provider 及其默认模型
- 支持多 Provider 配置,通过 priority 字段控制优先级
- 实现 5 分钟缓存机制,减少数据库查询

### 2. 应用模型配置优化
- 移除应用层硬编码模型配置
- 应用自动使用优先级最高的 Provider 的默认模型
- 支持应用级模型覆盖(可选)

### 3. 工具脚本
- check-providers: 查询数据库中的 Provider 和应用配置
- fix-providers: 修复 Provider 配置(补全 config 和 models 字段)
- clear-app-models: 清空应用硬编码模型配置

### 4. 代码质量
- 删除未使用的 getProvider() 方法
- 修复 fmt.Println 冗余换行警告
- 统一代码格式

## 技术细节

**降级策略**:
数据库 Provider (优先级) → 环境变量 Provider → 应用配置模型

**当前配置**:
- 优先级 110: 本地LLM (qwen2.5-7b-instruct)
- 优先级 100: 阿里云百炼 (qwen-plus)

所有 41 个应用现在自动使用本地模型,无需手动配置。
2026-06-22 18:46:44 +08:00
selfrelease fe2c6fb2e4 fix: 修正 OpenAI/Anthropic Provider 初始化参数顺序
修复 manager.go 中两处调用 NewOpenAIProvider 和 NewAnthropicProvider
时参数顺序错误的问题。原代码将 baseURL 和 apiKey 参数传反,导致
API key 被当作 URL 使用,引发 "unsupported protocol scheme" 错误。

Changed:
- LoadProvidersFromDB: 调整参数顺序为 (apiKey, baseURL, "")
- GetActiveProvider: 调整参数顺序为 (apiKey, baseURL, "")
2026-06-22 18:02:23 +08:00
freedakgmail 0f490f72a9 Initial commit: GovAI 政务AI平台 2026-06-15 23:48:37 +08:00