Commit Graph
4 Commits
Author SHA1 Message Date
LeoVasanko 2fef336943 llm_translator: self-documenting CLI — --api flag, per-flag expected values and defaults, devserver port in examples 2026-09-21 02:09:34 +00:00
LeoVasanko 859d11491d article mode: inject the page title as # heading, jargon loanword rule
When the render would inject the page title as an h1 (markdown.has_h1 is
False for the body), an article job's text carries the same '# {title}'
line: the title translates in document context and the opening paragraphs
see the heading (works both ways). The heading's pair in the decomposed
result becomes the title fragment — heading text only, pure prose, never
stored as a body chunk; a demoted or merged heading skips the title,
which stays pending for a scoped title job. The job covers the title key
so it is not double-dispatched afterwards.

Prompt: prefer established technical loanwords with English roots over
forced localizations (frontend -> frontti in Finnish, not etupääte).

Verified offline (title extraction, demoted-heading skip, no-injection
path) and live against ollama qwen3.8:27b: the standalone title job gave
'Alkuun pääseminen', the article job then overwrote it with the
in-context 'Aloitus' matching the body's translated heading.
2026-09-21 01:07:54 +00:00
LeoVasanko 37e9ab2cd2 llm_translator: one line per rule, extended-Markdown rules, <translate>/<context> markers
Prompt rules are single-line bullets now (no wrapped continuation lines).
Added the extended-Markdown rules the site syntax needs: all formatting
is syntax and is preserved exactly (only the text is translated), and
single newlines inside paragraphs render as actual line breaks, so line
structure must survive untranslated. The payload is no longer wrapped in
a ```markdown fence — the site's extended syntax (and this document
renderer) makes fences unreliable as delimiters; instead an explicit
sentence marks the instruction/text boundary and the payload rides in
faux <translate> tags (<context> for the hybrid-neighbor reference
blocks). unwrap_output strips echoed markers, still also a whole-output
fence. Re-verified live against ollama qwen3.8:27b: title + article jobs,
URL/code fence/{dates} preserved.
2026-09-21 00:50:45 +00:00
LeoVasanko f1324e8387 scripts/llm_translator.py: instruct-LLM translator client (markdown + article modes)
OpenAI Chat Completions shape for llama.cpp/hosted APIs, ollama native
/api/chat via api="ollama" — ollama's /v1 endpoint silently ignores
think:false (verified on 0.34.2: reasoning ran despite the flag), which
hybrid models need off. Prompts and sampling from the /tmp/llmtrial
evidence (strict structure rules, temperature 0.2, num_predict capped at
~2.5x estimated source tokens); whole-output fence unwrapping and
single-line enforcement for titles are client-side. Config via JSON +
CLI overrides; pagerite itself carries no LLM specifics.
2026-09-20 23:22:27 +00:00