Files
slogan/styleagent/scoring/completeness_rule.go
T
adminandClaude Opus 4.7 ef22f7672a feat: slogan-agent MVP 服务端完整实现
- 用户域:注册/登录(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>
2026-07-31 12:15:11 +08:00

73 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package scoring
// completenessScore 层次完整度(20 分制):上衣+5 下装+5 鞋+5 配饰+5
func completenessScore(o CandidateOutfit) int {
score := 0
for _, it := range o.Items {
switch it.Category {
case "上衣":
score += 5
case "下装":
score += 5
case "鞋":
score += 5
case "配饰":
score += 5
}
}
if o.HasOuterwear {
score += 2
}
if score > 20 {
return 20
}
return score
}
// styleScore 风格一致性(10 分制):命中用户偏好标签每项 +2
func styleScore(o CandidateOutfit, ctx ScoreContext) int {
if len(ctx.StyleTags) == 0 {
return 5
}
score := 0
for _, it := range o.Items {
for _, tag := range ctx.StyleTags {
if tag != "" && it.StyleTags != "" && containsTag(it.StyleTags, tag) {
score += 2
}
}
}
if score > 10 {
return 10
}
return score
}
func containsTag(tags, tag string) bool {
for _, t := range splitTags(tags) {
if t == tag {
return true
}
}
return false
}
func splitTags(s string) []string {
var out []string
cur := ""
for _, c := range s {
if c == ',' || c == '' || c == ' ' {
if cur != "" {
out = append(out, cur)
cur = ""
}
continue
}
cur += string(c)
}
if cur != "" {
out = append(out, cur)
}
return out
}