Stelle den ersten nutzbaren Ablauf zum Organisieren und Nachverfolgen bereit.
Deploy Development / deploy (push) Successful in 23s
Deploy Development / deploy (push) Successful in 23s
Anmeldung, Datenraeume, Akten, Vorgaenge, gemeinsame Notizen, Dateien, manuelle Paperless-Referenzen, Aufgaben und unabhaengige Fristen laufen damit in der Entwicklungsumgebung. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
cfe17ff909
commit
2558239bfd
60 files changed
+8467
-71
No files matched your search
@@ -0,0 +1,25 @@
|
||||
"""Bounded note documents. Only paragraph text is stored."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app.core.errors import unprocessable
|
||||
|
||||
|
||||
def clean_document(document: dict) -> dict:
|
||||
blocks = document.get("blocks")
|
||||
if not isinstance(blocks, list) or len(blocks) > 400:
|
||||
raise unprocessable("Die Notiz hat kein gültiges Dokument.")
|
||||
clean = []
|
||||
for block in blocks:
|
||||
if not isinstance(block, dict) or set(block) - {"type", "text"}:
|
||||
raise unprocessable("Die Notiz enthält einen nicht unterstützten Block.")
|
||||
if block.get("type") != "paragraph" or not isinstance(block.get("text"), str):
|
||||
raise unprocessable("Die Notiz enthält einen nicht unterstützten Block.")
|
||||
if len(block["text"]) > 20000:
|
||||
raise unprocessable("Ein Absatz ist zu lang.")
|
||||
clean.append({"type": "paragraph", "text": block["text"]})
|
||||
return {"version": 1, "blocks": clean}
|
||||
|
||||
|
||||
def document_text(document: dict) -> str:
|
||||
return "\n".join(block["text"] for block in document.get("blocks", []))
|
||||
Reference in new issue
Block a user