Backfill default keys in DB get_sequence for API responses

Ensures the project loader API always returns all expected keys
like mode, cfg, etc. even if they were missing from stored data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-18 23:28:51 +01:00
parent c880c16865
commit 526af7097d
+5 -2
View File
@@ -5,7 +5,7 @@ import time
from pathlib import Path
from typing import Any
from utils import load_json, KEY_BATCH_DATA, KEY_HISTORY_TREE
from utils import load_json, DEFAULTS, KEY_BATCH_DATA, KEY_HISTORY_TREE
logger = logging.getLogger(__name__)
@@ -231,7 +231,10 @@ class ProjectDB:
).fetchone()
if not row:
return None
return self._migrate_lora_keys(json.loads(row["data"]))
data = json.loads(row["data"])
for k, v in DEFAULTS.items():
data.setdefault(k, v)
return self._migrate_lora_keys(data)
def list_sequences(self, data_file_id: int) -> list[int]:
rows = self.conn.execute(