26 lines
899 B
Python
26 lines
899 B
Python
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": "admin", "password": "123456"},
|
|
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])
|