import sqlite3, json p='/data/adaptai/migrate/vast/workspace-vast1-2/webui/webui.db' con=sqlite3.connect(p); cur=con.cursor() cfg_id, data = cur.execute("SELECT id,data FROM config ORDER BY id DESC LIMIT 1").fetchone() cfg = json.loads(data) openai = cfg.setdefault('openai', {}) openai['enable'] = True openai['api_base_urls'] = ['http://127.0.0.1:8001/v1'] openai['api_keys'] = [''] openai['api_configs'] = {'0': {'enable': True, 'tags': [], 'prefix_id': '', 'model_ids': [], 'connection_type': 'external'}} cfg.setdefault('models', {})['base_models_cache'] = False cur.execute("UPDATE config SET data=?, updated_at=CURRENT_TIMESTAMP WHERE id=?", (json.dumps(cfg,separators=(',',':')), cfg_id)) con.commit() print('ok')