neue Funkktionen für Graphendarstellung

This commit is contained in:
Lars committed 2025-12-14 08:49:55 +01:00
1 parent 93b8bc48e4
commit 72a3988e49
3 files changed
+310 -163

No files matched your search

+51 -21
View File
@@ -1,4 +1,5 @@
import os
import hashlib
from dotenv import load_dotenv
from pathlib import Path
@@ -23,27 +24,56 @@ timeout_setting = os.getenv("MINDNET_API_TIMEOUT") or os.getenv("MINDNET_LLM_TIM
API_TIMEOUT = float(timeout_setting) if timeout_setting else 300.0
# --- STYLING CONSTANTS ---
# Basierend auf types.yaml
GRAPH_COLORS = {
"project": "#ff9f43", # Orange
"concept": "#54a0ff", # Blau
"decision": "#5f27cd", # Lila
"risk": "#ff6b6b", # Rot
"person": "#1dd1a1", # Grün
"experience": "#feca57",# Gelb
"value": "#00d2d3", # Cyan
"goal": "#ff9ff3", # Pink
"default": "#8395a7" # Grau
# Kerntypen
"experience": "#feca57", # Gelb/Orange
"project": "#ff9f43", # Dunkleres Orange
"decision": "#5f27cd", # Lila
# Persönlichkeit
"value": "#00d2d3", # Cyan
"principle": "#0abde3", # Dunkles Cyan
"belief": "#48dbfb", # Helles Blau
"profile": "#1dd1a1", # Grün
# Strategie & Risiko
"goal": "#ff9ff3", # Pink
"risk": "#ff6b6b", # Rot
# Basis
"concept": "#54a0ff", # Blau
"task": "#8395a7", # Grau-Blau
"journal": "#c8d6e5", # Hellgrau
"source": "#576574", # Dunkelgrau
"glossary": "#222f3e", # Sehr dunkel
"default": "#8395a7" # Fallback
}
EDGE_COLORS = {
"depends_on": "#ff6b6b", # Rot (Blocker)
"blocks": "#ee5253", # Dunkelrot
"caused_by": "#ff9ff3", # Pink
"related_to": "#c8d6e5", # Hellgrau
"similar_to": "#c8d6e5", # Hellgrau
"next": "#54a0ff", # Blau
"derived_from": "#ff9ff3", # Pink
"references": "#bdc3c7", # Grau
"belongs_to": "#2e86de", # Dunkelblau
"contributes_to": "#1dd1a1" # Grün (Neu!)
}
# System-Kanten, die wir NICHT im Graphen sehen wollen, um Rauschen zu reduzieren
SYSTEM_EDGES = ["prev", "next", "belongs_to"]
def get_edge_color(kind: str) -> str:
"""Generiert eine deterministische Farbe basierend auf dem Edge-Typ."""
if not kind: return "#bdc3c7"
# Einige feste Farben für wichtige semantische Typen
fixed_colors = {
"depends_on": "#ff6b6b", # Rot (Blocker/Abhängigkeit)
"blocks": "#ee5253", # Dunkelrot
"caused_by": "#ff9ff3", # Pink
"related_to": "#c8d6e5", # Hellgrau (Hintergrund)
"references": "#bdc3c7", # Grau
"derived_from": "#1dd1a1" # Grün
}
if kind in fixed_colors:
return fixed_colors[kind]
# Fallback: Hash-basierte Farbe für dynamische Typen
# Wir nutzen einen Pastell-Generator, damit es nicht zu grell wird
hash_obj = hashlib.md5(kind.encode())
hue = int(hash_obj.hexdigest(), 16) % 360
return f"hsl({hue}, 60%, 50%)"