@@ -65,44 +65,42 @@ func (r *P2P) Run(ctx *cliContext.Context) error {
65
65
return err
66
66
}
67
67
log .Info ().Msgf ("You need to start llama-cpp-rpc-server on '%s:%s'" , address , p )
68
+ } else {
69
+ // Start llama.cpp directly from the version we have pre-packaged
70
+ go func () {
71
+ for {
72
+ log .Info ().Msgf ("Starting llama-cpp-rpc-server on '%s:%d'" , address , port )
68
73
69
- return nil
70
- }
71
-
72
- // Start llama.cpp directly from the version we have pre-packaged
73
- go func () {
74
- for {
75
- log .Info ().Msgf ("Starting llama-cpp-rpc-server on '%s:%d'" , address , port )
74
+ grpcProcess := assets .ResolvePath (
75
+ r .BackendAssetsPath ,
76
+ "util" ,
77
+ "llama-cpp-rpc-server" ,
78
+ )
76
79
77
- grpcProcess := assets .ResolvePath (
78
- r .BackendAssetsPath ,
79
- "util" ,
80
- "llama-cpp-rpc-server" ,
81
- )
80
+ args := append ([]string {"--host" , address , "--port" , fmt .Sprint (port )}, r .ExtraLLamaCPPArgs ... )
81
+ args , grpcProcess = library .LoadLDSO (r .BackendAssetsPath , args , grpcProcess )
82
82
83
- args := append ([]string {"--host" , address , "--port" , fmt .Sprint (port )}, r .ExtraLLamaCPPArgs ... )
84
- args , grpcProcess = library .LoadLDSO (r .BackendAssetsPath , args , grpcProcess )
83
+ cmd := exec .Command (
84
+ grpcProcess , args ... ,
85
+ )
85
86
86
- cmd := exec .Command (
87
- grpcProcess , args ... ,
88
- )
87
+ cmd .Env = os .Environ ()
89
88
90
- cmd .Env = os .Environ ()
89
+ cmd .Stderr = os .Stdout
90
+ cmd .Stdout = os .Stdout
91
91
92
- cmd .Stderr = os .Stdout
93
- cmd .Stdout = os .Stdout
92
+ if err := cmd .Start (); err != nil {
93
+ log .Error ().Any ("grpcProcess" , grpcProcess ).Any ("args" , args ).Err (err ).Msg ("Failed to start llama-cpp-rpc-server" )
94
+ }
94
95
95
- if err := cmd .Start (); err != nil {
96
- log .Error ().Any ("grpcProcess" , grpcProcess ).Any ("args" , args ).Err (err ).Msg ("Failed to start llama-cpp-rpc-server" )
96
+ cmd .Wait ()
97
97
}
98
+ }()
98
99
99
- cmd .Wait ()
100
+ _ , err = p2p .ExposeService (context .Background (), address , fmt .Sprint (port ), r .Token , p2p .NetworkID (r .Peer2PeerNetworkID , p2p .WorkerID ))
101
+ if err != nil {
102
+ return err
100
103
}
101
- }()
102
-
103
- _ , err = p2p .ExposeService (context .Background (), address , fmt .Sprint (port ), r .Token , p2p .NetworkID (r .Peer2PeerNetworkID , p2p .WorkerID ))
104
- if err != nil {
105
- return err
106
104
}
107
105
108
106
for {
0 commit comments