|
@@ -5,6 +5,7 @@ import (
|
|
|
"bytes"
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
|
+ "eta/eta_api/models"
|
|
|
"eta/eta_api/utils"
|
|
|
"eta/eta_api/utils/llm"
|
|
|
"eta/eta_api/utils/llm/eta_llm/eta_llm_http"
|
|
@@ -33,13 +34,28 @@ type ETALLMClient struct {
|
|
|
*llm.LLMClient
|
|
|
LlmModel string
|
|
|
}
|
|
|
+type LLMConfig struct {
|
|
|
+ LlmAddress string `json:"llm_server"`
|
|
|
+ LlmModel string `json:"llm_model"`
|
|
|
+}
|
|
|
|
|
|
func GetInstance() llm.LLMService {
|
|
|
dsOnce.Do(func() {
|
|
|
+ confStr := models.BusinessConfMap[models.LLMInitConfig]
|
|
|
+ if confStr == "" {
|
|
|
+ utils.FileLog.Error("LLM配置为空")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var config LLMConfig
|
|
|
+ err := json.Unmarshal([]byte(confStr), &config)
|
|
|
+ if err != nil {
|
|
|
+ utils.FileLog.Error("LLM配置错误")
|
|
|
+ }
|
|
|
if etaLlmClient == nil {
|
|
|
etaLlmClient = &ETALLMClient{
|
|
|
- LLMClient: llm.NewLLMClient(utils.LLM_SERVER, 120),
|
|
|
- LlmModel: utils.LLM_MODEL,
|
|
|
+ LLMClient: llm.NewLLMClient(config.LlmAddress, 120),
|
|
|
+ LlmModel: config.LlmModel,
|
|
|
}
|
|
|
}
|
|
|
})
|