Transcribe and clean up on this machine, without installing anything first

whisper-server is started on --inference-path /v1/audio/transcriptions,
which is exactly the path api.py already builds for the hosted providers,
and llama-server answers /chat/completions the way OpenRouter does. So the
local half is one more base URL rather than a second code path: worker.py,
filetranscribe.py and meeting.py are untouched, and dictation, subtitles
and meetings all work here on the first try.

Three findings worth naming, none of them in the new code:

whisper.cpp cuts segments on tokens, which in Turkish lands inside a word
about as often as between two. Pasted raw that gives "akraba değ\niller.";
in a subtitle it gives a cue reading "değ". Whisper marks the start of a
word with a leading space, so a piece that does not begin with one
continues the word above it.

A small model will repeat the transcript until the context is full, and
every one of those tokens is a second of somebody waiting: measured at 206
seconds, and 25 with a ceiling on the reply. Hosted models are left alone,
where the same runaway is rare and a ceiling would cut the minutes short.

A server outlives SIGTERM and SIGKILL holding its model in memory. Signals
are now turned into an event Qt delivers, since Qt blocks in C where a
Python handler never runs, and a pid file lets the next start sweep up
what a SIGKILL left behind.

The minutes keep their own provider rather than following cleanup's. The
two jobs are not the same size: a 4B model here will strip the filler words
out of a dictation and will not write up an hour long meeting.

The suite runs offline now: a test that reaches the network says so instead
of quietly going there.
This commit is contained in:
yusufipk
2026-08-01 20:00:35 +03:00
parent c0b892f53c
commit 2cfbbb2d99
16 changed files with 1194 additions and 120 deletions
+6 -18
View File
@@ -118,18 +118,12 @@ class MeetingPipeline(QObject):
self._check()
self._say(t("Writing the minutes…"))
minutes = api.cleanup(
transcript,
self.conf.openrouter_key(),
self.conf["meeting_model"],
self.conf.meeting_prompt(),
reasoning=self.conf["meeting_reasoning"],
base_url=self.conf["openrouter_base_url"],
timeout=600,
)
writer = self.conf.minutes_target()
minutes = api.cleanup(writer, transcript, self.conf.meeting_prompt(),
timeout=600)
title = self._write(doc_path, minutes, transcript, entry)
cfg.update_meeting(base, status="done", error="", title=title,
model=self.conf["meeting_model"])
model=writer.model)
self._discard_audio(wav_path)
self.finished.emit(base, title)
@@ -201,6 +195,7 @@ class MeetingPipeline(QObject):
def _cleanup(self, transcript):
conf = self.conf
prompt = conf.cleanup_prompt(with_timestamps=True, with_speakers=True)
target = conf.cleanup_target()
out = []
blocks = filetranscribe.split_text(transcript, True)
for index, block in enumerate(blocks, start=1):
@@ -208,14 +203,7 @@ class MeetingPipeline(QObject):
if len(blocks) > 1:
self._say(t("Cleaning up {index}/{count}",
index=index, count=len(blocks)))
out.append(api.cleanup(
block,
conf.openrouter_key(),
conf["cleanup_model"],
prompt,
reasoning=conf["cleanup_reasoning"],
base_url=conf["openrouter_base_url"],
))
out.append(api.cleanup(target, block, prompt))
return "\n".join(out)
def _write(self, doc_path, minutes, transcript, entry):