Coverage for src / osiris_cli / thought_display.py: 0%
44 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-27 17:41 +0200
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-27 17:41 +0200
1#!/usr/bin/env python3
2"""
3Thought Display - Show model's reasoning process (Gemini-style)
4"""
6from rich.console import Console
7from rich.text import Text
8from rich.panel import Panel
10console = Console()
13class ThoughtRenderer:
14 """
15 Renders model thoughts and reasoning process
16 """
18 COLORS = {
19 "thought": "#A78BFA", # Purple
20 "planning": "#00D9FF", # Cyan
21 "analysis": "#FFB800", # Orange
22 "muted": "#6B7280", # Gray
23 }
25 @staticmethod
26 def show_thought(thought: str, thought_type: str = "thinking"):
27 """Display a thought bubble"""
28 icon_map = {
29 "thinking": "💭",
30 "planning": "📋",
31 "analyzing": "🔍",
32 "deciding": "🤔",
33 "learning": "📚",
34 }
36 icon = icon_map.get(thought_type, "💭")
38 thought_text = Text()
39 thought_text.append(f"\n{icon} ", style="bold")
40 thought_text.append(thought, style=f"italic {ThoughtRenderer.COLORS['thought']}")
42 console.print(thought_text)
44 @staticmethod
45 def show_planning(steps: list):
46 """Display planning steps"""
47 console.print()
49 plan_text = Text()
50 plan_text.append("📋 Planning:\n", style=f"bold {ThoughtRenderer.COLORS['planning']}")
52 for i, step in enumerate(steps, 1):
53 plan_text.append(f" {i}. ", style=ThoughtRenderer.COLORS["muted"])
54 plan_text.append(f"{step}\n", style=f"italic {ThoughtRenderer.COLORS['thought']}")
56 console.print(plan_text)
58 @staticmethod
59 def show_analysis(analysis: str):
60 """Display analysis"""
61 analysis_text = Text()
62 analysis_text.append("\n🔍 Analysis: ", style=f"bold {ThoughtRenderer.COLORS['analysis']}")
63 analysis_text.append(analysis, style=f"italic {ThoughtRenderer.COLORS['thought']}")
65 console.print(analysis_text)
67 @staticmethod
68 def show_decision(decision: str, reasoning: str = None):
69 """Display a decision with optional reasoning"""
70 decision_text = Text()
71 decision_text.append("\n🤔 Decision: ", style=f"bold {ThoughtRenderer.COLORS['planning']}")
72 decision_text.append(decision, style=f"italic {ThoughtRenderer.COLORS['thought']}")
74 if reasoning:
75 decision_text.append("\n Reasoning: ", style=ThoughtRenderer.COLORS["muted"])
76 decision_text.append(reasoning, style=f"dim italic {ThoughtRenderer.COLORS['thought']}")
78 console.print(decision_text)
81# Convenience functions
82def show_thought(thought: str):
83 """Quick function to show a thought"""
84 ThoughtRenderer.show_thought(thought)
87def show_planning(steps: list):
88 """Quick function to show planning"""
89 ThoughtRenderer.show_planning(steps)
92def show_analysis(analysis: str):
93 """Quick function to show analysis"""
94 ThoughtRenderer.show_analysis(analysis)