涵盖(每条对应已存的审计记录): - AI 模块拆分:apps/backend/app/ai/apps -> prompts/(8 个 APP + app2a 派生) audit: 2026-04-20__ai-module-complete.md - admin-web AI 管理套件:AIDashboard / AIOperations / AIRunLogs / AITriggers / TriggerManager audit: 2026-04-21__admin-web-ai-management-suite.md - App2 财务洞察 prompt v3 -> v5.1 + 小程序 AI 接入(chat / board-finance) audit: 2026-04-22__app2_prompt_v5_1_and_miniprogram_ai_insight.md - App2 prewarm 全过滤器 + AI 触发器 cron reschedule audit: 2026-04-21__app2-finance-prewarm-all-filters.md migration: 20260420_ai_trigger_jobs_and_app2_prewarm.sql / 20260421_app2_prewarm_cron_reschedule.sql - AppType 联合类型对齐 + adminAiAppTypes.test.ts audit: 2026-04-30__admin_web_ai_app_type_alignment.md - DashScope tokens_used 提取修复 audit: 2026-04-30__backend_dashscope_tokens_used_extraction.md - App3 线索完整详情 prompt audit: 2026-05-01__backend_app3_full_detail_prompt.md - Runtime Context 沙箱(5-1~5-2 主线): - 后端 schema/service + admin_runtime_context / xcx_runtime_clock 两个 router - admin-web RuntimeContext.tsx + miniprogram runtime-clock.ts - migration: 20260501__runtime_context_sandbox.sql - tools/db/verify_admin_web_sandbox.py + verify_sandbox_end_to_end.py - database/changes: 7 份 sandbox_* 验证报告 - 飞球 DWS 修复:finance_area_daily 区域汇总 + task_engine 调整 + RLS 视图业务日上界(migration 20260502 + scripts/ops/gen_rls_business_date_migration.py) 合规: - .gitignore 启用 tmp/ 排除 - 不入仓:apps/etl/connectors/feiqiu/.env(API_TOKEN secret,本地修改保留) 待验证清单: - docs/audit/changes/2026-05-04__cumulative_baseline_pending_verification.md 每个主题的功能完整性 / 上线验证几乎都未收口,按优先级 P0~P3 逐一处理
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
"""应用 8 维客线索整理 Prompt 拼装。
|
||
|
||
接收 App3(消费分析)和 App6(备注分析)的全部线索,
|
||
整合去重后输出统一维客线索。
|
||
- 数据源:context.app3_clues + context.app6_clues(dispatcher 已查好传入)
|
||
- 分类标签 6 选 1(与 member_retention_clue CHECK 约束一致)
|
||
- 合并规则:相似线索合并,providers 逗号分隔
|
||
- system prompt 在百炼控制台配置
|
||
|
||
返回:单个 prompt 字符串。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import json
|
||
from typing import Any
|
||
|
||
|
||
async def build_prompt(
|
||
context: dict,
|
||
cache_svc: Any | None = None, # 兼容统一签名,App8 不用
|
||
) -> str:
|
||
"""构建 App8 prompt 字符串。
|
||
|
||
Args:
|
||
context: site_id, member_id, app3_clues(list), app6_clues(list),
|
||
app3_generated_at(str|None), app6_generated_at(str|None)
|
||
|
||
Returns:
|
||
JSON 序列化后的 prompt 字符串
|
||
"""
|
||
member_id = context["member_id"]
|
||
app3_clues = context.get("app3_clues") or []
|
||
app6_clues = context.get("app6_clues") or []
|
||
|
||
payload: dict[str, Any] = {
|
||
"member_id": member_id,
|
||
"input": {
|
||
"app3_clues": {
|
||
"source": "消费数据分析(App3)",
|
||
"generated_at": context.get("app3_generated_at"),
|
||
"clues": app3_clues,
|
||
},
|
||
"app6_clues": {
|
||
"source": "备注分析(App6)",
|
||
"generated_at": context.get("app6_generated_at"),
|
||
"clues": app6_clues,
|
||
},
|
||
},
|
||
}
|
||
|
||
return json.dumps(payload, ensure_ascii=False, default=str)
|