feat(api): add Lovart-style project and agent thread endpoints

Add canva/canda-compatible routes for lightweight project open/save and
agent thread history:
- POST /canva/project/queryProject, saveProject
- POST /canva/agent/queryAgentLastThread, agentThreadList
- GET /canda/chat-history, /canda/thread/status

Canvas save now accepts a compressed SHAKKERDATA:// snapshot payload,
preserves connections, and returns a SaveProject response; blank
successful image nodes are backfilled from generated artifacts. Frontend
designGateway adopts the new save/query flow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-08 19:10:08 +08:00
parent ada29cee12
commit 263748af4a
27 changed files with 2045 additions and 114 deletions
+16 -2
View File
@@ -6,6 +6,7 @@ package logic
import (
"context"
"img_infinite_canvas/internal/domain/design"
"img_infinite_canvas/internal/svc"
"img_infinite_canvas/internal/types"
@@ -26,7 +27,7 @@ func NewSaveCanvasLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SaveCa
}
}
func (l *SaveCanvasLogic) SaveCanvas(req *types.SaveCanvasRequest) (resp *types.ProjectResponse, err error) {
func (l *SaveCanvasLogic) SaveCanvas(req *types.SaveCanvasRequest) (resp *types.SaveProjectResponse, err error) {
project, err := l.svcCtx.DesignService.SaveCanvas(
l.ctx,
req.Id,
@@ -41,5 +42,18 @@ func (l *SaveCanvasLogic) SaveCanvas(req *types.SaveCanvasRequest) (resp *types.
return nil, err
}
return toProjectResponse(project), nil
return saveProjectResponse(project), nil
}
func saveProjectResponse(project design.Project) *types.SaveProjectResponse {
return &types.SaveProjectResponse{
Code: 0,
Msg: nil,
Data: types.SaveProjectData{
ProjectId: project.ID,
NewCreated: false,
ValidProjectId: true,
Version: project.Version,
},
}
}