You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
459 B
22 lines
459 B
package ai
|
|
|
|
import "health-ai/internal/config"
|
|
|
|
// NewAIClient 根据配置创建 AI 客户端
|
|
func NewAIClient(cfg *config.AIConfig) AIClient {
|
|
switch cfg.Provider {
|
|
case "aliyun":
|
|
return NewAliyunClient(&Config{
|
|
APIKey: cfg.Aliyun.APIKey,
|
|
Model: cfg.Aliyun.Model,
|
|
})
|
|
case "openai":
|
|
fallthrough
|
|
default:
|
|
return NewOpenAIClient(&Config{
|
|
APIKey: cfg.OpenAI.APIKey,
|
|
BaseURL: cfg.OpenAI.BaseURL,
|
|
Model: cfg.OpenAI.Model,
|
|
})
|
|
}
|
|
}
|
|
|