mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +02:00
chore: ran linting
This commit is contained in:
parent
4a75603d4f
commit
3eb4d55ef5
17 changed files with 369 additions and 201 deletions
|
|
@ -129,7 +129,9 @@ async def _finish_obsidian_sync_notification(
|
|||
):
|
||||
"""Mark the rolling Obsidian sync inbox item complete or failed."""
|
||||
handler = NotificationService.connector_indexing
|
||||
connector_name = notification.notification_metadata.get("connector_name", "Obsidian")
|
||||
connector_name = notification.notification_metadata.get(
|
||||
"connector_name", "Obsidian"
|
||||
)
|
||||
if failed > 0 and indexed == 0:
|
||||
title = f"Failed: {connector_name}"
|
||||
message = (
|
||||
|
|
@ -273,9 +275,7 @@ async def _find_by_fingerprint(
|
|||
return (await session.execute(stmt)).scalars().first()
|
||||
|
||||
|
||||
def _build_config(
|
||||
payload: ConnectRequest, *, now_iso: str
|
||||
) -> dict[str, object]:
|
||||
def _build_config(payload: ConnectRequest, *, now_iso: str) -> dict[str, object]:
|
||||
return {
|
||||
"vault_id": payload.vault_id,
|
||||
"vault_name": payload.vault_name,
|
||||
|
|
@ -456,9 +456,7 @@ async def obsidian_sync(
|
|||
session, connector=connector, payload=note, user_id=str(user.id)
|
||||
)
|
||||
indexed += 1
|
||||
items.append(
|
||||
SyncAckItem(path=note.path, status="ok", document_id=doc.id)
|
||||
)
|
||||
items.append(SyncAckItem(path=note.path, status="ok", document_id=doc.id))
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as exc:
|
||||
|
|
@ -597,9 +595,7 @@ async def obsidian_delete_notes(
|
|||
path,
|
||||
payload.vault_id,
|
||||
)
|
||||
items.append(
|
||||
DeleteAckItem(path=path, status="error", error=str(exc)[:300])
|
||||
)
|
||||
items.append(DeleteAckItem(path=path, status="error", error=str(exc)[:300]))
|
||||
|
||||
return DeleteAck(
|
||||
vault_id=payload.vault_id,
|
||||
|
|
@ -616,9 +612,7 @@ async def obsidian_manifest(
|
|||
session: AsyncSession = Depends(get_async_session),
|
||||
) -> ManifestResponse:
|
||||
"""Return ``{path: {hash, mtime}}`` for the plugin's onload reconcile diff."""
|
||||
connector = await _resolve_vault_connector(
|
||||
session, user=user, vault_id=vault_id
|
||||
)
|
||||
connector = await _resolve_vault_connector(session, user=user, vault_id=vault_id)
|
||||
return await get_manifest(session, connector=connector, vault_id=vault_id)
|
||||
|
||||
|
||||
|
|
@ -633,9 +627,7 @@ async def obsidian_stats(
|
|||
``files_synced`` excludes tombstones so it matches ``/manifest``;
|
||||
``last_sync_at`` includes them so deletes advance the freshness signal.
|
||||
"""
|
||||
connector = await _resolve_vault_connector(
|
||||
session, user=user, vault_id=vault_id
|
||||
)
|
||||
connector = await _resolve_vault_connector(session, user=user, vault_id=vault_id)
|
||||
|
||||
is_active = Document.document_metadata["deleted_at"].as_string().is_(None)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,14 @@ class _PluginBase(BaseModel):
|
|||
class NotePayload(_PluginBase):
|
||||
"""One Obsidian note as pushed by the plugin (the source of truth)."""
|
||||
|
||||
vault_id: str = Field(..., description="Stable plugin-generated UUID for this vault")
|
||||
vault_id: str = Field(
|
||||
..., description="Stable plugin-generated UUID for this vault"
|
||||
)
|
||||
path: str = Field(..., description="Vault-relative path, e.g. 'notes/foo.md'")
|
||||
name: str = Field(..., description="File stem (no extension)")
|
||||
extension: str = Field(default="md", description="File extension without leading dot")
|
||||
extension: str = Field(
|
||||
default="md", description="File extension without leading dot"
|
||||
)
|
||||
content: str = Field(default="", description="Raw markdown body (post-frontmatter)")
|
||||
|
||||
frontmatter: dict[str, Any] = Field(default_factory=dict)
|
||||
|
|
@ -38,7 +42,9 @@ class NotePayload(_PluginBase):
|
|||
embeds: list[str] = Field(default_factory=list)
|
||||
aliases: list[str] = Field(default_factory=list)
|
||||
|
||||
content_hash: str = Field(..., description="Plugin-computed SHA-256 of the raw content")
|
||||
content_hash: str = Field(
|
||||
..., description="Plugin-computed SHA-256 of the raw content"
|
||||
)
|
||||
size: int | None = Field(
|
||||
default=None,
|
||||
ge=0,
|
||||
|
|
|
|||
|
|
@ -126,9 +126,7 @@ def _build_document_string(payload: NotePayload, vault_name: str) -> str:
|
|||
existing search relevance heuristics keep working unchanged.
|
||||
"""
|
||||
tags_line = ", ".join(payload.tags) if payload.tags else "None"
|
||||
links_line = (
|
||||
", ".join(payload.resolved_links) if payload.resolved_links else "None"
|
||||
)
|
||||
links_line = ", ".join(payload.resolved_links) if payload.resolved_links else "None"
|
||||
return (
|
||||
"<METADATA>\n"
|
||||
f"Title: {payload.name}\n"
|
||||
|
|
@ -235,9 +233,7 @@ async def upsert_note(
|
|||
if not prepared:
|
||||
if existing is not None:
|
||||
return existing
|
||||
raise RuntimeError(
|
||||
f"Indexing pipeline rejected obsidian note {payload.path}"
|
||||
)
|
||||
raise RuntimeError(f"Indexing pipeline rejected obsidian note {payload.path}")
|
||||
|
||||
document = prepared[0]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue