MCPcopy Create free account
hub / github.com/echoVic/blade-code / configCommand

Function configCommand

src/commands/config.ts:23–195  ·  view source on GitHub ↗
(program: Command)

Source from the content-addressed store, hash-verified

21 * 注册配置相关命令
22 */
23export function configCommand(program: Command) {
24 const configCmd = program.command('config').description('⚙️ 配置管理');
25
26 // 显示当前配置
27 configCmd
28 .command('show')
29 .alias('s')
30 .description('📋 显示当前配置')
31 .action(() => {
32 showCurrentConfig();
33 });
34
35 // 设置 provider
36 configCmd
37 .command('set-provider')
38 .alias('sp')
39 .description('🔧 设置当前 LLM 提供商')
40 .argument('[provider]', 'LLM 提供商 (qwen|volcengine)')
41 .action(async provider => {
42 if (provider) {
43 if (!isProviderSupported(provider)) {
44 UIDisplay.error(`不支持的提供商: ${provider}`);
45 UIDisplay.muted('支持的提供商: qwen, volcengine');
46 return;
47 }
48 setCurrentProvider(provider);
49 } else {
50 // 交互式选择
51 const selectedProvider = await UIInput.select(
52 '请选择 LLM 提供商:',
53 [
54 { name: '🤖 千问 (Qwen)', value: 'qwen' },
55 { name: '🔥 火山引擎 (VolcEngine)', value: 'volcengine' },
56 ],
57 { default: getCurrentProvider() }
58 );
59 setCurrentProvider(selectedProvider);
60 }
61 });
62
63 // 设置模型
64 configCmd
65 .command('set-model')
66 .alias('sm')
67 .description('🎯 设置当前模型')
68 .option('-p, --provider <provider>', '指定提供商')
69 .argument('[model]', '模型名称')
70 .action(async (model, options) => {
71 const provider = options.provider || getCurrentProvider();
72
73 if (!isProviderSupported(provider)) {
74 UIDisplay.error(`不支持的提供商: ${provider}`);
75 return;
76 }
77
78 if (model) {
79 // 验证模型是否存在
80 const providerConfig = getProviderConfig(provider);

Callers 1

index.tsFile · 0.85

Calls 15

showCurrentConfigFunction · 0.85
isProviderSupportedFunction · 0.85
setCurrentProviderFunction · 0.85
getCurrentProviderFunction · 0.85
getProviderConfigFunction · 0.85
setCurrentModelFunction · 0.85
resetUserConfigFunction · 0.85
mutedMethod · 0.80
selectMethod · 0.80
warningMethod · 0.80
confirmMethod · 0.80

Tested by

no test coverage detected