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

Function getUserConfig

src/config/user-config.ts:37–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 * 读取用户配置
36 */
37export function getUserConfig(): UserConfig {
38 try {
39 if (!existsSync(CONFIG_FILE_PATH)) {
40 return DEFAULT_USER_CONFIG;
41 }
42
43 const configContent = readFileSync(CONFIG_FILE_PATH, 'utf-8');
44 const config = JSON.parse(configContent) as UserConfig;
45
46 // 确保配置完整
47 return {
48 ...DEFAULT_USER_CONFIG,
49 ...config,
50 };
51 } catch (error) {
52 console.warn(chalk.yellow('⚠️ 读取用户配置失败,使用默认配置'));
53 return DEFAULT_USER_CONFIG;
54 }
55}
56
57/**
58 * 保存用户配置

Callers 4

saveUserConfigFunction · 0.85
getCurrentProviderFunction · 0.85
getCurrentModelFunction · 0.85
showCurrentConfigFunction · 0.85

Calls 1

warnMethod · 0.45

Tested by

no test coverage detected