feat: LLM-Zusammenfassung extrahiert jetzt auch Halle & speichert beides in DB
Quality Gate / 🛡️ Lint + Type Check + Tests (push) Failing after 12m3s
Quality Gate / 🛡️ Lint + Type Check + Tests (push) Failing after 12m3s
This commit is contained in:
@@ -2100,7 +2100,7 @@ if (_llmBtn) {{
|
|||||||
try {{
|
try {{
|
||||||
const r = await fetch('/submission/{row["id"]}/generate-summary', {{method:'POST'}});
|
const r = await fetch('/submission/{row["id"]}/generate-summary', {{method:'POST'}});
|
||||||
const data = await r.json();
|
const data = await r.json();
|
||||||
if (data.summary) {{ document.querySelector('textarea[name="summary"]').value = data.summary; }}
|
if (data.summary) {{ document.querySelector('textarea[name="summary"]').value = data.summary; if (data.halle) {{ var hi = document.querySelector('input[name="halle"]'); if (hi) hi.value = data.halle; }} }}
|
||||||
else if (data.error) {{ alert('Fehler: ' + data.error); }}
|
else if (data.error) {{ alert('Fehler: ' + data.error); }}
|
||||||
}} catch(err) {{ alert('Netzwerkfehler: ' + err.message); }}
|
}} catch(err) {{ alert('Netzwerkfehler: ' + err.message); }}
|
||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
@@ -2311,7 +2311,20 @@ def generate_llm_summary(sub_id: int):
|
|||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
data = r.json()
|
data = r.json()
|
||||||
summary = data["choices"][0]["message"]["content"].strip()
|
summary = data["choices"][0]["message"]["content"].strip()
|
||||||
return jsonify({"summary": summary})
|
# Extrahiere Halle aus dem Content und speichere in DB
|
||||||
|
halle = extract_halle(content)
|
||||||
|
if halle:
|
||||||
|
db.execute(
|
||||||
|
"UPDATE submissions SET summary=?, halle=? WHERE id=?",
|
||||||
|
(summary, halle, sub_id),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
db.execute(
|
||||||
|
"UPDATE submissions SET summary=? WHERE id=?",
|
||||||
|
(summary, sub_id),
|
||||||
|
)
|
||||||
|
db.commit()
|
||||||
|
return jsonify({"summary": summary, "halle": halle or ""})
|
||||||
else:
|
else:
|
||||||
return jsonify({"error": f"API-Fehler: {r.status_code}"}), 500
|
return jsonify({"error": f"API-Fehler: {r.status_code}"}), 500
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user