上线版: 产品表单统一+form嵌套修复+用户管理+部署+三套叙事
- 产品编辑入口统一走 ProductFormFull(卖点/风格/人群/品牌词全字段); 修复开任务页 <form> 套 <form> 致"编辑产品"报错、改不了、跳回首个产品 - dashboard 入口卡片对齐实际路由: 系统管理(/config) 与 工作配置(/settings) 分开; settings ?tab=products 直达改用挂载后读 URL, 消除 hydration mismatch - 新增用户管理(users API/admin service/改密页) + alembic 022/023/024 - 上线部署: Dockerfile / docker-compose.prod+https / nginx https / .env.example - A8 三套正交叙事(痛点/场景/成分背书) + beige 调色去AI化 + 飞轮 text_import 高权重信号 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ preference_aggregator:查最近50条 → 最常选角度 + 打回原因近3条
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import desc
|
||||
from sqlalchemy import desc, func
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.constants.enums import SIGNAL_WEIGHTS, DataOwnership
|
||||
@@ -69,6 +69,20 @@ def record_signal(
|
||||
raise
|
||||
|
||||
|
||||
def count_signals(db: Session, workspace_id: int, product_id: int) -> int:
|
||||
"""该产品累计偏好信号总数(按 workspace+product,走联合索引)。
|
||||
供前端"飞轮已积累N条信号"累积感知用,体现越用越多。"""
|
||||
return (
|
||||
db.query(func.count(PreferenceEvent.id))
|
||||
.filter(
|
||||
PreferenceEvent.workspace_id == workspace_id,
|
||||
PreferenceEvent.product_id == product_id,
|
||||
)
|
||||
.scalar()
|
||||
or 0
|
||||
)
|
||||
|
||||
|
||||
def get_preference_context(
|
||||
db: Session, workspace_id: int, product_id: int,
|
||||
product_dict: dict[str, Any] | None = None,
|
||||
@@ -105,4 +119,5 @@ def get_preference_context(
|
||||
"recent_preference": ctx.get("recent_preference", ""),
|
||||
"reject_reasons": ctx.get("reject_reasons", []),
|
||||
"injected_count": ctx.get("injected_count", 0),
|
||||
"signal_count": count_signals(db, workspace_id, product_id),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user