Gucvii commented on code in PR #847:
URL: https://github.com/apache/dubbo-go-samples/pull/847#discussion_r2108592026
##########
llm/go-server/cmd/server.go:
##########
@@ -145,43 +124,51 @@ func (s *ChatServer) Chat(ctx context.Context, req
*chat.ChatRequest, stream cha
}
return stream.Send(&chat.ChatResponse{
Content: string(chunk),
- Model: modelName,
+ Model: cfg.ModelName,
})
}),
)
if err != nil {
- log.Printf("GenerateContent failed with model %s: %v\n",
modelName, err)
- return fmt.Errorf("GenerateContent failed with model %s: %v",
modelName, err)
+ log.Printf("GenerateContent failed with model %s: %v\n",
cfg.ModelName, err)
+ return fmt.Errorf("GenerateContent failed with model %s: %v",
cfg.ModelName, err)
}
+ logger.Infof("GenerateContent successfully with model: %s",
cfg.ModelName)
+
return nil
}
func main() {
-
var err error
cfg, err = config.GetConfig()
if err != nil {
fmt.Printf("Error loading config: %v\n", err)
return
}
- ins, err := dubbo.NewInstance(
- dubbo.WithRegistry(
+ portStr := os.Getenv("SERVER_PORT")
+ if portStr == "" {
+ fmt.Printf("Error: SERVER_PORT environment variable is not
set\n")
+ return
+ }
Review Comment:
Because the script runs server.go directly and passes the env value, it will
not be available through config.go. There is no port specified in .env.example,
and the original intention is to let the script control rather than the
configuration file. In addition, I plan to remove config.go when client can
dynamically get the model list from the server.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]