fix(tools-pve/asr-pipeline): mount gitea ssh key for Obsidian vault sync and fix provider source_detail
This commit is contained in:
@@ -54,12 +54,14 @@ def _safe_title(markdown: str) -> str:
|
||||
return title[:72] or "通话记录"
|
||||
|
||||
|
||||
def _formal_path(markdown: str) -> Path:
|
||||
def _formal_path(markdown: str, root: Path | None = None) -> Path:
|
||||
target_dir = root or CFG.minutes
|
||||
target_dir.mkdir(parents=True, exist_ok=True)
|
||||
date = _field(markdown, "date") or time.strftime("%Y-%m-%d")
|
||||
base = CFG.minutes / f"{date}-{_safe_title(markdown)}.md"
|
||||
base = target_dir / f"{date}-{_safe_title(markdown)}.md"
|
||||
transcript = _field(markdown, "transcript")
|
||||
if CFG.minutes.exists() and transcript:
|
||||
for path in CFG.minutes.glob("*.md"):
|
||||
if target_dir.exists() and transcript:
|
||||
for path in target_dir.glob("*.md"):
|
||||
try:
|
||||
if _field(path.read_text(errors="ignore"), "transcript") == transcript:
|
||||
return path
|
||||
@@ -256,13 +258,21 @@ def publish(path: Path) -> bool:
|
||||
|
||||
destination = _formal_path(out)
|
||||
vault.write_draft_file(destination, out)
|
||||
vault_minutes_dir = CFG.vault / "minutes"
|
||||
vault_destination = (
|
||||
destination
|
||||
if destination.parent.resolve() == vault_minutes_dir.resolve()
|
||||
else (vault_minutes_dir / destination.name)
|
||||
)
|
||||
if vault_destination != destination:
|
||||
vault.write_draft_file(vault_destination, out)
|
||||
date = _field(out, "date") or time.strftime("%Y-%m-%d")
|
||||
touched = [destination]
|
||||
touched = [vault_destination]
|
||||
for name, kind in _answered_card_requests(path):
|
||||
card = _create_card(name, kind, destination, date)
|
||||
card = _create_card(name, kind, vault_destination, date)
|
||||
if card:
|
||||
touched.append(card)
|
||||
state = vault.sync(touched, f"minutes: {destination.stem}(Web 确认后正式发布)")
|
||||
state = vault.sync(touched, f"minutes: {vault_destination.stem}(Web 确认后正式发布)")
|
||||
if state == "error":
|
||||
raise RuntimeError("formal minute commit failed")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user