数据库与模型:新增多版迁移(章节证据快照、对话血缘、记忆事实/时间线 lineage 等),把「成稿 ↔ 对话/记忆」的溯源信息落到表结构里。 业务链路:会话与 WS、回忆录/故事流水线、记忆写入与 enrichment 等跟着接上线索与快照;新增章节证据快照与评测侧 EvalTraceService 等模块,方便组评审用的证据包。 内部评测:自动化 run 与手工 memoir 评审共用可追溯证据;rubric/ judge 相关脚本与文档有配套调整。 app-eval-web:Memoir/实验详情里能展开看证据摘要与 evidence_trace(含对话轮次 id);Vite 代理与 development.sh 注入的 API 端口与当前默认内部评测端口一致,避免改端口后页面连错服务。 工程杂项:GitHub Actions / 仓库说明有更新;各适配器与支付/配额/plan 等多处为小改动或跟随主改动的收尾;新增/扩充了?
68 lines
1.9 KiB
Python
68 lines
1.9 KiB
Python
"""套餐目录:单一事实来源,供 plan service 与 quota 共用(避免 plan↔quota 循环依赖)。"""
|
|
|
|
from app.core.config import settings
|
|
from app.features.plan.schemas import PlanResponse
|
|
|
|
ENABLE_TEST_PLAN = (settings.enable_test_plan or "").lower() in ("1", "true", "yes")
|
|
|
|
AVAILABLE_PLANS = [
|
|
PlanResponse(
|
|
id="free",
|
|
name="free",
|
|
display_name="免费体验版",
|
|
price=0.0,
|
|
currency="CNY",
|
|
features=["500 轮对话", "1 个章节整理", "完整回忆录生成流程"],
|
|
max_conversations=500,
|
|
max_chapters=1,
|
|
is_popular=False,
|
|
),
|
|
PlanResponse(
|
|
id="pro",
|
|
name="pro",
|
|
display_name="Pro 版",
|
|
price=88.0,
|
|
currency="CNY",
|
|
features=["2000 轮对话", "无章节限制", "完整回忆录生成"],
|
|
max_conversations=2000,
|
|
is_popular=True,
|
|
),
|
|
PlanResponse(
|
|
id="pro_plus",
|
|
name="pro_plus",
|
|
display_name="Pro+ 版",
|
|
price=288.0,
|
|
currency="CNY",
|
|
features=["10000 轮对话", "无章节限制", "完整回忆录生成", "长期创作无忧"],
|
|
max_conversations=10000,
|
|
is_popular=False,
|
|
),
|
|
]
|
|
|
|
TEST_PLAN = PlanResponse(
|
|
id="test",
|
|
name="test",
|
|
display_name="一分钱测试版",
|
|
price=0.01,
|
|
currency="CNY",
|
|
features=["无限对话", "无限章节整理", "仅用于开发环境测试支付"],
|
|
is_popular=False,
|
|
)
|
|
|
|
|
|
def get_plans_for_api() -> list[PlanResponse]:
|
|
if ENABLE_TEST_PLAN:
|
|
return AVAILABLE_PLANS + [TEST_PLAN]
|
|
return list(AVAILABLE_PLANS)
|
|
|
|
|
|
def get_plan_by_type(subscription_type: str) -> PlanResponse:
|
|
if subscription_type == "premium":
|
|
subscription_type = "pro"
|
|
if subscription_type == "test":
|
|
return TEST_PLAN if ENABLE_TEST_PLAN else AVAILABLE_PLANS[0]
|
|
for plan in AVAILABLE_PLANS:
|
|
if plan.id == subscription_type:
|
|
return plan
|
|
return AVAILABLE_PLANS[0]
|