feat(ai): 扩展 AiConfig 支持多 Provider 配置

- config/default.toml 新增 providers 子段(claude/openai/ollama)
- erp-server/config.rs AiConfig 新增 quota_check_enabled + providers HashMap
- erp-ai/config.rs 新增 ProviderType 枚举 + ProviderConfig 结构体
This commit is contained in:
iven
2026-05-05 15:01:24 +08:00
parent 93f6e87220
commit 4d02b2b531
4 changed files with 138 additions and 0 deletions

View File

@@ -48,6 +48,33 @@ max_tokens = 2048
temperature = 0.3
cache_ttl_seconds = 604800
rate_limit_patient_daily = 10
quota_check_enabled = true
[ai.providers.claude]
provider_type = "claude"
api_key_env = "ANTHROPIC_API_KEY"
base_url = "https://api.anthropic.com"
default_model = "claude-sonnet-4-6"
max_tokens = 2048
temperature = 0.3
is_enabled = true
[ai.providers.openai]
provider_type = "openai"
api_key_env = "OPENAI_API_KEY"
base_url = "https://api.openai.com"
default_model = "gpt-4o"
max_tokens = 2048
temperature = 0.3
is_enabled = false
[ai.providers.ollama]
provider_type = "ollama"
base_url = "http://localhost:11434"
default_model = "qwen2.5:7b"
max_tokens = 2048
temperature = 0.3
is_enabled = false
[storage]
upload_dir = "./uploads"