Gucvii commented on code in PR #823:
URL: https://github.com/apache/dubbo-go-samples/pull/823#discussion_r2030052426


##########
llm/go-server/cmd/server.go:
##########
@@ -23,38 +23,54 @@ import (
        "fmt"
        "log"
        "net/http"
-       "os"
        "runtime/debug"
+       "strings"
 )
 
 import (
        _ "dubbo.apache.org/dubbo-go/v3/imports"
        "dubbo.apache.org/dubbo-go/v3/protocol"
        "dubbo.apache.org/dubbo-go/v3/server"
 
-       "github.com/joho/godotenv"
-
        "github.com/tmc/langchaingo/llms"
        "github.com/tmc/langchaingo/llms/ollama"
 )
 
 import (
+       "github.com/apache/dubbo-go-samples/llm/config"
        chat "github.com/apache/dubbo-go-samples/llm/proto"
 )
 
 type ChatServer struct {
-       llm *ollama.LLM
+       llms map[string]*ollama.LLM
 }
 
 func NewChatServer() (*ChatServer, error) {
-       llm, err := ollama.New(
-               ollama.WithModel(os.Getenv("OLLAMA_MODEL")),
-               ollama.WithServerURL(os.Getenv("OLLAMA_URL")),
-       )
+       cfg, err := config.GetConfig()
        if err != nil {
-               return nil, err
+               return nil, fmt.Errorf("Error loading config: %v\n", err)
        }
-       return &ChatServer{llm: llm}, nil
+
+       llmMap := make(map[string]*ollama.LLM)
+
+       for _, model := range cfg.OllamaModels {
+               model = strings.TrimSpace(model)

Review Comment:
   因为集中到一块的时候,删除冗余重复的代码还有所疏漏,感谢



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to