diff --git a/app.py b/app.py index bf3e196..19b813a 100644 --- a/app.py +++ b/app.py @@ -280,7 +280,8 @@ def get_prompts(): def _job_get(job_id: int): with db() as c: - return c.execute("SELECT * FROM jobs WHERE id=?", (job_id,)).fetchone() + row = c.execute("SELECT * FROM jobs WHERE id=?", (job_id,)).fetchone() + return dict(row) if row else None def _job_set(job_id: int, **fields): @@ -348,7 +349,7 @@ def _process_analysis_job(job_id: int): if not doc or not prm: raise RuntimeError("Dokument oder Prompt nicht gefunden") - user_extra = (j["user_prompt"] or "").strip() if j["user_prompt"] is not None else "" + user_extra = (j.get("user_prompt") or "").strip() llm_prompt = ( "Du bist ein präziser Assistent. Antworte auf Deutsch.\\n" f"AUFTRAG:\\n{prm['prompt']}\\n"