Spaces:
Sleeping

File size: 1,249 Bytes
5a6158c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

from rich.console import Console
from rich.markdown import Markdown
from rich.panel import Panel
from rich.prompt import Prompt
from rich.syntax import Syntax
from rich.live import Live

console = Console()

class CLI:
    def print_welcome(self):
        console.print(Panel.fit(
            "[bold blue]AI Coding Assistant[/bold blue]\n"
            "[italic]Powered by Leaked System Prompts[/italic]",
            border_style="blue"
        ))

    def get_user_input(self):
        return Prompt.ask("\n[bold green]You[/bold green]")

    def print_assistant_response(self, text):
        console.print("\n[bold purple]Assistant[/bold purple]")
        console.print(Markdown(text))

    def print_tool_execution(self, tool_name, args, result):
        console.print(f"[dim]Executing {tool_name}...[/dim]")
        if len(str(result)) > 500:
            display_result = str(result)[:500] + "... (truncated)"
        else:
            display_result = str(result)
        
        console.print(Panel(
            display_result,
            title=f"Tool: {tool_name}",
            border_style="yellow",
            expand=False
        ))

    def print_error(self, message):
         console.print(f"[bold red]Error:[/bold red] {message}")