diff --git a/pkg/server/handlers_backends.go b/pkg/server/handlers_backends.go index 4bc97ee..fe5e5a6 100644 --- a/pkg/server/handlers_backends.go +++ b/pkg/server/handlers_backends.go @@ -168,7 +168,7 @@ func parseHelper(w http.ResponseWriter, r *http.Request, backend interface { // @Success 200 {object} instance.Options "Parsed options" // @Failure 400 {object} map[string]string "Invalid request or command" // @Failure 500 {object} map[string]string "Internal Server Error" -// @Router /backends/llama-cpp/parse-command [post] +// @Router /api/v1/backends/llama-cpp/parse-command [post] func (h *Handler) ParseLlamaCommand() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { parsedOptions, ok := parseHelper(w, r, &backends.LlamaServerOptions{}) @@ -197,7 +197,7 @@ func (h *Handler) ParseLlamaCommand() http.HandlerFunc { // @Param request body ParseCommandRequest true "Command to parse" // @Success 200 {object} instance.Options "Parsed options" // @Failure 400 {object} map[string]string "Invalid request or command" -// @Router /backends/mlx/parse-command [post] +// @Router /api/v1/backends/mlx/parse-command [post] func (h *Handler) ParseMlxCommand() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { parsedOptions, ok := parseHelper(w, r, &backends.MlxServerOptions{}) @@ -226,7 +226,7 @@ func (h *Handler) ParseMlxCommand() http.HandlerFunc { // @Param request body ParseCommandRequest true "Command to parse" // @Success 200 {object} instance.Options "Parsed options" // @Failure 400 {object} map[string]string "Invalid request or command" -// @Router /backends/vllm/parse-command [post] +// @Router /api/v1/backends/vllm/parse-command [post] func (h *Handler) ParseVllmCommand() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { parsedOptions, ok := parseHelper(w, r, &backends.VllmServerOptions{}) @@ -266,7 +266,7 @@ func (h *Handler) executeLlamaServerCommand(flag, errorMsg string) http.HandlerF // @Produces text/plain // @Success 200 {string} string "Help text" // @Failure 500 {string} string "Internal Server Error" -// @Router /backends/llama-cpp/help [get] +// @Router /api/v1/backends/llama-cpp/help [get] func (h *Handler) LlamaServerHelpHandler() http.HandlerFunc { return h.executeLlamaServerCommand("--help", "Failed to get help") } @@ -279,7 +279,7 @@ func (h *Handler) LlamaServerHelpHandler() http.HandlerFunc { // @Produces text/plain // @Success 200 {string} string "Version information" // @Failure 500 {string} string "Internal Server Error" -// @Router /backends/llama-cpp/version [get] +// @Router /api/v1/backends/llama-cpp/version [get] func (h *Handler) LlamaServerVersionHandler() http.HandlerFunc { return h.executeLlamaServerCommand("--version", "Failed to get version") } @@ -292,7 +292,7 @@ func (h *Handler) LlamaServerVersionHandler() http.HandlerFunc { // @Produces text/plain // @Success 200 {string} string "List of devices" // @Failure 500 {string} string "Internal Server Error" -// @Router /backends/llama-cpp/devices [get] +// @Router /api/v1/backends/llama-cpp/devices [get] func (h *Handler) LlamaServerListDevicesHandler() http.HandlerFunc { return h.executeLlamaServerCommand("--list-devices", "Failed to list devices") } diff --git a/pkg/server/handlers_instances.go b/pkg/server/handlers_instances.go index 8a2edb9..c1dfd5b 100644 --- a/pkg/server/handlers_instances.go +++ b/pkg/server/handlers_instances.go @@ -21,7 +21,7 @@ import ( // @Produces json // @Success 200 {array} instance.Instance "List of instances" // @Failure 500 {string} string "Internal Server Error" -// @Router /instances [get] +// @Router /api/v1/instances [get] func (h *Handler) ListInstances() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { instances, err := h.InstanceManager.ListInstances() @@ -46,7 +46,7 @@ func (h *Handler) ListInstances() http.HandlerFunc { // @Success 201 {object} instance.Instance "Created instance details" // @Failure 400 {string} string "Invalid request body" // @Failure 500 {string} string "Internal Server Error" -// @Router /instances/{name} [post] +// @Router /api/v1/instances/{name} [post] func (h *Handler) CreateInstance() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { name := chi.URLParam(r, "name") @@ -82,7 +82,7 @@ func (h *Handler) CreateInstance() http.HandlerFunc { // @Success 200 {object} instance.Instance "Instance details" // @Failure 400 {string} string "Invalid name format" // @Failure 500 {string} string "Internal Server Error" -// @Router /instances/{name} [get] +// @Router /api/v1/instances/{name} [get] func (h *Handler) GetInstance() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { name := chi.URLParam(r, "name") @@ -114,7 +114,7 @@ func (h *Handler) GetInstance() http.HandlerFunc { // @Success 200 {object} instance.Instance "Updated instance details" // @Failure 400 {string} string "Invalid name format" // @Failure 500 {string} string "Internal Server Error" -// @Router /instances/{name} [put] +// @Router /api/v1/instances/{name} [put] func (h *Handler) UpdateInstance() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { name := chi.URLParam(r, "name") @@ -150,7 +150,7 @@ func (h *Handler) UpdateInstance() http.HandlerFunc { // @Success 200 {object} instance.Instance "Started instance details" // @Failure 400 {string} string "Invalid name format" // @Failure 500 {string} string "Internal Server Error" -// @Router /instances/{name}/start [post] +// @Router /api/v1/instances/{name}/start [post] func (h *Handler) StartInstance() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { name := chi.URLParam(r, "name") @@ -186,7 +186,7 @@ func (h *Handler) StartInstance() http.HandlerFunc { // @Success 200 {object} instance.Instance "Stopped instance details" // @Failure 400 {string} string "Invalid name format" // @Failure 500 {string} string "Internal Server Error" -// @Router /instances/{name}/stop [post] +// @Router /api/v1/instances/{name}/stop [post] func (h *Handler) StopInstance() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { name := chi.URLParam(r, "name") @@ -216,7 +216,7 @@ func (h *Handler) StopInstance() http.HandlerFunc { // @Success 200 {object} instance.Instance "Restarted instance details" // @Failure 400 {string} string "Invalid name format" // @Failure 500 {string} string "Internal Server Error" -// @Router /instances/{name}/restart [post] +// @Router /api/v1/instances/{name}/restart [post] func (h *Handler) RestartInstance() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { name := chi.URLParam(r, "name") @@ -245,7 +245,7 @@ func (h *Handler) RestartInstance() http.HandlerFunc { // @Success 204 "No Content" // @Failure 400 {string} string "Invalid name format" // @Failure 500 {string} string "Internal Server Error" -// @Router /instances/{name} [delete] +// @Router /api/v1/instances/{name} [delete] func (h *Handler) DeleteInstance() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { name := chi.URLParam(r, "name") @@ -275,7 +275,7 @@ func (h *Handler) DeleteInstance() http.HandlerFunc { // @Success 200 {string} string "Instance logs" // @Failure 400 {string} string "Invalid name format or lines parameter" // @Failure 500 {string} string "Internal Server Error" -// @Router /instances/{name}/logs [get] +// @Router /api/v1/instances/{name}/logs [get] func (h *Handler) GetInstanceLogs() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { name := chi.URLParam(r, "name") @@ -317,8 +317,8 @@ func (h *Handler) GetInstanceLogs() http.HandlerFunc { // @Failure 400 {string} string "Invalid name format" // @Failure 500 {string} string "Internal Server Error" // @Failure 503 {string} string "Instance is not running" -// @Router /instances/{name}/proxy [get] -// @Router /instances/{name}/proxy [post] +// @Router /api/v1/instances/{name}/proxy [get] +// @Router /api/v1/instances/{name}/proxy [post] func (h *Handler) InstanceProxy() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { inst, err := h.getInstance(r) diff --git a/pkg/server/handlers_nodes.go b/pkg/server/handlers_nodes.go index 7c84b0a..46aa451 100644 --- a/pkg/server/handlers_nodes.go +++ b/pkg/server/handlers_nodes.go @@ -19,7 +19,7 @@ type NodeResponse struct { // @Produces json // @Success 200 {object} map[string]NodeResponse "Map of nodes" // @Failure 500 {string} string "Internal Server Error" -// @Router /nodes [get] +// @Router /api/v1/nodes [get] func (h *Handler) ListNodes() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Convert to sanitized response format (map of name -> NodeResponse) @@ -45,7 +45,7 @@ func (h *Handler) ListNodes() http.HandlerFunc { // @Failure 400 {string} string "Invalid name format" // @Failure 404 {string} string "Node not found" // @Failure 500 {string} string "Internal Server Error" -// @Router /nodes/{name} [get] +// @Router /api/v1/nodes/{name} [get] func (h *Handler) GetNode() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { name := chi.URLParam(r, "name") diff --git a/pkg/server/handlers_system.go b/pkg/server/handlers_system.go index 2e61288..fbd9179 100644 --- a/pkg/server/handlers_system.go +++ b/pkg/server/handlers_system.go @@ -13,7 +13,7 @@ import ( // @Produces text/plain // @Success 200 {string} string "Version information" // @Failure 500 {string} string "Internal Server Error" -// @Router /version [get] +// @Router /api/v1/version [get] func (h *Handler) VersionHandler() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { versionInfo := fmt.Sprintf("Version: %s\nCommit: %s\nBuild Time: %s\n", h.cfg.Version, h.cfg.CommitHash, h.cfg.BuildTime)