59 lines
2.3 KiB
Python
59 lines
2.3 KiB
Python
"""
|
|
FILE: app/frontend/ui.py
|
|
DESCRIPTION: Main Entrypoint für Streamlit. Router, der basierend auf Sidebar-Auswahl die Module (Chat, Editor, Graph) lädt.
|
|
VERSION: 2.6.0
|
|
STATUS: Active
|
|
DEPENDENCIES: streamlit, ui_config, ui_sidebar, ui_chat, ui_editor, ui_graph_service, ui_graph*, ui_graph_cytoscape
|
|
LAST_ANALYSIS: 2025-12-15
|
|
"""
|
|
|
|
import streamlit as st
|
|
import uuid
|
|
|
|
# --- CONFIG & STYLING ---
|
|
st.set_page_config(page_title="mindnet v2.6", page_icon="🧠", layout="wide")
|
|
st.markdown("""
|
|
<style>
|
|
.block-container { padding-top: 2rem; max_width: 1200px; margin: auto; }
|
|
.intent-badge { background-color: #e8f0fe; color: #1a73e8; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; border: 1px solid #d2e3fc; display: inline-block; margin-bottom: 0.5rem; }
|
|
.draft-box { border: 1px solid #d0d7de; border-radius: 6px; padding: 16px; background-color: #f6f8fa; margin: 10px 0; }
|
|
.preview-box { border: 1px solid #e0e0e0; border-radius: 6px; padding: 24px; background-color: white; }
|
|
</style>
|
|
""", unsafe_allow_html=True)
|
|
|
|
# --- MODULE IMPORTS ---
|
|
try:
|
|
from ui_config import QDRANT_URL, QDRANT_KEY, COLLECTION_PREFIX
|
|
from ui_graph_service import GraphExplorerService
|
|
|
|
# Komponenten
|
|
from ui_sidebar import render_sidebar
|
|
from ui_chat import render_chat_interface
|
|
from ui_editor import render_manual_editor
|
|
|
|
# Die beiden Graph-Engines
|
|
from ui_graph import render_graph_explorer as render_graph_agraph
|
|
from ui_graph_cytoscape import render_graph_explorer_cytoscape # <-- Import
|
|
|
|
except ImportError as e:
|
|
st.error(f"Import Error: {e}. Bitte stelle sicher, dass alle UI-Dateien im Ordner liegen und 'streamlit-cytoscapejs' installiert ist.")
|
|
st.stop()
|
|
|
|
# --- SESSION STATE ---
|
|
if "messages" not in st.session_state: st.session_state.messages = []
|
|
if "user_id" not in st.session_state: st.session_state.user_id = str(uuid.uuid4())
|
|
|
|
# --- SERVICE INIT ---
|
|
graph_service = GraphExplorerService(QDRANT_URL, QDRANT_KEY, COLLECTION_PREFIX)
|
|
|
|
# --- MAIN ROUTING ---
|
|
mode, top_k, explain = render_sidebar()
|
|
|
|
if mode == "💬 Chat":
|
|
render_chat_interface(top_k, explain)
|
|
elif mode == "📝 Manueller Editor":
|
|
render_manual_editor()
|
|
elif mode == "🕸️ Graph (Agraph)":
|
|
render_graph_agraph(graph_service)
|
|
elif mode == "🕸️ Graph (Cytoscape)":
|
|
render_graph_explorer_cytoscape(graph_service) |