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:
GitHub Actions
2026-05-07 23:56:05 +08:00
parent 86fbdbc40c
commit a4cedecca6
10 changed files with 1067 additions and 68 deletions

View File

@@ -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)