37 lines
1.5 KiB
Python
37 lines
1.5 KiB
Python
import json, urllib.request
|
||
from pathlib import Path
|
||
|
||
print("=== 验证1: 5个被 Blocked 的脚本现在是否通过调度器路径检查 ===")
|
||
scripts_dir = Path('/home/hmo/.hermes/profiles/position-analyst/scripts')
|
||
resolved = scripts_dir.resolve()
|
||
files = ['meta_growth.py', 'macro_context_collector.py', 'divergence_detector.py',
|
||
'memory_guardian.py', 'fix_gateway_port.py']
|
||
all_ok = True
|
||
for f in files:
|
||
p = (scripts_dir / f).resolve()
|
||
try:
|
||
p.relative_to(resolved)
|
||
exists = p.exists()
|
||
print(f" PASS {f} (exists={exists})")
|
||
if not exists:
|
||
all_ok = False
|
||
except ValueError:
|
||
all_ok = False
|
||
print(f" FAIL {f} still blocked")
|
||
print(' =>', 'ALL PASS' if all_ok else 'STILL FAILING')
|
||
|
||
print()
|
||
print("=== 验证2: default gateway (8642) LLM 调用(原 key1 429,现 key6)===")
|
||
payload = json.dumps({'model': 'deepseek-v4-flash',
|
||
'messages': [{'role': 'user', 'content': 'reply with one word: ok'}],
|
||
'max_tokens': 10}).encode()
|
||
req = urllib.request.Request('http://127.0.0.1:8642/v1/chat/completions', data=payload,
|
||
headers={'Content-Type': 'application/json',
|
||
'Authorization': 'Bearer hermes123'})
|
||
try:
|
||
resp = urllib.request.urlopen(req, timeout=90)
|
||
d = json.loads(resp.read().decode())
|
||
content = d.get('choices', [{}])[0].get('message', {}).get('content', '')
|
||
print(' LLM OK:', content[:100])
|
||
except Exception as e:
|
||
print(' LLM FAIL:', e) |