222e5a0219
Drop the disabled video/3D model tabs from the composer and home model picker, reword storyboard/campaign copy away from motion/video toward static campaign frames, ease the home prompt editor font sizing, and update the deterministic fallback message to describe image generation and editing instead of "video not yet supported". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
53 lines
1.4 KiB
Go
53 lines
1.4 KiB
Go
package application
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"img_infinite_canvas/internal/domain/design"
|
|
)
|
|
|
|
type DeterministicAgent struct{}
|
|
|
|
func NewDeterministicAgent() *DeterministicAgent {
|
|
return &DeterministicAgent{}
|
|
}
|
|
|
|
func (a *DeterministicAgent) Plan(ctx context.Context, req design.AgentRequest) (design.AgentPlan, error) {
|
|
if err := ctx.Err(); err != nil {
|
|
return design.AgentPlan{}, err
|
|
}
|
|
|
|
offset := len(req.Project.Nodes)
|
|
nodes := composeBoard(req.Prompt, offset)
|
|
return design.AgentPlan{
|
|
Message: design.Message{
|
|
ID: newID(),
|
|
Role: "assistant",
|
|
Type: "assistant",
|
|
Title: "设计任务完成",
|
|
Content: synthesizeResponse(req.Prompt, req.Mode),
|
|
},
|
|
GeneratedNodes: nodes,
|
|
Connections: nil,
|
|
}, nil
|
|
}
|
|
|
|
func (a *DeterministicAgent) Replay(ctx context.Context, project design.Project) (design.AgentReplay, error) {
|
|
if err := ctx.Err(); err != nil {
|
|
return design.AgentReplay{}, err
|
|
}
|
|
|
|
return design.AgentReplay{
|
|
ProjectID: project.ID,
|
|
Messages: append([]design.Message(nil), project.Messages...),
|
|
}, nil
|
|
}
|
|
|
|
func synthesizeResponse(prompt string, mode string) string {
|
|
if mode == "" {
|
|
mode = "design"
|
|
}
|
|
return fmt.Sprintf("已按「%s」生成一组 %s 画布:官网首页、色彩卡片、移动端页面和详情页已放到无限画布中,可继续微调、扩展或上传参考图。当前聚焦图片生成、图片编辑、页面与品牌视觉。", prompt, mode)
|
|
}
|