mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 00:54:23 +00:00
Merge main into refactor/instance-split
Resolved conflicts in: - pkg/instance/instance.go: Combined remote detection logic from main with refactored structure - pkg/manager/manager_test.go: Updated manager initialization to include localNodeName parameter - pkg/manager/remote_ops.go: Removed stripNodesFromOptions function that was deleted in main - pkg/manager/remote_ops_test.go: Removed file that was deleted in main 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -10,31 +10,10 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// stripNodesFromOptions creates a copy of the instance options without the Nodes field
|
||||
// to prevent routing loops when sending requests to remote nodes
|
||||
func (im *instanceManager) stripNodesFromOptions(options *instance.Options) *instance.Options {
|
||||
if options == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Create a copy of the options struct
|
||||
optionsCopy := *options
|
||||
|
||||
// Clear the Nodes field to prevent the remote node from trying to route further
|
||||
optionsCopy.Nodes = nil
|
||||
|
||||
return &optionsCopy
|
||||
}
|
||||
|
||||
// makeRemoteRequest is a helper function to make HTTP requests to a remote node
|
||||
func (im *instanceManager) makeRemoteRequest(nodeConfig *config.NodeConfig, method, path string, body any) (*http.Response, error) {
|
||||
var reqBody io.Reader
|
||||
if body != nil {
|
||||
// Strip nodes from CreateInstanceOptions to prevent routing loops
|
||||
if options, ok := body.(*instance.Options); ok {
|
||||
body = im.stripNodesFromOptions(options)
|
||||
}
|
||||
|
||||
jsonData, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal request body: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user