neue Aufteilung der scripte
This commit is contained in:
1 parent
0b47ffdcb6
commit
bbfa2049eb
7 files changed
+458
-556
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import streamlit as st
|
||||
from ui_utils import build_markdown_doc
|
||||
|
||||
def switch_to_editor_callback(note_payload):
|
||||
"""
|
||||
Callback für den 'Bearbeiten'-Button im Graphen.
|
||||
Bereitet den Session-State vor, damit der Editor im Update-Modus startet.
|
||||
"""
|
||||
# 1. Inhalt extrahieren (Fulltext bevorzugt, sonst Fallback)
|
||||
content = note_payload.get('fulltext', '')
|
||||
if not content:
|
||||
content = build_markdown_doc(note_payload, "Inhalt konnte nicht geladen werden (nur Metadaten verfügbar).")
|
||||
|
||||
# 2. Single Source of Truth: 'path' Feld (Absoluter Pfad)
|
||||
origin_fname = note_payload.get('path')
|
||||
|
||||
# Fallback: Falls 'path' leer ist (Legacy Daten)
|
||||
if not origin_fname:
|
||||
origin_fname = note_payload.get('file_path') or note_payload.get('filename')
|
||||
|
||||
# Notfall-Fallback: Konstruktion aus ID
|
||||
if not origin_fname and 'note_id' in note_payload:
|
||||
origin_fname = f"{note_payload['note_id']}.md"
|
||||
|
||||
# 3. Message in den Chat-Verlauf injecten
|
||||
# Diese Nachricht dient als Datencontainer für den Editor im "Manuellen Modus"
|
||||
st.session_state.messages.append({
|
||||
"role": "assistant",
|
||||
"intent": "INTERVIEW",
|
||||
"content": content,
|
||||
"query_id": f"edit_{note_payload['note_id']}",
|
||||
"origin_filename": origin_fname,
|
||||
"origin_note_id": note_payload['note_id']
|
||||
})
|
||||
|
||||
# 4. Modus umschalten (erzwingt Wechsel zum Editor-Tab beim nächsten Re-Run)
|
||||
st.session_state["sidebar_mode_selection"] = "📝 Manueller Editor"
|
||||
Reference in new issue
Block a user