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.
23 lines
487 B
23 lines
487 B
package ai
|
|
|
|
import "healthapi/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,
|
|
AppID: cfg.Aliyun.AppID,
|
|
})
|
|
case "openai":
|
|
fallthrough
|
|
default:
|
|
return NewOpenAIClient(&Config{
|
|
APIKey: cfg.OpenAI.ApiKey,
|
|
BaseURL: cfg.OpenAI.BaseUrl,
|
|
Model: cfg.OpenAI.Model,
|
|
})
|
|
}
|
|
}
|
|
|