77 lines
2.9 KiB
Python
77 lines
2.9 KiB
Python
|
|
import urllib.request
|
||
|
|
import json
|
||
|
|
|
||
|
|
BASE = "http://127.0.0.1:8037/api/v1"
|
||
|
|
|
||
|
|
# Login
|
||
|
|
req = urllib.request.Request(
|
||
|
|
f"{BASE}/auth/login",
|
||
|
|
data=b"username=admin&password=123456",
|
||
|
|
headers={"Content-Type": "application/x-www-form-urlencoded"}
|
||
|
|
)
|
||
|
|
token = json.loads(urllib.request.urlopen(req).read())["access_token"]
|
||
|
|
print(f"Token: {token[:50]}...")
|
||
|
|
|
||
|
|
# Get agents
|
||
|
|
req = urllib.request.Request(
|
||
|
|
f"{BASE}/agents?page_size=50",
|
||
|
|
headers={"Authorization": f"Bearer {token}"}
|
||
|
|
)
|
||
|
|
data = json.loads(urllib.request.urlopen(req).read())
|
||
|
|
agents = data if isinstance(data, list) else data.get("data", [])
|
||
|
|
print(f"\nTotal agents: {len(agents)}")
|
||
|
|
|
||
|
|
# Team members to check
|
||
|
|
team_members = {
|
||
|
|
"architect": "7ae1ace0-d2a6-4e55-855c-678489700b2b",
|
||
|
|
"test_planner": "705811aa-32dd-44fc-ada6-069414ceb25e",
|
||
|
|
"functional_tester": "d271d75f-f2c1-4b5c-94b5-0cdd0bc14d5a",
|
||
|
|
"ux_reviewer": "75b295a7-3031-4e8c-bf61-8299e7e19b56",
|
||
|
|
"edge_explorer": "f7305b12-fb1a-438c-a8fc-08dc5ce4e086",
|
||
|
|
"performance_evaluator": "a3dde5d4-1ae3-4223-bed0-9c9fd7ababf8",
|
||
|
|
}
|
||
|
|
|
||
|
|
for role, aid in team_members.items():
|
||
|
|
try:
|
||
|
|
req = urllib.request.Request(
|
||
|
|
f"{BASE}/agents/{aid}",
|
||
|
|
headers={"Authorization": f"Bearer {token}"}
|
||
|
|
)
|
||
|
|
agent = json.loads(urllib.request.urlopen(req).read())
|
||
|
|
if "error" in agent:
|
||
|
|
print(f"\n[{role}] ERROR: {agent.get('message')}")
|
||
|
|
|
||
|
|
# Search by name
|
||
|
|
matching = [a for a in agents if role in a.get("name","").lower() or role in a.get("description","").lower()]
|
||
|
|
if matching:
|
||
|
|
a = matching[0]
|
||
|
|
print(f" Found by search: {a['name']} ({a['id'][:12]}...)")
|
||
|
|
agent = a
|
||
|
|
else:
|
||
|
|
continue
|
||
|
|
|
||
|
|
name = agent.get("name", "?")
|
||
|
|
wc = agent.get("workflow_config")
|
||
|
|
nodes = wc.get("nodes", []) if wc else []
|
||
|
|
llm = [n for n in nodes if n.get("type") == "llm"]
|
||
|
|
if llm:
|
||
|
|
nd = llm[0]["data"]
|
||
|
|
tools = nd.get("selected_tools", [])
|
||
|
|
print(f"\n{'='*60}")
|
||
|
|
print(f"[{role}] {name}")
|
||
|
|
print(f" Model: {nd.get('model')} | Temp: {nd.get('temperature')} | MaxIter: {nd.get('max_iterations')}")
|
||
|
|
print(f" Tools ({len(tools)}): {tools}")
|
||
|
|
prompt = nd.get("prompt", "")
|
||
|
|
print(f" Prompt length: {len(prompt)} chars")
|
||
|
|
# Key instructions
|
||
|
|
for kw in ["file_read", "grep", "scan", "directory", "源码", "Android"]:
|
||
|
|
if kw.lower() in prompt.lower():
|
||
|
|
idx = prompt.lower().find(kw.lower())
|
||
|
|
snippet = prompt[max(0,idx-30):idx+100].replace('\n', ' ')[:130]
|
||
|
|
print(f" [{kw}]: ...{snippet}...")
|
||
|
|
else:
|
||
|
|
print(f"\n[{role}] {name} - No LLM node found")
|
||
|
|
print(f" workflow_config: {json.dumps(wc, ensure_ascii=False)[:300] if wc else 'NONE'}")
|
||
|
|
except Exception as e:
|
||
|
|
print(f"\n[{role}] Exception: {e}")
|