Copilot commented on code in PR #678:
URL: https://github.com/apache/dubbo-go-pixiu/pull/678#discussion_r2101880126
##########
pkg/server/cluster_manager.go:
##########
@@ -215,17 +219,67 @@ func (cm *ClusterManager) HasCluster(clusterName string)
bool {
}
func (s *ClusterStore) AddCluster(c *model.ClusterConfig) {
+ atomic.SwapInt32(&endpointIndex, 1)
Review Comment:
The variable `endpointIndex` is declared and reset here but never used
elsewhere; consider removing it or using it to generate unique endpoint IDs.
##########
pkg/server/cluster_manager.go:
##########
@@ -215,17 +219,67 @@ func (cm *ClusterManager) HasCluster(clusterName string)
bool {
}
func (s *ClusterStore) AddCluster(c *model.ClusterConfig) {
+ atomic.SwapInt32(&endpointIndex, 1)
+
if c.Name == "" {
index := atomic.AddInt32(&clusterIndex, 1)
c.Name = fmt.Sprintf("cluster%d", index)
}
+
+ s.AssembleLLMClusterEndpoints(c)
+
s.Config = append(s.Config, c)
s.clustersMap[c.Name] = cluster.NewCluster(c)
c.CreateConsistentHash()
}
-func (s *ClusterStore) UpdateCluster(new *model.ClusterConfig) {
+// AssembleLLMClusterEndpoints assembles the LLM cluster endpoints
+// by setting the name and domains for each endpoint
+// based on the LLM provider denoted in the endpoint LLMMeta.
+func (s *ClusterStore) AssembleLLMClusterEndpoints(c *model.ClusterConfig) {
+ if c == nil {
+ return
+ }
+
+ // Map to keep track of the number of endpoints for each provider
+ providerCounts := make(map[string]int)
+
+ for _, endpoint := range c.Endpoints {
Review Comment:
`LLMMeta.ID` is never assigned within `AssembleLLMClusterEndpoints`, leaving
endpoint IDs blank; consider populating `ID` (e.g., from `Name` or an
incremented index).
##########
pkg/model/cluster.go:
##########
@@ -94,6 +94,8 @@ type (
Address SocketAddress `yaml:"socket_address"
json:"socket_address" mapstructure:"socket_address"` // Address socket address
Metadata map[string]string `yaml:"meta" json:"meta"`
// Metadata extra info such as label or
other meta data
UnHealthy bool
+
+ LLMMeta *LLMMeta `yaml:"llm_meta" json:"llm_meta"` // LLMMeta
extra info such as label or other meta data
Review Comment:
For consistency with other struct fields, consider adding a
`mapstructure:"llm_meta"` tag to ensure proper unmarshalling from YAML.
```suggestion
LLMMeta *LLMMeta `yaml:"llm_meta" json:"llm_meta"
mapstructure:"llm_meta"` // LLMMeta extra info such as label or other meta data
```
--
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]