feat: write 3 files per solo recording (index + transkript + zusammenfassung)
- pipeline: call write_solo_docs() instead of save_transcript(); broadcast paths dict - router: /open accepts paths list for Obsidian mode, copies all 3 files to vault - app.js: store _modalPaths from saved event; Obsidian button sends all paths - tests: test_write_solo_docs_creates_three_files added Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+10
-3
@@ -10,7 +10,7 @@ from api.router import broadcast
|
||||
from config import load as load_config
|
||||
from transcription import engine as transcription_engine
|
||||
from llm import OllamaClient
|
||||
from output import save_transcript, write_meeting_docs
|
||||
from output import write_solo_docs, write_meeting_docs
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -80,15 +80,22 @@ async def _run_solo_pipeline(cfg, wav_path, output_dir, instructions):
|
||||
model=cfg["ollama"]["model"],
|
||||
)
|
||||
|
||||
dt = datetime.now()
|
||||
paths = write_solo_docs(raw_text=raw_text, refined=refined, output_dir=output_dir, dt=dt)
|
||||
|
||||
title = "Diktat"
|
||||
for line in refined.splitlines():
|
||||
if line.startswith("# "):
|
||||
title = line[2:].strip()
|
||||
break
|
||||
|
||||
path = save_transcript(title=title, content=refined, output_dir=output_dir)
|
||||
await broadcast({"event": "saved", "path": path, "title": title})
|
||||
await state.set_status(Status.IDLE)
|
||||
await broadcast({
|
||||
"event": "saved",
|
||||
"path": paths["index"],
|
||||
"title": title,
|
||||
"paths": paths,
|
||||
})
|
||||
|
||||
|
||||
async def _run_meeting_pipeline(cfg, wav_path, output_dir, instructions, diar_cfg):
|
||||
|
||||
+20
-12
@@ -209,28 +209,36 @@ async def put_config(body: dict, user: dict = Depends(current_user)):
|
||||
@router.post("/open")
|
||||
async def open_file(body: dict, user: dict = Depends(current_user)):
|
||||
import subprocess, shutil
|
||||
path = body.get("path", "")
|
||||
user_dir = os.path.join(user["output_dir"], user["username"])
|
||||
if not (path and os.path.exists(path) and os.path.abspath(path).startswith(os.path.abspath(user_dir))):
|
||||
abs_user_dir = os.path.abspath(user_dir)
|
||||
|
||||
# Accept either a single path or a list of paths (for 3-file recordings)
|
||||
raw_paths = body.get("paths") or ([body.get("path")] if body.get("path") else [])
|
||||
paths = [p for p in raw_paths if p and os.path.exists(p) and os.path.abspath(p).startswith(abs_user_dir)]
|
||||
if not paths:
|
||||
return {"ok": False}
|
||||
|
||||
mode = body.get("mode", "editor") # "editor" | "folder" | "obsidian"
|
||||
if mode == "obsidian":
|
||||
from urllib.parse import quote
|
||||
cfg = load_config()
|
||||
vault = cfg.get("obsidian", {}).get("vault", "").strip()
|
||||
if vault and os.path.isdir(vault):
|
||||
dest = os.path.join(vault, os.path.basename(path))
|
||||
shutil.copy2(path, dest)
|
||||
target = dest
|
||||
else:
|
||||
target = path
|
||||
subprocess.Popen(["xdg-open", f"obsidian://open?path={quote(target, safe='/')}"])
|
||||
open_target = paths[0]
|
||||
for p in paths:
|
||||
if vault and os.path.isdir(vault):
|
||||
dest = os.path.join(vault, os.path.basename(p))
|
||||
shutil.copy2(p, dest)
|
||||
if p == paths[0]:
|
||||
open_target = dest
|
||||
else:
|
||||
open_target = p
|
||||
subprocess.Popen(["xdg-open", f"obsidian://open?path={quote(open_target, safe='/')}"])
|
||||
elif mode == "folder" and shutil.which("dolphin"):
|
||||
subprocess.Popen(["dolphin", "--select", path])
|
||||
subprocess.Popen(["dolphin", "--select", paths[0]])
|
||||
elif mode == "folder":
|
||||
subprocess.Popen(["xdg-open", os.path.dirname(path)])
|
||||
subprocess.Popen(["xdg-open", os.path.dirname(paths[0])])
|
||||
else:
|
||||
subprocess.Popen(["xdg-open", path])
|
||||
subprocess.Popen(["xdg-open", paths[0]])
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user