from pathlib import Path import sqlite3,json,base64,uuid,re root=Path(__file__).resolve().parent; data=root/'hd-test-panels' assert data.is_relative_to(root) with sqlite3.connect(data/'huobao.sqlite3') as db: db.execute("UPDATE sys_task SET status='failed' WHERE status='processing'") rows=db.execute('SELECT id,name,settings FROM ai_service_configs').fetchall() for id,name,raw in rows: gpu=json.loads(raw or '{}').get('gpu') if gpu in ('gpu1','gpu2','gpu3'): name=re.sub(r' · (?:端口 \d+|ComfyUI [\d/]+(?:([^)]*))?)$','',name)+' · ComfyUI '+{'gpu1':'8189','gpu2':'8188','gpu3':'8191'}[gpu] db.execute('UPDATE ai_service_configs SET name=? WHERE id=?',(name,id)) ids=[] for sb,cfg,gpu,provider in ((1,12,'gpu2','default'),(2,13,'gpu3','gpu3')): encoded=base64.urlsafe_b64encode((provider+':'+str(uuid.uuid4())).encode()).decode().rstrip('=') cur=db.execute("INSERT INTO sys_task(type,storyboard_id,drama_id,provider,model,config_id,config_base_url,task_id,status,stage,params,created_at,updated_at) VALUES ('video',?,1,'minimax','MiniMax-H3',?,'http://127.0.0.1:18884',?,'processing','polling',?,datetime('now'),datetime('now'))",(sb,cfg,encoded,json.dumps({'gpu':gpu}))) ids.append(cur.lastrowid) (data/'shot-ui-fixture.json').write_text(json.dumps({'ids':ids})) print('Prepared two independent shot tasks:',ids)