Files
moteva/server/internal/logic/run_node_action_async_logic.go
T
root bb8946b79b feat(canvas): add visual annotation edit action
Add a VisualAnnotationPanel letting users mark regions on an image (brush,
circle, rectangle, cross) with per-mark edit instructions, composited into
an annotation guide image. The new "visual-annotation" node action sends
the unmarked source plus the annotated guide to the image model, editing
only numbered regions. Server validates the annotation image/instructions
and threads them through the generator task.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 10:03:59 +08:00

47 lines
1.1 KiB
Go

// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1
package logic
import (
"context"
"img_infinite_canvas/internal/domain/design"
"img_infinite_canvas/internal/svc"
"img_infinite_canvas/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type RunNodeActionAsyncLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewRunNodeActionAsyncLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RunNodeActionAsyncLogic {
return &RunNodeActionAsyncLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *RunNodeActionAsyncLogic) RunNodeActionAsync(req *types.NodeActionRequest) (resp *types.ProjectResponse, err error) {
project, err := l.svcCtx.DesignService.RunNodeActionAsync(l.ctx, req.Id, req.NodeId, design.NodeActionRequest{
Action: req.Action,
Prompt: req.Prompt,
ImageModel: req.ImageModel,
ImageSize: req.ImageSize,
Mask: req.Mask,
Selection: req.Selection,
AnnotationImage: req.AnnotationImage,
Options: req.Options,
})
if err != nil {
return nil, err
}
return toProjectResponse(project), nil
}