yzt 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.
- yanzhiti/__init__.py +18 -0
- yanzhiti/cli/__init__.py +7 -0
- yanzhiti/cli/diagnose.py +390 -0
- yanzhiti/cli/extended_commands.py +405 -0
- yanzhiti/cli/gui_launcher.py +89 -0
- yanzhiti/cli/local_main.py +329 -0
- yanzhiti/cli/main.py +404 -0
- yanzhiti/cli/setup_wizard.py +594 -0
- yanzhiti/cli/web_main.py +54 -0
- yanzhiti/core/__init__.py +22 -0
- yanzhiti/core/agent.py +335 -0
- yanzhiti/core/builtin_models.py +624 -0
- yanzhiti/core/context.py +301 -0
- yanzhiti/core/lm_studio_client.py +203 -0
- yanzhiti/core/local_query_engine.py +250 -0
- yanzhiti/core/mcp.py +338 -0
- yanzhiti/core/mlx_client.py +234 -0
- yanzhiti/core/permissions.py +318 -0
- yanzhiti/core/providers.py +979 -0
- yanzhiti/core/query_engine.py +293 -0
- yanzhiti/core/session.py +278 -0
- yanzhiti/core/tool.py +181 -0
- yanzhiti/core/unified_engine.py +480 -0
- yanzhiti/tools/__init__.py +64 -0
- yanzhiti/tools/advanced_tools.py +476 -0
- yanzhiti/tools/complete_tools.py +335 -0
- yanzhiti/tools/file_tools.py +366 -0
- yanzhiti/tools/git_tools.py +450 -0
- yanzhiti/tools/missing_tools.py +572 -0
- yanzhiti/tools/shell_tools.py +316 -0
- yanzhiti/tools/task_tools.py +415 -0
- yanzhiti/tools/web_tools.py +382 -0
- yanzhiti/types/__init__.py +131 -0
- yanzhiti/utils/__init__.py +15 -0
- yanzhiti/utils/config.py +149 -0
- yanzhiti/utils/logging.py +66 -0
- yanzhiti/web/__init__.py +7 -0
- yanzhiti/web/server.py +708 -0
- yanzhiti/web/static/favicon.svg +15 -0
- yanzhiti/web/static/index.html +975 -0
- yzt-2.2.0.dist-info/METADATA +429 -0
- yzt-2.2.0.dist-info/RECORD +47 -0
- yzt-2.2.0.dist-info/WHEEL +5 -0
- yzt-2.2.0.dist-info/entry_points.txt +9 -0
- yzt-2.2.0.dist-info/licenses/LICENSE +21 -0
- yzt-2.2.0.dist-info/licenses/NOTICE.md +52 -0
- yzt-2.2.0.dist-info/top_level.txt +1 -0
yanzhiti/__init__.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
衍智体 (YANZHITI) - Python Implementation
|
|
3
|
+
A comprehensive AI-powered coding assistant
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
__version__ = "2.2.0"
|
|
7
|
+
__author__ = "衍智体 (YANZHITI) Python Team"
|
|
8
|
+
|
|
9
|
+
from yanzhiti.core.query_engine import QueryEngine
|
|
10
|
+
from yanzhiti.core.tool import Tool, ToolResult
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"__version__",
|
|
14
|
+
"__author__",
|
|
15
|
+
"QueryEngine",
|
|
16
|
+
"Tool",
|
|
17
|
+
"ToolResult",
|
|
18
|
+
]
|
yanzhiti/cli/__init__.py
ADDED
yanzhiti/cli/diagnose.py
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"""
|
|
2
|
+
错误诊断和自动修复工具
|
|
3
|
+
Error Diagnosis and Auto-Fix Tool
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
import platform
|
|
8
|
+
import subprocess
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
import click
|
|
13
|
+
from rich.console import Console
|
|
14
|
+
from rich.panel import Panel
|
|
15
|
+
from rich.prompt import Confirm
|
|
16
|
+
from rich.table import Table
|
|
17
|
+
|
|
18
|
+
console = Console()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DiagnosticChecker:
|
|
22
|
+
"""诊断检查器 | Diagnostic checker"""
|
|
23
|
+
|
|
24
|
+
def __init__(self):
|
|
25
|
+
self.issues: list[dict] = []
|
|
26
|
+
self.fixes: list[dict] = []
|
|
27
|
+
|
|
28
|
+
def check_python_version(self) -> bool:
|
|
29
|
+
"""检查 Python 版本 | Check Python version"""
|
|
30
|
+
console.print("\n[cyan]检查 Python 版本 | Checking Python version...[/cyan]")
|
|
31
|
+
|
|
32
|
+
version = sys.version_info
|
|
33
|
+
required = (3, 10)
|
|
34
|
+
|
|
35
|
+
if version >= required:
|
|
36
|
+
console.print(f"[green]✓ Python {version.major}.{version.minor}.{version.micro} (满足要求 | Required: 3.10+)[/green]")
|
|
37
|
+
return True
|
|
38
|
+
else:
|
|
39
|
+
error_msg = f"✗ Python {version.major}.{version.minor}.{version.micro} (需要 3.10+ | Required: 3.10+)"
|
|
40
|
+
console.print(f"[red]{error_msg}[/red]")
|
|
41
|
+
|
|
42
|
+
self.issues.append({
|
|
43
|
+
"type": "python_version",
|
|
44
|
+
"severity": "error",
|
|
45
|
+
"message": error_msg,
|
|
46
|
+
"fix": "upgrade_python"
|
|
47
|
+
})
|
|
48
|
+
return False
|
|
49
|
+
|
|
50
|
+
def check_dependencies(self) -> bool:
|
|
51
|
+
"""检查依赖包 | Check dependencies"""
|
|
52
|
+
console.print("\n[cyan]检查依赖包 | Checking dependencies...[/cyan]")
|
|
53
|
+
|
|
54
|
+
required_packages = [
|
|
55
|
+
"anthropic", "click", "rich", "pydantic",
|
|
56
|
+
"httpx", "python-dotenv", "fastapi", "uvicorn"
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
missing = []
|
|
60
|
+
for pkg in required_packages:
|
|
61
|
+
try:
|
|
62
|
+
__import__(pkg.replace("-", "_"))
|
|
63
|
+
console.print(f"[green]✓ {pkg}[/green]")
|
|
64
|
+
except ImportError:
|
|
65
|
+
console.print(f"[red]✗ {pkg} (缺失 | Missing)[/red]")
|
|
66
|
+
missing.append(pkg)
|
|
67
|
+
|
|
68
|
+
if missing:
|
|
69
|
+
self.issues.append({
|
|
70
|
+
"type": "missing_dependencies",
|
|
71
|
+
"severity": "error",
|
|
72
|
+
"message": f"Missing packages: {', '.join(missing)}",
|
|
73
|
+
"fix": "install_dependencies",
|
|
74
|
+
"packages": missing
|
|
75
|
+
})
|
|
76
|
+
return False
|
|
77
|
+
|
|
78
|
+
console.print("[green]✓ 所有依赖已安装 | All dependencies installed[/green]")
|
|
79
|
+
return True
|
|
80
|
+
|
|
81
|
+
def check_env_file(self) -> bool:
|
|
82
|
+
"""检查 .env 文件 | Check .env file"""
|
|
83
|
+
console.print("\n[cyan]检查配置文件 | Checking configuration file...[/cyan]")
|
|
84
|
+
|
|
85
|
+
env_file = Path.cwd() / ".env"
|
|
86
|
+
|
|
87
|
+
if not env_file.exists():
|
|
88
|
+
console.print(f"[red]✗ .env file not found at {env_file}[/red]")
|
|
89
|
+
self.issues.append({
|
|
90
|
+
"type": "missing_env",
|
|
91
|
+
"severity": "error",
|
|
92
|
+
"message": "Configuration file (.env) not found",
|
|
93
|
+
"fix": "create_env"
|
|
94
|
+
})
|
|
95
|
+
return False
|
|
96
|
+
|
|
97
|
+
console.print(f"[green]✓ .env file exists: {env_file}[/green]")
|
|
98
|
+
|
|
99
|
+
# 检查关键配置 | Check critical configs
|
|
100
|
+
try:
|
|
101
|
+
from dotenv import load_dotenv
|
|
102
|
+
load_dotenv(env_file)
|
|
103
|
+
|
|
104
|
+
api_key = os.getenv("YANZHITI_API_KEY")
|
|
105
|
+
if not api_key:
|
|
106
|
+
console.print("[red]✗ YANZHITI_API_KEY not set[/red]")
|
|
107
|
+
self.issues.append({
|
|
108
|
+
"type": "missing_api_key",
|
|
109
|
+
"severity": "error",
|
|
110
|
+
"message": "API key not configured",
|
|
111
|
+
"fix": "configure_api_key"
|
|
112
|
+
})
|
|
113
|
+
return False
|
|
114
|
+
|
|
115
|
+
console.print(f"[green]✓ API key configured (****{api_key[-4:] if len(api_key) > 4 else '****'})[/green]")
|
|
116
|
+
|
|
117
|
+
base_url = os.getenv("YANZHITI_BASE_URL")
|
|
118
|
+
if base_url:
|
|
119
|
+
console.print(f"[green]✓ Base URL: {base_url}[/green]")
|
|
120
|
+
|
|
121
|
+
model = os.getenv("YANZHITI_MODEL")
|
|
122
|
+
if model:
|
|
123
|
+
console.print(f"[green]✓ Model: {model}[/green]")
|
|
124
|
+
|
|
125
|
+
return True
|
|
126
|
+
|
|
127
|
+
except Exception as e:
|
|
128
|
+
console.print(f"[red]✗ Error reading .env: {e}[/red]")
|
|
129
|
+
self.issues.append({
|
|
130
|
+
"type": "env_read_error",
|
|
131
|
+
"severity": "error",
|
|
132
|
+
"message": f"Failed to read .env file: {e}",
|
|
133
|
+
"fix": "fix_env_file"
|
|
134
|
+
})
|
|
135
|
+
return False
|
|
136
|
+
|
|
137
|
+
def check_api_connection(self) -> bool:
|
|
138
|
+
"""检查 API 连接 | Check API connection"""
|
|
139
|
+
console.print("\n[cyan]检查 API 连接 | Checking API connection...[/cyan]")
|
|
140
|
+
|
|
141
|
+
try:
|
|
142
|
+
import httpx
|
|
143
|
+
from dotenv import load_dotenv
|
|
144
|
+
load_dotenv()
|
|
145
|
+
|
|
146
|
+
api_key = os.getenv("YANZHITI_API_KEY")
|
|
147
|
+
base_url = os.getenv("YANZHITI_BASE_URL", "https://openrouter.ai/api/v1")
|
|
148
|
+
|
|
149
|
+
if not api_key:
|
|
150
|
+
console.print("[yellow]⚠ 跳过测试 (API key 未配置) | Skip test (no API key)[/yellow]")
|
|
151
|
+
return True
|
|
152
|
+
|
|
153
|
+
import asyncio
|
|
154
|
+
|
|
155
|
+
async def test():
|
|
156
|
+
async with httpx.AsyncClient(timeout=10.0) as client:
|
|
157
|
+
headers = {"Authorization": f"Bearer {api_key}"}
|
|
158
|
+
response = await client.get(f"{base_url}/models", headers=headers)
|
|
159
|
+
return response.status_code in [200, 401, 403]
|
|
160
|
+
|
|
161
|
+
loop = asyncio.new_event_loop()
|
|
162
|
+
asyncio.set_event_loop(loop)
|
|
163
|
+
success = loop.run_until_complete(test())
|
|
164
|
+
|
|
165
|
+
if success:
|
|
166
|
+
console.print("[green]✓ API connection successful[/green]")
|
|
167
|
+
return True
|
|
168
|
+
else:
|
|
169
|
+
console.print("[red]✗ API connection failed[/red]")
|
|
170
|
+
self.issues.append({
|
|
171
|
+
"type": "api_connection_error",
|
|
172
|
+
"severity": "warning",
|
|
173
|
+
"message": "Failed to connect to API",
|
|
174
|
+
"fix": "check_api_credentials"
|
|
175
|
+
})
|
|
176
|
+
return False
|
|
177
|
+
|
|
178
|
+
except Exception as e:
|
|
179
|
+
console.print(f"[red]✗ Connection error: {e}[/red]")
|
|
180
|
+
self.issues.append({
|
|
181
|
+
"type": "api_connection_error",
|
|
182
|
+
"severity": "error",
|
|
183
|
+
"message": f"API connection error: {e}",
|
|
184
|
+
"fix": "check_network"
|
|
185
|
+
})
|
|
186
|
+
return False
|
|
187
|
+
|
|
188
|
+
def check_permissions(self) -> bool:
|
|
189
|
+
"""检查文件权限 | Check file permissions"""
|
|
190
|
+
console.print("\n[cyan]检查文件权限 | Checking file permissions...[/cyan]")
|
|
191
|
+
|
|
192
|
+
# 检查当前目录是否可写 | Check if current directory is writable
|
|
193
|
+
test_file = Path.cwd() / ".yanzhiti_test"
|
|
194
|
+
try:
|
|
195
|
+
test_file.touch()
|
|
196
|
+
test_file.unlink()
|
|
197
|
+
console.print("[green]✓ Write permissions OK[/green]")
|
|
198
|
+
return True
|
|
199
|
+
except Exception as e:
|
|
200
|
+
console.print(f"[red]✗ Permission error: {e}[/red]")
|
|
201
|
+
self.issues.append({
|
|
202
|
+
"type": "permission_error",
|
|
203
|
+
"severity": "warning",
|
|
204
|
+
"message": f"Permission error: {e}",
|
|
205
|
+
"fix": "fix_permissions"
|
|
206
|
+
})
|
|
207
|
+
return False
|
|
208
|
+
|
|
209
|
+
def check_system_info(self) -> dict:
|
|
210
|
+
"""检查系统信息 | Check system information"""
|
|
211
|
+
console.print("\n[cyan]系统信息 | System Information:[/cyan]")
|
|
212
|
+
|
|
213
|
+
info = {
|
|
214
|
+
"os": platform.system(),
|
|
215
|
+
"os_version": platform.version(),
|
|
216
|
+
"python_version": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
|
|
217
|
+
"platform": platform.platform(),
|
|
218
|
+
"cwd": str(Path.cwd())
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
table = Table(show_header=False)
|
|
222
|
+
table.add_column("Key", style="cyan")
|
|
223
|
+
table.add_column("Value", style="green")
|
|
224
|
+
|
|
225
|
+
for key, value in info.items():
|
|
226
|
+
table.add_row(key.replace("_", " ").title(), value)
|
|
227
|
+
|
|
228
|
+
console.print(table)
|
|
229
|
+
return info
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def auto_fix(issue: dict) -> bool:
|
|
233
|
+
"""自动修复问题 | Auto-fix issue"""
|
|
234
|
+
fix_type = issue.get("fix")
|
|
235
|
+
|
|
236
|
+
if fix_type == "install_dependencies":
|
|
237
|
+
packages = issue.get("packages", [])
|
|
238
|
+
console.print(f"\n[cyan]正在安装缺失的依赖包 | Installing missing packages: {', '.join(packages)}[/cyan]")
|
|
239
|
+
|
|
240
|
+
try:
|
|
241
|
+
subprocess.check_call([sys.executable, "-m", "pip", "install"] + packages)
|
|
242
|
+
console.print("[green]✓ 依赖包安装成功 | Dependencies installed successfully[/green]")
|
|
243
|
+
return True
|
|
244
|
+
except subprocess.CalledProcessError as e:
|
|
245
|
+
console.print(f"[red]✗ 安装失败 | Installation failed: {e}[/red]")
|
|
246
|
+
return False
|
|
247
|
+
|
|
248
|
+
elif fix_type == "create_env":
|
|
249
|
+
console.print("\n[cyan]创建 .env 文件 | Creating .env file...[/cyan]")
|
|
250
|
+
|
|
251
|
+
env_content = """# YANZHITI Configuration
|
|
252
|
+
# Copy this file to .env and fill in your values
|
|
253
|
+
|
|
254
|
+
YANZHITI_API_KEY=your-api-key-here
|
|
255
|
+
YANZHITI_BASE_URL=https://openrouter.ai/api/v1
|
|
256
|
+
YANZHITI_MODEL=openai/gpt-3.5-turbo
|
|
257
|
+
|
|
258
|
+
# Model Parameters
|
|
259
|
+
YANZHITI_MAX_TOKENS=4096
|
|
260
|
+
YANZHITI_TEMPERATURE=1.0
|
|
261
|
+
|
|
262
|
+
# Execution Settings
|
|
263
|
+
YANZHITI_TIMEOUT=120
|
|
264
|
+
YANZHITI_MAX_RETRIES=3
|
|
265
|
+
YANZHITI_MAX_TURNS=100
|
|
266
|
+
"""
|
|
267
|
+
|
|
268
|
+
env_file = Path.cwd() / ".env"
|
|
269
|
+
try:
|
|
270
|
+
with open(env_file, "w", encoding="utf-8") as f:
|
|
271
|
+
f.write(env_content)
|
|
272
|
+
|
|
273
|
+
console.print(f"[green]✓ .env file created: {env_file}[/green]")
|
|
274
|
+
console.print("[yellow]请编辑 .env 文件并填入您的 API 密钥 | Please edit .env file and add your API key[/yellow]")
|
|
275
|
+
return True
|
|
276
|
+
except Exception as e:
|
|
277
|
+
console.print(f"[red]✗ 创建失败 | Creation failed: {e}[/red]")
|
|
278
|
+
return False
|
|
279
|
+
|
|
280
|
+
elif fix_type == "upgrade_python":
|
|
281
|
+
console.print("\n[yellow]请升级 Python 到 3.10 或更高版本[/yellow]")
|
|
282
|
+
console.print("Please upgrade Python to 3.10 or higher")
|
|
283
|
+
console.print("\n下载地址 | Download URL: https://www.python.org/downloads/")
|
|
284
|
+
return False
|
|
285
|
+
|
|
286
|
+
else:
|
|
287
|
+
console.print(f"\n[yellow]⚠️ 无法自动修复此问题 | Cannot auto-fix: {fix_type}[/yellow]")
|
|
288
|
+
console.print(f"建议 | Suggestion: {issue.get('message')}")
|
|
289
|
+
return False
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def run_diagnosis(auto_fix_enabled: bool = False) -> tuple[bool, list[dict]]:
|
|
293
|
+
"""运行完整诊断 | Run full diagnosis"""
|
|
294
|
+
console.print(Panel.fit(
|
|
295
|
+
"[bold]衍智体 (YANZHITI) 诊断工具 | Diagnostic Tool[/bold]\n"
|
|
296
|
+
"正在检查系统配置... | Checking system configuration...",
|
|
297
|
+
style="cyan",
|
|
298
|
+
border_style="green"
|
|
299
|
+
))
|
|
300
|
+
|
|
301
|
+
checker = DiagnosticChecker()
|
|
302
|
+
|
|
303
|
+
# 显示系统信息 | Show system info
|
|
304
|
+
checker.check_system_info()
|
|
305
|
+
|
|
306
|
+
# 执行检查 | Run checks
|
|
307
|
+
checks = [
|
|
308
|
+
("Python 版本 | Python Version", checker.check_python_version),
|
|
309
|
+
("依赖包 | Dependencies", checker.check_dependencies),
|
|
310
|
+
("配置文件 | Configuration File", checker.check_env_file),
|
|
311
|
+
("API 连接 | API Connection", checker.check_api_connection),
|
|
312
|
+
("文件权限 | File Permissions", checker.check_permissions),
|
|
313
|
+
]
|
|
314
|
+
|
|
315
|
+
results = []
|
|
316
|
+
for name, check_func in checks:
|
|
317
|
+
try:
|
|
318
|
+
result = check_func()
|
|
319
|
+
results.append((name, result))
|
|
320
|
+
except Exception as e:
|
|
321
|
+
console.print(f"[red]✗ {name}: Error - {e}[/red]")
|
|
322
|
+
results.append((name, False))
|
|
323
|
+
|
|
324
|
+
# 显示摘要 | Show summary
|
|
325
|
+
console.print("\n" + "="*60)
|
|
326
|
+
console.print("[bold]诊断摘要 | Diagnostic Summary[/bold]")
|
|
327
|
+
console.print("="*60)
|
|
328
|
+
|
|
329
|
+
passed = sum(1 for _, result in results if result)
|
|
330
|
+
total = len(results)
|
|
331
|
+
|
|
332
|
+
for name, result in results:
|
|
333
|
+
status = "[green]✓ 通过 | Passed[/green]" if result else "[red]✗ 失败 | Failed[/red]"
|
|
334
|
+
console.print(f"{status} - {name}")
|
|
335
|
+
|
|
336
|
+
console.print(f"\n总计 | Total: {passed}/{total} 检查通过 | checks passed")
|
|
337
|
+
|
|
338
|
+
# 显示问题列表 | Show issues
|
|
339
|
+
if checker.issues:
|
|
340
|
+
console.print(f"\n[bold red]发现 {len(checker.issues)} 个问题 | {len(checker.issues)} issues found:[/bold red]\n")
|
|
341
|
+
|
|
342
|
+
for i, issue in enumerate(checker.issues, 1):
|
|
343
|
+
severity_icon = "🔴" if issue["severity"] == "error" else "🟡"
|
|
344
|
+
console.print(f"{i}. {severity_icon} {issue['message']}")
|
|
345
|
+
|
|
346
|
+
if auto_fix_enabled and issue.get("fix") and Confirm.ask(" 自动修复?| Auto-fix?", default=True):
|
|
347
|
+
if auto_fix(issue):
|
|
348
|
+
console.print(" [green]✓ 修复成功 | Fixed successfully[/green]\n")
|
|
349
|
+
else:
|
|
350
|
+
console.print(" [red]✗ 修复失败 | Fix failed[/red]\n")
|
|
351
|
+
else:
|
|
352
|
+
console.print("\n[bold green]✓ 未发现任何问题 | No issues found![/bold green]")
|
|
353
|
+
|
|
354
|
+
all_passed = all(result for _, result in results)
|
|
355
|
+
return all_passed, checker.issues
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
@click.command()
|
|
359
|
+
@click.option('--auto-fix', '-f', is_flag=True, help='自动修复问题 | Auto-fix issues')
|
|
360
|
+
@click.option('--verbose', '-v', is_flag=True, help='详细输出 | Verbose output')
|
|
361
|
+
def main(auto_fix: bool, verbose: bool):
|
|
362
|
+
"""
|
|
363
|
+
诊断工具 - 检查并修复常见问题
|
|
364
|
+
Diagnostic Tool - Check and fix common issues
|
|
365
|
+
"""
|
|
366
|
+
try:
|
|
367
|
+
success, issues = run_diagnosis(auto_fix_enabled=auto_fix)
|
|
368
|
+
|
|
369
|
+
if success:
|
|
370
|
+
console.print("\n[green]✓ 系统配置正常 | System configuration is OK[/green]\n")
|
|
371
|
+
sys.exit(0)
|
|
372
|
+
else:
|
|
373
|
+
if not auto_fix and issues:
|
|
374
|
+
console.print("\n[yellow]提示:使用 --auto-fix 选项自动修复问题[/yellow]")
|
|
375
|
+
console.print("[yellow]Tip: Use --auto-fix option to auto-fix issues[/yellow]\n")
|
|
376
|
+
sys.exit(1)
|
|
377
|
+
|
|
378
|
+
except KeyboardInterrupt:
|
|
379
|
+
console.print("\n\n[yellow]诊断已取消 | Diagnostic cancelled[/yellow]")
|
|
380
|
+
sys.exit(0)
|
|
381
|
+
except Exception as e:
|
|
382
|
+
console.print(f"\n[red]诊断过程出错 | Diagnostic error: {e}[/red]")
|
|
383
|
+
import traceback
|
|
384
|
+
if verbose:
|
|
385
|
+
traceback.print_exc()
|
|
386
|
+
sys.exit(1)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
if __name__ == "__main__":
|
|
390
|
+
main()
|