Add Docker Compose Lingma bootstrap support
Package the proxy for Docker Compose deployments and add Lingma bootstrap, session restore, and runtime status support for containerized remote usage. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -116,6 +116,8 @@ func NewServer(addr string, svc *service.Service) *Server {
|
||||
mux.HandleFunc("/api/tags", s.handleOllamaTags)
|
||||
mux.HandleFunc("/v1/props", s.handleModelProps)
|
||||
mux.HandleFunc("/props", s.handleModelProps)
|
||||
mux.HandleFunc("/v1/runtime/status", s.handleRuntimeStatus)
|
||||
mux.HandleFunc("/runtime/status", s.handleRuntimeStatus)
|
||||
mux.HandleFunc("/version", s.handleVersion)
|
||||
mux.HandleFunc("/v1/messages/count_tokens", s.handleAnthropicCountTokens)
|
||||
mux.HandleFunc("/v1/messages", s.handleAnthropicMessages)
|
||||
@@ -184,6 +186,27 @@ func (s *Server) handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) handleRuntimeStatus(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == http.MethodOptions {
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
}
|
||||
if r.Method == http.MethodHead {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
return
|
||||
}
|
||||
if r.Method != http.MethodGet {
|
||||
writeOpenAIError(w, http.StatusMethodNotAllowed, "invalid_request_error", "method not allowed")
|
||||
return
|
||||
}
|
||||
state := s.svc.State()
|
||||
writeJSON(w, http.StatusOK, map[string]any{
|
||||
"ok": state.Connected,
|
||||
"service": "lingma-proxy",
|
||||
"state": state,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) handleDebugRequests(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == http.MethodOptions {
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
|
||||
Reference in New Issue
Block a user