All checks were successful
Stable Release / stable (push) Successful in 1m34s
Major additions: - RAG pipeline (indexing, chunking, search) with sidebar upload button - Memory system with CRUD API - Plugins and lessons modules - MCP discovery and MCP server - Advanced skills (auto-create, conditional, improver) - Agent browser/image support, delegate, sessions - File editor with CodeMirror in split panes - Markdown rendering via react-markdown + KaTeX + highlight.js - Raw markdown toggle - PWA manifest + service worker - Extension UI redesign with new design tokens and studio-style chat - Pipeline API for chat streaming - Mobile responsive layout 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush <crush@charm.land>
53 lines
1.0 KiB
Go
53 lines
1.0 KiB
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/muyue/muyue/internal/agent"
|
|
)
|
|
|
|
func (s *Server) handleImageGenerate(w http.ResponseWriter, r *http.Request) {
|
|
if r.Method != http.MethodPost {
|
|
http.Error(w, `{"error":"method not allowed"}`, http.StatusMethodNotAllowed)
|
|
return
|
|
}
|
|
|
|
var req struct {
|
|
Prompt string `json:"prompt"`
|
|
Size string `json:"size"`
|
|
Style string `json:"style"`
|
|
}
|
|
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
|
jsonError(w, "invalid request: "+err.Error())
|
|
return
|
|
}
|
|
|
|
if req.Prompt == "" {
|
|
jsonError(w, "prompt is required")
|
|
return
|
|
}
|
|
|
|
imgTool, err := agent.NewImageGenerationTool(s.config)
|
|
if err != nil {
|
|
jsonError(w, "image tool init: "+err.Error())
|
|
return
|
|
}
|
|
|
|
args := map[string]interface{}{
|
|
"prompt": req.Prompt,
|
|
"size": req.Size,
|
|
"style": req.Style,
|
|
}
|
|
|
|
result, err := imgTool.Execute(args)
|
|
if err != nil {
|
|
jsonError(w, fmt.Sprintf("generation failed: %v", err))
|
|
return
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.Write([]byte(result))
|
|
}
|