v1.0.176: classify_input + elements_json в промежуточных результатах

This commit is contained in:
2026-06-24 19:23:34 +04:00
parent 3974a032a5
commit 2a566869aa
4 changed files with 22 additions and 6 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, classify_raw=None):
"""Store LLM classification results + raw response."""
def set_classification(doc_id, doc_type, own_number, parent_number, doc_date, counterparty, classify_raw=None, classify_input=None):
"""Store LLM classification results + raw response + input text."""
return execute(
"""UPDATE documents SET doc_type=%s, own_number=%s, parent_number=%s,
doc_date=%s, counterparty=%s, classify_status='classified', classify_raw=%s
doc_date=%s, counterparty=%s, classify_status='classified', classify_raw=%s, classify_input=%s
WHERE id=%s""",
(doc_type, own_number, parent_number, doc_date, counterparty, classify_raw, doc_id),
(doc_type, own_number, parent_number, doc_date, counterparty, classify_raw, classify_input, 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, classify_raw
doc_date, counterparty, classify_status, error_message, classify_raw, classify_input
FROM documents WHERE batch_id=%s ORDER BY created_at""",
(batch_id,),
)