更新功能

This commit is contained in:
2026-08-26 14:13:11 +08:00
parent beaa5dd9fe
commit a508e6f07e
47 changed files with 5616 additions and 520 deletions
+11 -1
View File
@@ -42,7 +42,16 @@ def extract_document_text(data: bytes) -> str:
return text[:MAX_EXTRACTED_CHARS]
def attachment_record(conversation_id: str, filename: str, mime: str, relative_path: str, data: bytes, kind: str, extracted_path: str = "") -> dict[str, object]:
def attachment_record(
conversation_id: str,
filename: str,
mime: str,
relative_path: str,
data: bytes,
kind: str,
extracted_path: str = "",
metadata: dict[str, object] | None = None,
) -> dict[str, object]:
return {
"id": Path(relative_path).stem,
"conversation_id": conversation_id,
@@ -53,4 +62,5 @@ def attachment_record(conversation_id: str, filename: str, mime: str, relative_p
"size": len(data),
"sha256": hashlib.sha256(data).hexdigest(),
"extracted_path": extracted_path,
**(metadata or {}),
}