Files
daily_publish/agent_test/create_7_test_projects.py
T
panda 2784c5b36f fix: iframe link click - add allow-popups, use target=_blank
Previous fix injected base target=_top but the sandbox attribute lacked allow-top-navigation, so the browser blocked link clicks and the user had to Ctrl+Click as a workaround. Fix: sandbox allow-same-origin allow-popups + base target=_blank. Links now open in new tab (better UX, no content loss). Also fix deploy/rebuild.ps1 to read jar from target/ instead of deleted deploy/baota/. Add agent_test/ scripts: create_7_test_projects, upload_test_html, manual_package.
2026-06-03 22:32:06 +08:00

71 lines
2.2 KiB
Python

"""Create 7 test projects on the production server to demonstrate carousel pagination."""
import requests
import json
API_BASE = "http://www.1415243231.top:30081/api"
# Existing projects on server (don't touch)
existing = [
{"id": 1, "name": "MiniMax 套餐用量"},
{"id": 2, "name": "GitHub每日热点-1"},
{"id": 3, "name": "AI每日热点-1"},
]
# 7 new test projects with varied metadata
new_projects = [
{
"name": "产品设计周报",
"description": "每周产品迭代总结,含 UI 改版、用户反馈分析",
},
{
"name": "技术分享月刊",
"description": "团队技术分享、代码评审要点、最佳实践",
},
{
"name": "运营数据日报",
"description": "DAU/MAU、转化漏斗、付费用户行为",
},
{
"name": "AI 模型评测",
"description": "GPT-4 / Claude / Gemini / 文心一言横向对比",
},
{
"name": "客户调研记录",
"description": "用户访谈纪要、需求池、痛点分析",
},
{
"name": "团队 OKR 复盘",
"description": "Q2 目标完成情况、Q3 规划、风险清单",
},
{
"name": "行业研究报告",
"description": "SaaS / AI Agent / 垂直行业趋势分析",
},
]
print(f"现有项目 {len(existing)} 个: {[p['name'] for p in existing]}")
print(f"\n准备创建 {len(new_projects)} 个测试项目...")
created = []
for p in new_projects:
try:
r = requests.post(f"{API_BASE}/projects", json=p, timeout=15)
if r.status_code == 201:
data = r.json()
created.append(data)
print(f" [OK] id={data['id']} {data['name']}")
else:
print(f" [FAIL {r.status_code}] {p['name']}: {r.text[:200]}")
except Exception as e:
print(f" [ERROR] {p['name']}: {e}")
print(f"\n成功创建 {len(created)}")
# Verify final state
r = requests.get(f"{API_BASE}/projects", timeout=10)
all_projects = r.json()
print(f"\n服务器现有项目总数: {len(all_projects)}")
print("项目列表:")
for p in all_projects:
print(f" - id={p['id']:2d} {p['name']:20s} 报告数={p.get('reportCount', 0):3d}")