janito 3.5.0__py3-none-any.whl → 3.6.1__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/README.md +4 -4
- janito/cli/cli_commands/list_tools.py +6 -1
- janito/cli/main_cli.py +1 -1
- janito/cli/rich_terminal_reporter.py +2 -2
- janito/data/blocked.txt +96 -0
- janito/docs/GETTING_STARTED.md +8 -9
- janito/plugins/core/system/tools/run_bash_command.py +23 -2
- janito/plugins/core/system/tools/run_powershell_command.py +16 -0
- janito/plugins/tools/__init__.py +34 -5
- janito/plugins/tools/core/__init__.py +65 -0
- janito/plugins/tools/{ask_user.py → core/ask_user.py} +1 -1
- janito/plugins/tools/{copy_file.py → core/copy_file.py} +1 -1
- janito/plugins/tools/{create_directory.py → core/create_directory.py} +1 -1
- janito/plugins/tools/{create_file.py → core/create_file.py} +2 -2
- janito/plugins/tools/{delete_text_in_file.py → core/delete_text_in_file.py} +2 -2
- janito/plugins/tools/{fetch_url.py → core/fetch_url.py} +18 -21
- janito/plugins/tools/{find_files.py → core/find_files.py} +1 -1
- janito/plugins/tools/{get_file_outline → core/get_file_outline}/core.py +1 -1
- janito/plugins/tools/{move_file.py → core/move_file.py} +1 -1
- janito/plugins/tools/{open_html_in_browser.py → core/open_html_in_browser.py} +1 -1
- janito/plugins/tools/{open_url.py → core/open_url.py} +1 -1
- janito/plugins/tools/{python_code_run.py → core/python_code_run.py} +21 -5
- janito/plugins/tools/{python_command_run.py → core/python_command_run.py} +19 -3
- janito/plugins/tools/{python_file_run.py → core/python_file_run.py} +19 -3
- janito/plugins/tools/{read_chart.py → core/read_chart.py} +1 -1
- janito/plugins/tools/{read_files.py → core/read_files.py} +1 -1
- janito/plugins/tools/{remove_directory.py → core/remove_directory.py} +1 -1
- janito/plugins/tools/{remove_file.py → core/remove_file.py} +1 -1
- janito/plugins/tools/{replace_text_in_file.py → core/replace_text_in_file.py} +2 -2
- janito/plugins/tools/{run_bash_command.py → core/run_bash_command.py} +1 -1
- janito/plugins/tools/{run_powershell_command.py → core/run_powershell_command.py} +1 -1
- janito/plugins/tools/{search_text → core/search_text}/core.py +1 -1
- janito/plugins/tools/{show_image.py → core/show_image.py} +1 -1
- janito/plugins/tools/{show_image_grid.py → core/show_image_grid.py} +1 -1
- janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/core.py +1 -1
- janito/plugins/tools/{view_file.py → core/view_file.py} +1 -1
- janito/plugins/web/webtools/__init__.py +1 -11
- janito/providers/moonshot/model_info.py +15 -4
- janito/providers/moonshot/provider.py +1 -1
- janito/tools/__init__.py +14 -4
- janito/tools/adapters/local/copy_file.py +0 -0
- janito/tools/adapters/local/create_file.py +0 -0
- janito/tools/adapters/local/move_file.py +0 -0
- janito/tools/adapters/local/remove_file.py +0 -0
- janito/tools/adapters/local/view_file.py +0 -0
- janito/tools/blocked_sites.py +74 -0
- {janito-3.5.0.dist-info → janito-3.6.1.dist-info}/METADATA +7 -8
- {janito-3.5.0.dist-info → janito-3.6.1.dist-info}/RECORD +73 -70
- janito/plugins/dev/pythondev/tools/python_code_run.py +0 -172
- janito/plugins/dev/pythondev/tools/python_command_run.py +0 -171
- janito/plugins/dev/pythondev/tools/python_file_run.py +0 -172
- janito/plugins/tools/core_tools_plugin.py +0 -87
- janito/plugins/web/webtools/tools/fetch_url.py +0 -458
- /janito/plugins/tools/{decorators.py → core/decorators.py} +0 -0
- /janito/plugins/tools/{get_file_outline → core/get_file_outline}/__init__.py +0 -0
- /janito/plugins/tools/{get_file_outline → core/get_file_outline}/java_outline.py +0 -0
- /janito/plugins/tools/{get_file_outline → core/get_file_outline}/markdown_outline.py +0 -0
- /janito/plugins/tools/{get_file_outline → core/get_file_outline}/python_outline.py +0 -0
- /janito/plugins/tools/{get_file_outline → core/get_file_outline}/search_outline.py +0 -0
- /janito/plugins/tools/{search_text → core/search_text}/__init__.py +0 -0
- /janito/plugins/tools/{search_text → core/search_text}/match_lines.py +0 -0
- /janito/plugins/tools/{search_text → core/search_text}/pattern_utils.py +0 -0
- /janito/plugins/tools/{search_text → core/search_text}/traverse_directory.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/__init__.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/css_validator.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/html_validator.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/jinja2_validator.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/js_validator.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/json_validator.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/markdown_validator.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/ps1_validator.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/python_validator.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/xml_validator.py +0 -0
- /janito/plugins/tools/{validate_file_syntax → core/validate_file_syntax}/yaml_validator.py +0 -0
- {janito-3.5.0.dist-info → janito-3.6.1.dist-info}/WHEEL +0 -0
- {janito-3.5.0.dist-info → janito-3.6.1.dist-info}/entry_points.txt +0 -0
- {janito-3.5.0.dist-info → janito-3.6.1.dist-info}/licenses/LICENSE +0 -0
- {janito-3.5.0.dist-info → janito-3.6.1.dist-info}/top_level.txt +0 -0
@@ -5,7 +5,7 @@ import tempfile
|
|
5
5
|
import threading
|
6
6
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
7
7
|
from janito.report_events import ReportAction
|
8
|
-
from
|
8
|
+
from .decorators import register_core_tool
|
9
9
|
from janito.i18n import tr
|
10
10
|
|
11
11
|
|
@@ -92,6 +92,9 @@ class PythonCommandRun(ToolBase):
|
|
92
92
|
def stream_output(stream, file_obj, report_func, count_func):
|
93
93
|
nonlocal stdout_lines, stderr_lines
|
94
94
|
for line in stream:
|
95
|
+
# Check for cancellation
|
96
|
+
if hasattr(self, '_cancel_event') and self._cancel_event.is_set():
|
97
|
+
break
|
95
98
|
file_obj.write(line)
|
96
99
|
file_obj.flush()
|
97
100
|
from janito.tools.tool_base import ReportAction
|
@@ -102,6 +105,11 @@ class PythonCommandRun(ToolBase):
|
|
102
105
|
else:
|
103
106
|
stderr_lines += 1
|
104
107
|
|
108
|
+
# Set up cancellation event
|
109
|
+
from janito.llm.cancellation_manager import get_cancellation_manager
|
110
|
+
cancel_manager = get_cancellation_manager()
|
111
|
+
self._cancel_event = cancel_manager.get_current_cancel_event()
|
112
|
+
|
105
113
|
stdout_thread = threading.Thread(
|
106
114
|
target=stream_output,
|
107
115
|
args=(process.stdout, stdout_file, self.report_stdout, "stdout"),
|
@@ -112,8 +120,16 @@ class PythonCommandRun(ToolBase):
|
|
112
120
|
)
|
113
121
|
stdout_thread.start()
|
114
122
|
stderr_thread.start()
|
115
|
-
|
116
|
-
|
123
|
+
|
124
|
+
try:
|
125
|
+
stdout_thread.join()
|
126
|
+
stderr_thread.join()
|
127
|
+
except Exception as e:
|
128
|
+
# Handle cancellation
|
129
|
+
if self._cancel_event and self._cancel_event.is_set():
|
130
|
+
process.kill()
|
131
|
+
self.report_warning(tr("Code execution cancelled by user"), ReportAction.EXECUTE)
|
132
|
+
raise
|
117
133
|
return stdout_lines, stderr_lines
|
118
134
|
|
119
135
|
def _wait_for_process(self, process, timeout):
|
@@ -5,7 +5,7 @@ import tempfile
|
|
5
5
|
import threading
|
6
6
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
7
7
|
from janito.report_events import ReportAction
|
8
|
-
from
|
8
|
+
from .decorators import register_core_tool
|
9
9
|
from janito.i18n import tr
|
10
10
|
|
11
11
|
|
@@ -92,6 +92,9 @@ class PythonFileRun(ToolBase):
|
|
92
92
|
def stream_output(stream, file_obj, report_func, count_func):
|
93
93
|
nonlocal stdout_lines, stderr_lines
|
94
94
|
for line in stream:
|
95
|
+
# Check for cancellation
|
96
|
+
if hasattr(self, '_cancel_event') and self._cancel_event.is_set():
|
97
|
+
break
|
95
98
|
file_obj.write(line)
|
96
99
|
file_obj.flush()
|
97
100
|
# Always supply a default action for stdout/stderr reporting
|
@@ -103,6 +106,11 @@ class PythonFileRun(ToolBase):
|
|
103
106
|
else:
|
104
107
|
stderr_lines += 1
|
105
108
|
|
109
|
+
# Set up cancellation event
|
110
|
+
from janito.llm.cancellation_manager import get_cancellation_manager
|
111
|
+
cancel_manager = get_cancellation_manager()
|
112
|
+
self._cancel_event = cancel_manager.get_current_cancel_event()
|
113
|
+
|
106
114
|
stdout_thread = threading.Thread(
|
107
115
|
target=stream_output,
|
108
116
|
args=(process.stdout, stdout_file, self.report_stdout, "stdout"),
|
@@ -113,8 +121,16 @@ class PythonFileRun(ToolBase):
|
|
113
121
|
)
|
114
122
|
stdout_thread.start()
|
115
123
|
stderr_thread.start()
|
116
|
-
|
117
|
-
|
124
|
+
|
125
|
+
try:
|
126
|
+
stdout_thread.join()
|
127
|
+
stderr_thread.join()
|
128
|
+
except Exception as e:
|
129
|
+
# Handle cancellation
|
130
|
+
if self._cancel_event and self._cancel_event.is_set():
|
131
|
+
process.kill()
|
132
|
+
self.report_warning(tr("File execution cancelled by user"), ReportAction.EXECUTE)
|
133
|
+
raise
|
118
134
|
return stdout_lines, stderr_lines
|
119
135
|
|
120
136
|
def _wait_for_process(self, process, timeout):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
2
2
|
from janito.report_events import ReportAction
|
3
|
-
from
|
3
|
+
from .decorators import register_core_tool
|
4
4
|
from janito.tools.tool_utils import display_path
|
5
5
|
from janito.i18n import tr
|
6
6
|
import json
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
2
2
|
from janito.report_events import ReportAction
|
3
|
-
from
|
3
|
+
from .decorators import register_core_tool
|
4
4
|
from janito.tools.tool_utils import pluralize
|
5
5
|
from janito.i18n import tr
|
6
6
|
from janito.tools.loop_protection_decorator import protect_against_loops
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
2
2
|
from janito.report_events import ReportAction
|
3
|
-
from
|
3
|
+
from .decorators import register_core_tool
|
4
4
|
from janito.tools.tool_utils import pluralize, display_path
|
5
5
|
from janito.i18n import tr
|
6
6
|
import shutil
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import os
|
2
2
|
from janito.tools.path_utils import expand_path
|
3
3
|
import shutil
|
4
|
-
from
|
4
|
+
from .decorators import register_core_tool
|
5
5
|
|
6
6
|
from janito.tools.tool_utils import display_path
|
7
7
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
@@ -1,10 +1,10 @@
|
|
1
1
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
2
2
|
from janito.report_events import ReportAction
|
3
|
-
from
|
3
|
+
from .decorators import register_core_tool
|
4
4
|
from janito.i18n import tr
|
5
5
|
import shutil
|
6
6
|
import re
|
7
|
-
from
|
7
|
+
from .validate_file_syntax.core import validate_file_syntax
|
8
8
|
|
9
9
|
|
10
10
|
@register_core_tool
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
2
2
|
from janito.report_events import ReportAction
|
3
|
-
from
|
3
|
+
from .decorators import register_core_tool
|
4
4
|
from janito.i18n import tr
|
5
5
|
import subprocess
|
6
6
|
import tempfile
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
2
2
|
from janito.report_events import ReportAction
|
3
|
-
from
|
3
|
+
from .decorators import register_core_tool
|
4
4
|
from janito.i18n import tr
|
5
5
|
import subprocess
|
6
6
|
import os
|
@@ -11,7 +11,7 @@ from .traverse_directory import traverse_directory
|
|
11
11
|
from janito.tools.loop_protection_decorator import protect_against_loops
|
12
12
|
|
13
13
|
|
14
|
-
from
|
14
|
+
from ..decorators import register_core_tool
|
15
15
|
|
16
16
|
|
17
17
|
@register_core_tool
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
2
2
|
from janito.report_events import ReportAction
|
3
|
-
from
|
3
|
+
from .decorators import register_core_tool
|
4
4
|
from janito.i18n import tr
|
5
5
|
from janito.tools.loop_protection_decorator import protect_against_loops
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
2
2
|
from janito.report_events import ReportAction
|
3
|
-
from
|
3
|
+
from .decorators import register_core_tool
|
4
4
|
from janito.i18n import tr
|
5
5
|
from janito.tools.loop_protection_decorator import protect_against_loops
|
6
6
|
from typing import Sequence
|
@@ -5,7 +5,7 @@ from janito.tools.tool_base import ToolBase, ToolPermissions
|
|
5
5
|
from janito.report_events import ReportAction
|
6
6
|
from janito.tools.adapters.local.adapter import register_local_tool
|
7
7
|
from janito.tools.tool_utils import display_path
|
8
|
-
from
|
8
|
+
from ..decorators import register_core_tool as register_tool
|
9
9
|
|
10
10
|
from .python_validator import validate_python
|
11
11
|
from .json_validator import validate_json
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from janito.tools.tool_base import ToolBase, ToolPermissions
|
2
2
|
from janito.report_events import ReportAction
|
3
|
-
from
|
3
|
+
from .decorators import register_core_tool
|
4
4
|
from janito.tools.tool_utils import pluralize
|
5
5
|
from janito.i18n import tr
|
6
6
|
from janito.tools.loop_protection_decorator import protect_against_loops
|
@@ -7,16 +7,6 @@ Web scraping, browsing, and URL operations.
|
|
7
7
|
from typing import Optional, Dict, List
|
8
8
|
|
9
9
|
|
10
|
-
def fetch_url(
|
11
|
-
url: str,
|
12
|
-
search_strings: Optional[List[str]] = None,
|
13
|
-
max_length: int = 5000,
|
14
|
-
timeout: int = 10,
|
15
|
-
) -> str:
|
16
|
-
"""Download web pages with advanced options"""
|
17
|
-
return f"fetch_url(url='{url}', search={len(search_strings or [])} terms)"
|
18
|
-
|
19
|
-
|
20
10
|
def open_url(url: str) -> str:
|
21
11
|
"""Open URLs in default browser"""
|
22
12
|
return f"open_url(url='{url}')"
|
@@ -30,4 +20,4 @@ def open_html_in_browser(path: str) -> str:
|
|
30
20
|
# Plugin metadata
|
31
21
|
__plugin_name__ = "web.webtools"
|
32
22
|
__plugin_description__ = "Web scraping, browsing, and URL operations"
|
33
|
-
__plugin_tools__ = [
|
23
|
+
__plugin_tools__ = [open_url, open_html_in_browser]
|
@@ -1,8 +1,19 @@
|
|
1
1
|
from janito.llm.model import LLMModelInfo
|
2
2
|
|
3
3
|
MOONSHOT_MODEL_SPECS = {
|
4
|
-
"kimi-k2-
|
5
|
-
name="kimi-k2-
|
4
|
+
"kimi-k2-0905": LLMModelInfo(
|
5
|
+
name="kimi-k2-0905",
|
6
|
+
context=256000,
|
7
|
+
max_input=200000,
|
8
|
+
max_cot="N/A",
|
9
|
+
max_response=8192,
|
10
|
+
thinking_supported=False,
|
11
|
+
default_temp=0.2,
|
12
|
+
open="moonshot",
|
13
|
+
driver="OpenAIModelDriver",
|
14
|
+
),
|
15
|
+
"kimi-k2-turbo-preview": LLMModelInfo(
|
16
|
+
name="kimi-k2-turbo-preview",
|
6
17
|
context=128000,
|
7
18
|
max_input=100000,
|
8
19
|
max_cot="N/A",
|
@@ -12,8 +23,8 @@ MOONSHOT_MODEL_SPECS = {
|
|
12
23
|
open="moonshot",
|
13
24
|
driver="OpenAIModelDriver",
|
14
25
|
),
|
15
|
-
"kimi-k2-
|
16
|
-
name="kimi-k2-
|
26
|
+
"kimi-k2-0711-preview": LLMModelInfo(
|
27
|
+
name="kimi-k2-0711-preview",
|
17
28
|
context=128000,
|
18
29
|
max_input=100000,
|
19
30
|
max_cot="N/A",
|
@@ -12,7 +12,7 @@ class MoonshotProvider(LLMProvider):
|
|
12
12
|
NAME = "moonshot"
|
13
13
|
MAINTAINER = "João Pinto <janito@ikignosis.org>"
|
14
14
|
MODEL_SPECS = MOONSHOT_MODEL_SPECS
|
15
|
-
DEFAULT_MODEL = "kimi-k2-
|
15
|
+
DEFAULT_MODEL = "kimi-k2-0905"
|
16
16
|
|
17
17
|
def __init__(
|
18
18
|
self, auth_manager: LLMAuthManager = None, config: LLMDriverConfig = None
|
janito/tools/__init__.py
CHANGED
@@ -33,14 +33,24 @@ def get_local_tools_adapter(workdir=None, allowed_permissions=None):
|
|
33
33
|
local_tools_adapter = None
|
34
34
|
|
35
35
|
|
36
|
+
def _initialize_global_adapter():
|
37
|
+
"""Initialize the global tools adapter."""
|
38
|
+
global local_tools_adapter
|
39
|
+
if local_tools_adapter is None:
|
40
|
+
from janito.tools.cli_initializer import get_cli_tools_adapter
|
41
|
+
# Try CLI initialization first
|
42
|
+
local_tools_adapter = get_cli_tools_adapter()
|
43
|
+
if local_tools_adapter is None:
|
44
|
+
# Fallback to regular initialization
|
45
|
+
from janito.tools.initialize import initialize_tools
|
46
|
+
local_tools_adapter = initialize_tools(LocalToolsAdapter())
|
47
|
+
|
48
|
+
|
36
49
|
def get_local_tools_adapter(workdir=None, allowed_permissions=None):
|
37
50
|
"""Get the global tools adapter, initializing on first use."""
|
38
51
|
global local_tools_adapter
|
39
52
|
if local_tools_adapter is None:
|
40
|
-
|
41
|
-
|
42
|
-
adapter = LocalToolsAdapter(workdir=workdir)
|
43
|
-
local_tools_adapter = initialize_tools(adapter)
|
53
|
+
_initialize_global_adapter()
|
44
54
|
|
45
55
|
# Handle workdir if provided
|
46
56
|
if workdir is not None and local_tools_adapter is not None:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"""Blocked sites management for fetch_url tool to prevent access to known problematic sites."""
|
2
|
+
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import Set
|
5
|
+
from urllib.parse import urlparse
|
6
|
+
|
7
|
+
|
8
|
+
class BlockedSitesManager:
|
9
|
+
"""Manages blocked sites for the fetch_url tool using the local blocked.txt file."""
|
10
|
+
|
11
|
+
def __init__(self):
|
12
|
+
# Use package data directory for blocked.txt
|
13
|
+
import janito
|
14
|
+
package_dir = Path(janito.__file__).parent
|
15
|
+
self.blocked_file_path = package_dir / "data" / "blocked.txt"
|
16
|
+
self._blocked_sites = self._load_blocked_sites()
|
17
|
+
|
18
|
+
def _load_blocked_sites(self) -> Set[str]:
|
19
|
+
"""Load blocked sites from the blocked.txt file."""
|
20
|
+
blocked = set()
|
21
|
+
|
22
|
+
if self.blocked_file_path.exists():
|
23
|
+
try:
|
24
|
+
with open(self.blocked_file_path, "r", encoding="utf-8") as f:
|
25
|
+
for line in f:
|
26
|
+
line = line.strip()
|
27
|
+
if line and not line.startswith("#"):
|
28
|
+
# Extract domain from URL if it's a full URL
|
29
|
+
if line.startswith("http://") or line.startswith("https://"):
|
30
|
+
parsed = urlparse(line)
|
31
|
+
domain = parsed.netloc
|
32
|
+
if domain:
|
33
|
+
blocked.add(domain.lower())
|
34
|
+
else:
|
35
|
+
# Assume it's already a domain
|
36
|
+
blocked.add(line.lower())
|
37
|
+
except IOError:
|
38
|
+
pass
|
39
|
+
|
40
|
+
return blocked
|
41
|
+
|
42
|
+
def is_url_blocked(self, url: str) -> bool:
|
43
|
+
"""Check if a URL is blocked."""
|
44
|
+
if not self._blocked_sites:
|
45
|
+
return False
|
46
|
+
|
47
|
+
try:
|
48
|
+
parsed = urlparse(url)
|
49
|
+
domain = parsed.netloc.lower()
|
50
|
+
|
51
|
+
# Check exact matches and subdomain matches
|
52
|
+
for blocked in self._blocked_sites:
|
53
|
+
if domain == blocked or domain.endswith("." + blocked):
|
54
|
+
return True
|
55
|
+
|
56
|
+
return False
|
57
|
+
except Exception:
|
58
|
+
return False # Invalid URLs are not blocked by default
|
59
|
+
|
60
|
+
def get_blocked_sites(self) -> list[str]:
|
61
|
+
"""Get the list of blocked sites."""
|
62
|
+
return sorted(self._blocked_sites)
|
63
|
+
|
64
|
+
|
65
|
+
# Global singleton
|
66
|
+
_blocked_sites_manager = None
|
67
|
+
|
68
|
+
|
69
|
+
def get_blocked_sites_manager() -> BlockedSitesManager:
|
70
|
+
"""Get the global blocked sites manager instance."""
|
71
|
+
global _blocked_sites_manager
|
72
|
+
if _blocked_sites_manager is None:
|
73
|
+
_blocked_sites_manager = BlockedSitesManager()
|
74
|
+
return _blocked_sites_manager
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: janito
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.6.1
|
4
4
|
Summary: A new Python package called janito.
|
5
5
|
Author-email: João Pinto <janito@ikignosis.org>
|
6
6
|
Project-URL: Homepage, https://github.com/ikignosis/janito
|
@@ -29,7 +29,6 @@ Requires-Dist: codespell==2.4.1; extra == "dev"
|
|
29
29
|
Requires-Dist: black; extra == "dev"
|
30
30
|
Requires-Dist: questionary>=2.0.1; extra == "dev"
|
31
31
|
Requires-Dist: setuptools_scm>=8.0; extra == "dev"
|
32
|
-
Provides-Extra: coder
|
33
32
|
Dynamic: license-file
|
34
33
|
|
35
34
|
# Janito CLI
|
@@ -46,7 +45,7 @@ pip install janito
|
|
46
45
|
|
47
46
|
### First-Time Setup
|
48
47
|
|
49
|
-
1. **Get your API key**: Sign up at [Moonshot AI](https://platform.moonshot.
|
48
|
+
1. **Get your API key**: Sign up at [Moonshot AI](https://platform.moonshot.ai) and get your API key
|
50
49
|
2. **Set your API key**:
|
51
50
|
```bash
|
52
51
|
janito --set-api-key YOUR_MOONSHOT_API_KEY -p moonshot
|
@@ -60,7 +59,7 @@ pip install janito
|
|
60
59
|
janito "Create a Python script that reads a CSV file"
|
61
60
|
|
62
61
|
# Using a specific Moonshot model
|
63
|
-
janito -m kimi-
|
62
|
+
janito -m kimi-k2-0905 "Explain quantum computing"
|
64
63
|
```
|
65
64
|
|
66
65
|
**Other Providers**
|
@@ -106,16 +105,16 @@ In chat mode, you can:
|
|
106
105
|
Set default provider and model:
|
107
106
|
```bash
|
108
107
|
janito --set provider=moonshot
|
109
|
-
janito --set model=kimi-
|
108
|
+
janito --set model=kimi-k2-0905
|
110
109
|
```
|
111
110
|
|
112
111
|
## Providers
|
113
112
|
|
114
113
|
### Moonshot (Recommended)
|
115
114
|
|
116
|
-
- **Models**: kimi-
|
115
|
+
- **Models**: kimi-k2-0905, kimi-k2-turbo-preview, kimi-k2-0711-preview
|
117
116
|
- **Strengths**: Excellent Chinese/English support, competitive pricing, fast responses
|
118
|
-
- **Setup**: Get API key from [Moonshot AI Platform](https://platform.moonshot.
|
117
|
+
- **Setup**: Get API key from [Moonshot AI Platform](https://platform.moonshot.ai)
|
119
118
|
|
120
119
|
### OpenAI
|
121
120
|
|
@@ -167,7 +166,7 @@ You can also configure via environment variables:
|
|
167
166
|
```bash
|
168
167
|
export MOONSHOT_API_KEY=your_key_here
|
169
168
|
export JANITO_PROVIDER=moonshot
|
170
|
-
export JANITO_MODEL=kimi-
|
169
|
+
export JANITO_MODEL=kimi-k2-0905
|
171
170
|
```
|
172
171
|
|
173
172
|
**OpenAI:**
|