9314ac6942
- New timeline UI: interleaved LLM reasoning + tool call display - Fix: run_log truncation for large tool outputs - Fix: lat/lon + values reduced to ~1% (was 99%) - Fix: @csrf_exempt on upload/delete endpoints - Fix: DATA_UPLOAD_MAX_NUMBER_FILES for 1998-file upload - Fix: dtype alignment for multi-batch CSV processing - New: tests/test_e2e_full.py with real DeepSeek LLM - New: 1998-file test data generator
43 lines
1.7 KiB
Python
43 lines
1.7 KiB
Python
import os, sys, django, urllib.request, glob, uuid, json, time
|
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'tianxuan.settings'
|
|
sys.path.insert(0, r'C:\Users\25044\Desktop\Proj\天璇')
|
|
import django; django.setup()
|
|
from analysis.models import AnalysisRun
|
|
AnalysisRun.objects.all().delete()
|
|
print('Cleaned old runs')
|
|
|
|
BASE = 'http://127.0.0.1:18766'
|
|
data_dir = r'C:\Users\25044\Desktop\Proj\天璇\data\multi_upload'
|
|
files = sorted(glob.glob(os.path.join(data_dir, '*.csv')))
|
|
boundary = uuid.uuid4().hex
|
|
lines = []
|
|
for fp in files:
|
|
with open(fp, 'rb') as f: d = f.read()
|
|
fname = os.path.basename(fp)
|
|
lines.append(f'--{boundary}'.encode())
|
|
lines.append(f'Content-Disposition: form-data; name="files"; filename="{fname}"'.encode())
|
|
lines.append(b'Content-Type: text/csv'); lines.append(b''); lines.append(d)
|
|
lines.append(f'--{boundary}--'.encode())
|
|
req = urllib.request.Request(f'{BASE}/upload/csv/', data=b'\r\n'.join(lines),
|
|
headers={'Content-Type': f'multipart/form-data; boundary={boundary}'})
|
|
r = urllib.request.urlopen(req, timeout=300)
|
|
resp = json.loads(r.read()); r.close()
|
|
print(f'Uploaded run_id={resp["run_id"]}')
|
|
|
|
run_id = resp['run_id']
|
|
for i in range(120):
|
|
time.sleep(2)
|
|
try:
|
|
req2 = urllib.request.Request(f'{BASE}/runs/{run_id}/status/')
|
|
r2 = urllib.request.urlopen(req2, timeout=10)
|
|
status_resp = json.loads(r2.read()); r2.close()
|
|
status = status_resp.get('status', status_resp.get('state', ''))
|
|
print(f' attempt {i+1}: status={status}')
|
|
if status == 'ready':
|
|
print(f'Run {run_id} is ready!')
|
|
break
|
|
except Exception as e:
|
|
print(f' attempt {i+1}: error={e}')
|
|
else:
|
|
print('Timed out waiting for ready status')
|