Spaces:
Running
Running
File size: 5,872 Bytes
7fafb5b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# core/controller.py
from rich.console import Console
from rich.panel import Panel
from dream_engine.interpreter import interpret_dream
from core.agent_orchestrator import run_agents
from agents.jung_unified_agent import jung_unified_chat
from core.intent_detector import detect_intent
import time
console = Console()
def run_terminal():
console.print(Panel.fit(
"[bold cyan]CGJI01 — Jungian Intelligence v0.1[/bold cyan]\n"
"Local Analytical Psychology System",
border_style="cyan"
))
while True:
console.print("\n[bold yellow]Select Mode:[/bold yellow]")
console.print("1. Dream Analysis")
console.print("2. Psychological Material Analysis")
console.print("3. JU01")
console.print("4. Exit")
choice = input("\nEnter choice: ").strip()
if choice == "1":
print("Dream Analysis")
handle_dream_mode()
elif choice == "2":
print("Psychological Material Analysis")
handle_general_analysis()
#elif choice == "3":
# jung_unified_chat()
elif choice == "3":
print("JU")
from agents.jung_unified_agent import jung_unified_chat
jung_unified_chat()
elif choice == "4":
console.print("\n[bold green]Exiting JI01.[/bold green]")
break
else:
console.print("[bold red]Invalid choice. Try again.[/bold red]")
# ---------------------------
# DREAM MODE
# ---------------------------
def handle_dream_mode():
console.print("\n[bold cyan]Enter dream content:[/bold cyan]")
text = input("> ")
intent = detect_intent(text)
if intent in ["diagnostic", "minimal"]:
console.print("\n[bold green]System Status:[/bold green]")
console.print("✓ Dream engine operational")
return
# Step 1 — Symbol Extraction
dream_data = interpret_dream(text)
console.print("\n[bold magenta]Symbolic Extraction:[/bold magenta]")
console.print(dream_data)
# Step 2 — Multi-Agent Jung Analysis
console.print("\n[bold cyan]Running Jungian Multi-Agent Analysis...[/bold cyan]")
total_start = time.perf_counter()
analysis = run_agents(text)
total_end = time.perf_counter()
console.print("\n[bold green]Multi-Agent Synthesis/Faciliated Output:[/bold green]")
console.print(analysis)
console.print(
f"\n[bold green]Total Execution Time: {(total_end - total_start)/60:.2f} minutes ({total_end - total_start:.2f} seconds)[/bold green]"
)
# ---------------------------
# GENERAL PSYCHOLOGICAL MODE
# ---------------------------
def handle_general_analysis():
console.print("\n[bold cyan]Enter psychological material:[/bold cyan]")
text = input("> ")
intent = detect_intent(text)
if intent in ["diagnostic", "minimal"]:
console.print("\n[bold green]System Status:[/bold green]")
console.print("✓ JI01 operational")
return
console.print("\n[bold cyan]Running Jungian Multi-Agent Analysis...[/bold cyan]")
total_start = time.perf_counter()
#print("DEBUG: run_agents called")
analysis = run_agents(text)
total_end = time.perf_counter()
console.print("\n[bold green]Multi-Agent Synthesis/Facilitated Output:[/bold green]")
console.print(analysis)
console.print(
#f"\n[bold green]Total Execution Time: {total_end - total_start:.2f} seconds[/bold green]"
f"\n[bold green]Total Execution Time: {(total_end - total_start)/60:.2f} minutes[/bold green]"
)
"""
from rich.console import Console
from rich.panel import Panel
from dream_engine.interpreter import interpret_dream
from core.agent_orchestrator import run_agents
console = Console()
def run_terminal():
console.print(Panel.fit(
"[bold cyan]JI01 — Jungian Intelligence v0.1[/bold cyan]\n"
"Local Analytical Psychology System",
border_style="cyan"
))
while True:
console.print("\n[bold yellow]Select Mode:[/bold yellow]")
console.print("1. Dream Analysis")
console.print("2. Psychological Material Analysis")
console.print("3. Exit")
choice = input("\nEnter choice: ").strip()
if choice == "1":
handle_dream_mode()
elif choice == "2":
handle_general_analysis()
elif choice == "3":
console.print("\n[bold green]Exiting JI01.[/bold green]")
break
else:
console.print("[bold red]Invalid choice. Try again.[/bold red]")
# ---------------------------
# DREAM MODE
# ---------------------------
def handle_dream_mode():
console.print("\n[bold cyan]Enter dream content:[/bold cyan]")
text = input("> ")
# Step 1 — Symbol Extraction
dream_data = interpret_dream(text)
console.print("\n[bold magenta]Symbolic Extraction:[/bold magenta]")
console.print(dream_data)
# Step 2 — Multi-Agent Jung Analysis
console.print("\n[bold cyan]Running Jungian Multi-Agent Analysis...[/bold cyan]")
analysis = run_agents(text)
console.print("\n[bold green]Multi-Agent Synthesis:[/bold green]")
console.print(analysis)
# ---------------------------
# GENERAL PSYCHOLOGICAL MODE
# ---------------------------
def handle_general_analysis():
console.print("\n[bold cyan]Enter psychological material:[/bold cyan]")
text = input("> ")
console.print("\n[bold cyan]Running Jungian Multi-Agent Analysis...[/bold cyan]")
analysis = run_agents(text)
console.print("\n[bold green]Multi-Agent Synthesis:[/bold green]")
console.print(analysis)
"""
|