Files
aiagent/backend/scripts/update_zhini7_prompt.py
renjianbo 41ffd31923 feat: P0 commercial readiness — password security, legal, account management
Backend changes for Phase A of v1.0 commercial launch:

P0-3: Password Security
- Remove hardcoded admin/123456 defaults from 34+ bootstrap scripts
- Add PLATFORM_USERNAME/PLATFORM_PASSWORD env vars to config
- Add PUT /api/v1/auth/change-password endpoint (requires old password)

P0-1: User Agreement & Privacy Policy
- Add agreed_terms/agreed_terms_version/agreed_terms_at to User model
- New GET /api/v1/legal/privacy and GET /api/v1/legal/terms endpoints
- New POST /api/v1/legal/agree endpoint to record consent
- Register endpoint now validates agreed_terms must be True

P0-6: Account Management
- Add phone/status/is_email_verified to User model
- Add DELETE /api/v1/auth/account for account deletion (with password confirmation)
- Add PUT /api/v1/auth/phone for phone binding
- Reject authentication for deleted accounts (status=deleted)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-01 22:01:54 +08:00

27 lines
954 B
Python

import os
import re
import requests
BASE = "http://127.0.0.1:8037"
AID = "688c2c41-dcd1-4285-b193-6bed00c485c2"
text = open("scripts/create_zhini_kefu_7.py", encoding="utf-8").read()
m = re.search(r'LLM_PROMPT = """(.*?)"""', text, re.S)
prompt = m.group(1).strip()
r = requests.post(
f"{BASE}/api/v1/auth/login",
data={"username": os.getenv("PLATFORM_USERNAME"), "password": os.getenv("PLATFORM_PASSWORD")},
headers={"Content-Type": "application/x-www-form-urlencoded"},
timeout=15,
)
h = {"Authorization": f"Bearer {r.json()['access_token']}", "Content-Type": "application/json"}
g = requests.get(f"{BASE}/api/v1/agents/{AID}", headers=h, timeout=30).json()
wf = g["workflow_config"]
for n in wf["nodes"]:
if n.get("id") == "llm-unified":
n["data"]["prompt"] = prompt
break
up = requests.put(f"{BASE}/api/v1/agents/{AID}", headers=h, json={"workflow_config": wf}, timeout=60)
print(up.status_code, up.text[:300])