- 用户域:注册/登录(JWT)/修改密码/个人资料 - 照片/衣橱/身形/化身:上传存储 + 3D 化身模板匹配 - 穿搭生成:天气(高德+和风+缓存) → 规则预筛 → LLM 规划(1次调用) → 规则评分(5维100分制) → 全低分触发 LLM 兜底创作 → 异步任务状态机 - 效果图:选主方案后异步生成 3 视角(mock/wanx 供应商 + 内容 hash 缓存 + 每日限额) - 商业化:合作门店列表(seed 4 家) - 冒烟:全链路端到端验证通过(mock LLM/天气),23 个 API 端点 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
64 lines
2.2 KiB
Go
64 lines
2.2 KiB
Go
package controller
|
||
|
||
import (
|
||
"context"
|
||
|
||
"slogan-agent/common"
|
||
"slogan-agent/styleagent/model/dto"
|
||
"slogan-agent/styleagent/service"
|
||
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
)
|
||
|
||
type outfit struct{}
|
||
|
||
var Outfit = new(outfit)
|
||
|
||
// Generate 生成穿搭方案(异步任务)
|
||
func (c *outfit) Generate(ctx context.Context, req *dto.OutfitGenerateReq) (res *dto.OutfitGenerateRes, err error) {
|
||
taskId, err := service.OutfitService.Generate(ctx, common.GetUserId(g.RequestFromCtx(ctx)), req)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
return &dto.OutfitGenerateRes{TaskId: taskId}, nil
|
||
}
|
||
|
||
// TaskStatus 查询生成任务状态
|
||
func (c *outfit) TaskStatus(ctx context.Context, req *dto.OutfitTaskStatusReq) (res *dto.OutfitTaskStatusRes, err error) {
|
||
status, msg, err := service.OutfitService.GetTaskStatus(ctx, common.GetUserId(g.RequestFromCtx(ctx)), req.TaskId)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
return &dto.OutfitTaskStatusRes{Status: status, Error: msg}, nil
|
||
}
|
||
|
||
// PlanList 方案列表
|
||
func (c *outfit) PlanList(ctx context.Context, req *dto.OutfitPlanListReq) (res *dto.OutfitPlanListRes, err error) {
|
||
list, err := service.OutfitService.ListPlans(ctx, common.GetUserId(g.RequestFromCtx(ctx)))
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
return &dto.OutfitPlanListRes{List: list}, nil
|
||
}
|
||
|
||
// PlanDetail 方案详情(items + images + hairstyle)
|
||
func (c *outfit) PlanDetail(ctx context.Context, req *dto.OutfitPlanDetailReq) (res *dto.OutfitPlanDetailRes, err error) {
|
||
return service.OutfitService.GetPlanDetail(ctx, common.GetUserId(g.RequestFromCtx(ctx)), req.PlanId)
|
||
}
|
||
|
||
// SelectMain 选定主方案(触发效果图生成)
|
||
func (c *outfit) SelectMain(ctx context.Context, req *dto.OutfitSelectMainReq) (res *struct{}, err error) {
|
||
if err = service.OutfitService.SelectMain(ctx, common.GetUserId(g.RequestFromCtx(ctx)), req.PlanId); err != nil {
|
||
return nil, err
|
||
}
|
||
return &struct{}{}, nil
|
||
}
|
||
|
||
// Review 方案反馈
|
||
func (c *outfit) Review(ctx context.Context, req *dto.OutfitReviewReq) (res *struct{}, err error) {
|
||
if err = service.OutfitService.Review(ctx, common.GetUserId(g.RequestFromCtx(ctx)), req.PlanId, req.Action, req.Note); err != nil {
|
||
return nil, err
|
||
}
|
||
return &struct{}{}, nil
|
||
}
|