janito 2.1.1__py3-none-any.whl → 2.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- janito/__init__.py +1 -1
- janito/cli/chat_mode/shell/commands/__init__.py +0 -2
- janito/cli/chat_mode/shell/input_history.py +2 -2
- janito/cli/chat_mode/toolbar.py +2 -1
- janito/cli/config.py +1 -1
- janito/cli/core/runner.py +148 -144
- janito/provider_registry.py +158 -152
- janito/providers/azure_openai/provider.py +14 -0
- janito/providers/openai/model_info.py +0 -11
- janito/providers/openai/provider.py +1 -1
- janito/providers/registry.py +26 -26
- janito/tools/adapters/local/__init__.py +62 -62
- janito/tools/adapters/local/find_files.py +0 -2
- janito/tools/adapters/local/get_file_outline/core.py +68 -102
- janito/tools/adapters/local/get_file_outline/java_outline.py +40 -0
- janito/tools/adapters/local/open_html_in_browser.py +24 -29
- janito/tools/adapters/local/open_url.py +3 -2
- janito/tools/adapters/local/remove_file.py +5 -5
- janito/version.py +1 -1
- {janito-2.1.1.dist-info → janito-2.2.0.dist-info}/METADATA +21 -2
- {janito-2.1.1.dist-info → janito-2.2.0.dist-info}/RECORD +25 -24
- janito-2.2.0.dist-info/licenses/LICENSE +21 -0
- janito/cli/chat_mode/shell/commands/last.py +0 -137
- {janito-2.1.1.dist-info → janito-2.2.0.dist-info}/WHEEL +0 -0
- {janito-2.1.1.dist-info → janito-2.2.0.dist-info}/entry_points.txt +0 -0
- {janito-2.1.1.dist-info → janito-2.2.0.dist-info}/top_level.txt +0 -0
@@ -1,137 +0,0 @@
|
|
1
|
-
from janito.performance_collector import PerformanceCollector
|
2
|
-
from rich.tree import Tree
|
3
|
-
from rich.console import Console
|
4
|
-
from rich import print as rprint
|
5
|
-
import datetime
|
6
|
-
|
7
|
-
# TODO: Replace this with your actual collector instance retrieval
|
8
|
-
# For example, if you have a global or singleton:
|
9
|
-
# from janito.app_context import performance_collector as collector
|
10
|
-
from janito.perf_singleton import performance_collector as collector
|
11
|
-
from janito.cli.chat_mode.shell.commands.base import ShellCmdHandler
|
12
|
-
from janito.cli.console import shared_console
|
13
|
-
|
14
|
-
|
15
|
-
def _event_timestamp(event):
|
16
|
-
if hasattr(event, "timestamp"):
|
17
|
-
try:
|
18
|
-
ts = float(getattr(event, "timestamp", 0))
|
19
|
-
return f" [dim]{datetime.datetime.fromtimestamp(ts)}[/dim]"
|
20
|
-
except Exception:
|
21
|
-
return ""
|
22
|
-
return ""
|
23
|
-
|
24
|
-
|
25
|
-
def _event_tool_name(event):
|
26
|
-
return (
|
27
|
-
f" [cyan]{getattr(event, 'tool_name', '')}[/cyan]"
|
28
|
-
if hasattr(event, "tool_name")
|
29
|
-
else ""
|
30
|
-
)
|
31
|
-
|
32
|
-
|
33
|
-
def _event_params(event):
|
34
|
-
return (
|
35
|
-
f" Params: {getattr(event, 'params', '')}" if hasattr(event, "params") else ""
|
36
|
-
)
|
37
|
-
|
38
|
-
|
39
|
-
def _event_result(event):
|
40
|
-
return (
|
41
|
-
f" Result: {getattr(event, 'result', '')}" if hasattr(event, "result") else ""
|
42
|
-
)
|
43
|
-
|
44
|
-
|
45
|
-
def _event_error(event):
|
46
|
-
return (
|
47
|
-
f" [red]Error: {getattr(event, 'error')}[/red]"
|
48
|
-
if hasattr(event, "error") and getattr(event, "error", None)
|
49
|
-
else ""
|
50
|
-
)
|
51
|
-
|
52
|
-
|
53
|
-
def _event_message(event):
|
54
|
-
return (
|
55
|
-
f" [yellow]Message: {getattr(event, 'message')}[/yellow]"
|
56
|
-
if hasattr(event, "message")
|
57
|
-
else ""
|
58
|
-
)
|
59
|
-
|
60
|
-
|
61
|
-
def _event_subtype(event):
|
62
|
-
return (
|
63
|
-
f" [magenta]Subtype: {getattr(event, 'subtype')}[/magenta]"
|
64
|
-
if hasattr(event, "subtype")
|
65
|
-
else ""
|
66
|
-
)
|
67
|
-
|
68
|
-
|
69
|
-
def _event_status(event):
|
70
|
-
return (
|
71
|
-
f" [blue]Status: {getattr(event, 'status')}[/blue]"
|
72
|
-
if hasattr(event, "status")
|
73
|
-
else ""
|
74
|
-
)
|
75
|
-
|
76
|
-
|
77
|
-
def _event_duration(event):
|
78
|
-
return (
|
79
|
-
f" [green]Duration: {getattr(event, 'duration')}[/green]"
|
80
|
-
if hasattr(event, "duration")
|
81
|
-
else ""
|
82
|
-
)
|
83
|
-
|
84
|
-
|
85
|
-
def format_event(event_tuple, parent_tree=None):
|
86
|
-
event_type, event = event_tuple
|
87
|
-
desc = f"[bold]{event_type}[/bold]"
|
88
|
-
# Modular logic for each possible component
|
89
|
-
desc += _event_timestamp(event)
|
90
|
-
desc += _event_tool_name(event)
|
91
|
-
desc += _event_params(event)
|
92
|
-
desc += _event_result(event)
|
93
|
-
desc += _event_error(event)
|
94
|
-
desc += _event_message(event)
|
95
|
-
desc += _event_subtype(event)
|
96
|
-
desc += _event_status(event)
|
97
|
-
desc += _event_duration(event)
|
98
|
-
if parent_tree is not None:
|
99
|
-
node = parent_tree.add(desc)
|
100
|
-
else:
|
101
|
-
node = Tree(desc)
|
102
|
-
return node
|
103
|
-
|
104
|
-
|
105
|
-
def drill_down_last_generation():
|
106
|
-
events = collector.get_all_events()
|
107
|
-
# Find the last RequestStarted
|
108
|
-
last_gen_start = None
|
109
|
-
for i in range(len(events) - 1, -1, -1):
|
110
|
-
if events[i][0] == "RequestStarted":
|
111
|
-
last_gen_start = i
|
112
|
-
break
|
113
|
-
if last_gen_start is None:
|
114
|
-
rprint("[red]No generations found.[/red]")
|
115
|
-
return
|
116
|
-
# Find the next GenerationFinished after last_gen_start
|
117
|
-
for j in range(last_gen_start + 1, len(events)):
|
118
|
-
if events[j][0] == "GenerationFinished":
|
119
|
-
last_gen_end = j
|
120
|
-
break
|
121
|
-
else:
|
122
|
-
last_gen_end = len(events) - 1
|
123
|
-
gen_events = events[last_gen_start : last_gen_end + 1]
|
124
|
-
tree = Tree("[bold green]Last Generation Details[/bold green]")
|
125
|
-
for evt in gen_events:
|
126
|
-
format_event(evt, tree)
|
127
|
-
console = Console()
|
128
|
-
console.print(tree)
|
129
|
-
|
130
|
-
|
131
|
-
class LastShellHandler(ShellCmdHandler):
|
132
|
-
help_text = (
|
133
|
-
"Show details of the last generation, with drill-down of tool executions."
|
134
|
-
)
|
135
|
-
|
136
|
-
def run(self):
|
137
|
-
drill_down_last_generation()
|
File without changes
|
File without changes
|
File without changes
|