feat: Ollama und Modell vor dem Start prüfen, kurze Meldung statt Traceback
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
82489ee83c
commit
6aa4887f22
1 changed files with 105 additions and 11 deletions
|
|
@ -9,11 +9,11 @@ import hashlib
|
|||
import io
|
||||
import json
|
||||
import re
|
||||
import urllib.request
|
||||
|
||||
from aenderungen import compare, read_raw
|
||||
from rede_korrigieren import (
|
||||
MODEL, apply_replacements, chat_request, read_glossary, split_chunks,
|
||||
MODEL, apply_replacements, chat_request, check_ollama, ollama_open, read_glossary,
|
||||
split_chunks,
|
||||
)
|
||||
|
||||
SYSTEM = """Du suchst Hörfehler in der automatischen Abschrift einer deutschen Rede.
|
||||
|
|
@ -77,7 +77,7 @@ def suggest_chunk(chunk, model):
|
|||
],
|
||||
"options": {"temperature": 0, "num_ctx": 16384, "num_predict": 4096},
|
||||
}
|
||||
with urllib.request.urlopen(chat_request(payload), timeout=600) as response:
|
||||
with ollama_open(chat_request(payload)) as response:
|
||||
result = json.load(response)
|
||||
try:
|
||||
entries = json.loads(result["message"]["content"])["eintraege"]
|
||||
|
|
@ -227,6 +227,7 @@ def main():
|
|||
with redirect_stdout(io.StringIO()):
|
||||
text = apply_replacements(text, replacements)
|
||||
|
||||
check_ollama(args.model)
|
||||
cache_dir = args.output.with_suffix(".parts")
|
||||
cache_dir.mkdir(parents=True, exist_ok=True)
|
||||
suggestions = model_suggestions(text, args.model, cache_dir, known)
|
||||
|
|
|
|||
Loading…
Reference in a new issue