v1.0.175: виртуальные группы + classify_raw + stepper

This commit is contained in:
2026-06-24 17:06:25 +04:00
parent b5d35f57fc
commit 475d0b8dc7
7 changed files with 114 additions and 25 deletions
+5 -5
View File
@@ -36,13 +36,13 @@ def delete(doc_id):
return execute("DELETE FROM documents WHERE id = %s", (doc_id,))
def set_classification(doc_id, doc_type, own_number, parent_number, doc_date, counterparty):
"""Store LLM classification results."""
def set_classification(doc_id, doc_type, own_number, parent_number, doc_date, counterparty, classify_raw=None):
"""Store LLM classification results + raw response."""
return execute(
"""UPDATE documents SET doc_type=%s, own_number=%s, parent_number=%s,
doc_date=%s, counterparty=%s, classify_status='classified'
doc_date=%s, counterparty=%s, classify_status='classified', classify_raw=%s
WHERE id=%s""",
(doc_type, own_number, parent_number, doc_date, counterparty, doc_id),
(doc_type, own_number, parent_number, doc_date, counterparty, classify_raw, doc_id),
)
@@ -73,7 +73,7 @@ def list_by_batch(batch_id):
"""All documents in a batch with classification fields."""
return query(
"""SELECT id, filename, status, doc_type, own_number, parent_number,
doc_date, counterparty, classify_status, error_message
doc_date, counterparty, classify_status, error_message, classify_raw
FROM documents WHERE batch_id=%s ORDER BY created_at""",
(batch_id,),
)