HEL-883: audit deployed visuals and mount canvas lightbox regressions
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"""Read only the selected board and its renderable rows; never call seeding GET."""
|
||||
import argparse, json, sqlite3
|
||||
p=argparse.ArgumentParser()
|
||||
p.add_argument("--board",type=int,choices=[4,5],default=4)
|
||||
a=p.parse_args()
|
||||
c = sqlite3.connect('file:/opt/aigc-home/data/calliope.db?mode=ro', uri=True)
|
||||
c.execute('PRAGMA query_only=ON')
|
||||
c.row_factory = sqlite3.Row
|
||||
one = lambda sql, args=(): [dict(r) for r in c.execute(sql, args)]
|
||||
board = one('SELECT * FROM canvas WHERE id=?',(a.board,))[0]
|
||||
nodes = one('SELECT * FROM canvas_node WHERE canvas_id=?',(a.board,))
|
||||
out = {'canvas': [board], 'canvas_node': nodes,
|
||||
'canvas_edge': one('SELECT * FROM canvas_edge WHERE canvas_id=?',(a.board,))}
|
||||
if board['project_id']:
|
||||
out['projects'] = one('SELECT id,title,status,idea FROM projects WHERE id=?', (board['project_id'],))
|
||||
for table, kind in [('characters', 'character'), ('locations', 'location'), ('items', 'item')]:
|
||||
ids = [n['entity_id'] for n in nodes if n['entity_type'] == kind]
|
||||
if ids:
|
||||
cols = ['id','project_id','name'] + (['portrait_path','sheet_path'] if kind=='character' else ['reference_image_path'])
|
||||
out[table] = one('SELECT '+','.join(cols)+' FROM '+table+' WHERE id IN ('+','.join('?' for _ in ids)+')', ids)
|
||||
sessions = one('SELECT id,title,project_id FROM agent_sessions WHERE project_id=? ORDER BY updated_at DESC LIMIT 1', (board['project_id'],))
|
||||
if not board['project_id']:
|
||||
sessions = one('SELECT id,title,project_id FROM agent_sessions WHERE id=?', (board['agent_session_id'],))
|
||||
out['agent_sessions'] = sessions
|
||||
if sessions:
|
||||
sid = sessions[0]['id']
|
||||
out['agent_messages'] = one('SELECT session_id,role,content,agent_name FROM agent_messages WHERE session_id=? ORDER BY id', (sid,))
|
||||
out['event_summary'] = one('SELECT type,count(*) as count FROM agent_events WHERE session_id=? GROUP BY type', (sid,))
|
||||
print(json.dumps(out,ensure_ascii=False))
|
||||
Reference in New Issue
Block a user