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:
@@ -5,7 +5,7 @@ import time
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
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__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -231,7 +231,10 @@ class ProjectDB:
|
|||||||
).fetchone()
|
).fetchone()
|
||||||
if not row:
|
if not row:
|
||||||
return None
|
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]:
|
def list_sequences(self, data_file_id: int) -> list[int]:
|
||||||
rows = self.conn.execute(
|
rows = self.conn.execute(
|
||||||
|
|||||||
Reference in New Issue
Block a user