Werkstatt: Hermes-Update-Zusammenfassung bricht nicht mehr mitten im Satz ab
_summarize_hermes_commits nutzt jetzt finish_reason: bei "length" (Token-Limit erreicht) wird der unvollstaendige letzte Stichpunkt entfernt, bei "stop" bleibt die Antwort unveraendert. max_tokens 380 -> 550 als Puffer. Erster echter Werkstatt-Kreislauf (Gesellenpruefung), Runde 2 nach Review. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -382,12 +382,23 @@ def _summarize_hermes_commits(commits: list[dict]) -> str:
|
||||
)
|
||||
try:
|
||||
r = httpx.post(f"{LLAMA_SWAP_URL}/v1/chat/completions", timeout=90.0, json={
|
||||
"model": "fast", "max_tokens": 380, "temperature": 0.2,
|
||||
"model": "fast", "max_tokens": 550, "temperature": 0.2,
|
||||
"chat_template_kwargs": {"enable_thinking": False},
|
||||
"messages": [{"role": "user", "content": prompt}],
|
||||
})
|
||||
r.raise_for_status()
|
||||
summary = ((r.json().get("choices") or [{}])[0].get("message", {}).get("content") or "").strip()
|
||||
resp = r.json()
|
||||
choice = (resp.get("choices") or [{}])[0]
|
||||
summary = (choice.get("message") or {}).get("content") or ""
|
||||
finish_reason = choice.get("finish_reason") or ""
|
||||
summary = summary.strip()
|
||||
|
||||
# finish_reason == "length" → Antwort wurde wegen Token-Limits abgeschnitten →
|
||||
# letzten (unvollständigen) Stichpunkt entfernen.
|
||||
# Bei "stop" oder None → Antwort ist vollständig → unverändert lassen.
|
||||
if finish_reason == "length" and summary:
|
||||
lines = summary.rsplit("\n", 1)
|
||||
summary = lines[0] if len(lines) > 1 else ""
|
||||
if summary:
|
||||
_relnotes_cache.update(key=key, summary=summary)
|
||||
return summary
|
||||
|
||||
Reference in New Issue
Block a user