MCPcopy
hub / github.com/kvcache-ai/ktransformers / _show_first_run_setup

Function _show_first_run_setup

kt-kernel/python/cli/main.py:103–356  ·  view source on GitHub ↗

Show first-run setup wizard.

(settings)

Source from the content-addressed store, hash-verified

101
102
103def _show_first_run_setup(settings) -> None:
104 """Show first-run setup wizard."""
105 from rich.console import Console
106 from rich.panel import Panel
107 from rich.prompt import Prompt, Confirm
108 from rich.spinner import Spinner
109 from rich.live import Live
110
111 from kt_kernel.cli.utils.environment import scan_storage_locations, format_size_gb
112
113 console = Console()
114
115 # Welcome message
116 console.print()
117 console.print(
118 Panel.fit(
119 "[bold cyan]Welcome to KTransformers CLI! / 欢迎使用 KTransformers CLI![/bold cyan]\n\n"
120 "Let's set up your preferences.\n"
121 "让我们设置您的偏好。",
122 title="kt-cli",
123 border_style="cyan",
124 )
125 )
126 console.print()
127
128 # Language selection
129 console.print("[bold]Select your preferred language / 选择您的首选语言:[/bold]")
130 console.print()
131 console.print(" [cyan][1][/cyan] English")
132 console.print(" [cyan][2][/cyan] 中文 (Chinese)")
133 console.print()
134
135 choice = Prompt.ask("Enter choice / 输入选择", choices=["1", "2"], default="1")
136 lang = "en" if choice == "1" else "zh"
137
138 # Save language setting
139 settings.set("general.language", lang)
140 set_lang(lang)
141
142 # Confirmation message
143 console.print()
144 if lang == "zh":
145 console.print("[green]✓[/green] 语言已设置为中文")
146 else:
147 console.print("[green]✓[/green] Language set to English")
148
149 # Model discovery section
150 console.print()
151 if lang == "zh":
152 console.print("[bold]发现模型权重[/bold]")
153 console.print()
154 console.print("[dim]扫描系统中已有的模型权重文件,以便快速添加到模型列表。[/dim]")
155 console.print()
156 console.print(" [cyan][1][/cyan] 全局扫描 (自动扫描所有非系统路径)")
157 console.print(" [cyan][2][/cyan] 手动指定路径 (可添加多个)")
158 console.print(" [cyan][3][/cyan] 跳过 (稍后手动添加)")
159 console.print()
160 scan_choice = Prompt.ask("选择扫描方式", choices=["1", "2", "3"], default="1")

Callers 2

initFunction · 0.90
check_first_runFunction · 0.85

Calls 11

set_langFunction · 0.90
format_discovery_summaryFunction · 0.90
tFunction · 0.90
scan_storage_locationsFunction · 0.90
format_size_gbFunction · 0.90
detect_disk_space_gbFunction · 0.90
_prompt_custom_pathFunction · 0.85
printMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected