mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-02 22:01:05 +02:00
refactor: update alembic migration revision ID and added some defaults for blocknote in file_processors.py file
This commit is contained in:
parent
4e6b4cc57d
commit
5e53207edc
2 changed files with 20 additions and 7 deletions
|
|
@ -1,8 +1,13 @@
|
||||||
"""38_add_blocknote_fields_to_documents
|
"""43_add_blocknote_fields_to_documents
|
||||||
|
|
||||||
Revision ID: 38
|
Revision ID: 43
|
||||||
Revises: 37
|
Revises: 42
|
||||||
|
Create Date: 2025-11-30
|
||||||
|
|
||||||
|
Adds fields for live document editing:
|
||||||
|
- blocknote_document: JSONB editor state
|
||||||
|
- content_needs_reindexing: Flag for regenerating chunks/summary
|
||||||
|
- last_edited_at: Last edit timestamp
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from collections.abc import Sequence
|
from collections.abc import Sequence
|
||||||
|
|
@ -13,8 +18,8 @@ from sqlalchemy.dialects import postgresql
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision: str = "38"
|
revision: str = "43"
|
||||||
down_revision: str | None = "37"
|
down_revision: str | None = "42"
|
||||||
branch_labels: str | Sequence[str] | None = None
|
branch_labels: str | Sequence[str] | None = None
|
||||||
depends_on: str | Sequence[str] | None = None
|
depends_on: str | Sequence[str] | None = None
|
||||||
|
|
||||||
|
|
@ -122,6 +122,8 @@ async def add_received_file_document_using_unstructured(
|
||||||
}
|
}
|
||||||
existing_document.chunks = chunks
|
existing_document.chunks = chunks
|
||||||
existing_document.blocknote_document = blocknote_json
|
existing_document.blocknote_document = blocknote_json
|
||||||
|
existing_document.content_needs_reindexing = False
|
||||||
|
existing_document.last_edited_at = None
|
||||||
|
|
||||||
await session.commit()
|
await session.commit()
|
||||||
await session.refresh(existing_document)
|
await session.refresh(existing_document)
|
||||||
|
|
@ -142,6 +144,8 @@ async def add_received_file_document_using_unstructured(
|
||||||
content_hash=content_hash,
|
content_hash=content_hash,
|
||||||
unique_identifier_hash=unique_identifier_hash,
|
unique_identifier_hash=unique_identifier_hash,
|
||||||
blocknote_document=blocknote_json,
|
blocknote_document=blocknote_json,
|
||||||
|
content_needs_reindexing=False,
|
||||||
|
last_edited_at=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
session.add(document)
|
session.add(document)
|
||||||
|
|
@ -247,6 +251,8 @@ async def add_received_file_document_using_llamacloud(
|
||||||
}
|
}
|
||||||
existing_document.chunks = chunks
|
existing_document.chunks = chunks
|
||||||
existing_document.blocknote_document = blocknote_json
|
existing_document.blocknote_document = blocknote_json
|
||||||
|
existing_document.content_needs_reindexing = False
|
||||||
|
existing_document.last_edited_at = None
|
||||||
|
|
||||||
await session.commit()
|
await session.commit()
|
||||||
await session.refresh(existing_document)
|
await session.refresh(existing_document)
|
||||||
|
|
@ -267,6 +273,8 @@ async def add_received_file_document_using_llamacloud(
|
||||||
content_hash=content_hash,
|
content_hash=content_hash,
|
||||||
unique_identifier_hash=unique_identifier_hash,
|
unique_identifier_hash=unique_identifier_hash,
|
||||||
blocknote_document=blocknote_json,
|
blocknote_document=blocknote_json,
|
||||||
|
content_needs_reindexing=False,
|
||||||
|
last_edited_at=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
session.add(document)
|
session.add(document)
|
||||||
|
|
@ -396,7 +404,7 @@ async def add_received_file_document_using_docling(
|
||||||
"ETL_SERVICE": "DOCLING",
|
"ETL_SERVICE": "DOCLING",
|
||||||
}
|
}
|
||||||
existing_document.chunks = chunks
|
existing_document.chunks = chunks
|
||||||
existing_document.blocknote_document = None
|
existing_document.blocknote_document = blocknote_json
|
||||||
existing_document.content_needs_reindexing = False
|
existing_document.content_needs_reindexing = False
|
||||||
existing_document.last_edited_at = None
|
existing_document.last_edited_at = None
|
||||||
|
|
||||||
|
|
@ -418,7 +426,7 @@ async def add_received_file_document_using_docling(
|
||||||
chunks=chunks,
|
chunks=chunks,
|
||||||
content_hash=content_hash,
|
content_hash=content_hash,
|
||||||
unique_identifier_hash=unique_identifier_hash,
|
unique_identifier_hash=unique_identifier_hash,
|
||||||
blocknote_document=None,
|
blocknote_document=blocknote_json,
|
||||||
content_needs_reindexing=False,
|
content_needs_reindexing=False,
|
||||||
last_edited_at=None,
|
last_edited_at=None,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue