yingclaw 2.0.9 → 2.1.0
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.
- package/bin/cli.js +1 -1
- package/lib/desktop.js +14 -9
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ async function getBanner() {
|
|
|
30
30
|
const chalk = (await import('chalk')).default;
|
|
31
31
|
const figlet = require('figlet');
|
|
32
32
|
const boxen = (await import('boxen')).default;
|
|
33
|
-
const title = figlet.textSync('
|
|
33
|
+
const title = figlet.textSync('yingclaw', { font: 'Small', horizontalLayout: 'fitted' });
|
|
34
34
|
const subtitle = chalk.dim('Claude Code × 国产大模型 一键接入') + ' ' + chalk.cyan(`v${pkg.version}`);
|
|
35
35
|
return boxen(
|
|
36
36
|
chalk.cyan.bold(title) + '\n' + subtitle,
|
package/lib/desktop.js
CHANGED
|
@@ -22,25 +22,29 @@ function getClaudeDesktopDataDir(options = {}) {
|
|
|
22
22
|
const homeDir = options.homeDir || os.homedir();
|
|
23
23
|
|
|
24
24
|
if (platform === 'darwin') {
|
|
25
|
-
return
|
|
25
|
+
return [homeDir, 'Library', 'Application Support', 'Claude-3p'].join('/');
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
if (platform === 'win32') {
|
|
29
|
-
const appData = options.appData || process.env.APPDATA || options.localAppData ||
|
|
30
|
-
return
|
|
29
|
+
const appData = options.appData || process.env.APPDATA || options.localAppData || [homeDir, 'AppData', 'Roaming'].join('\\');
|
|
30
|
+
return appData + '\\Claude-3p';
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function getClaudeDesktopConfigPath(options = {}) {
|
|
37
|
+
const platform = options.platform || process.platform;
|
|
37
38
|
const dataDir = options.dataDir || getClaudeDesktopDataDir(options);
|
|
38
|
-
|
|
39
|
+
if (!dataDir) return null;
|
|
40
|
+
return dataDir + (platform === 'win32' ? '\\' : '/') + 'claude_desktop_config.json';
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
function getClaudeDesktopConfigLibraryDir(options = {}) {
|
|
44
|
+
const platform = options.platform || process.platform;
|
|
42
45
|
const dataDir = options.dataDir || getClaudeDesktopDataDir(options);
|
|
43
|
-
|
|
46
|
+
if (!dataDir) return null;
|
|
47
|
+
return dataDir + (platform === 'win32' ? '\\' : '/') + 'configLibrary';
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
function readJsonFile(file) {
|
|
@@ -115,6 +119,11 @@ function clearClaudeDesktopConfigLibrary(options = {}) {
|
|
|
115
119
|
|
|
116
120
|
// 写入 Claude-3p/configLibrary/ 下的 enterprise config 条目(主进程从此处读取)
|
|
117
121
|
function writeClaudeDesktopConfig(config, options = {}) {
|
|
122
|
+
const baseUrl = normalizeAnthropicBaseUrl(config.baseUrl);
|
|
123
|
+
if (!baseUrl.startsWith('https://')) {
|
|
124
|
+
throw new Error('Claude 桌面应用要求 Gateway Base URL 使用 HTTPS');
|
|
125
|
+
}
|
|
126
|
+
|
|
118
127
|
const dataDir = options.dataDir || getClaudeDesktopDataDir(options);
|
|
119
128
|
if (!dataDir) {
|
|
120
129
|
return { result: 'unsupported', file: null };
|
|
@@ -126,10 +135,6 @@ function writeClaudeDesktopConfig(config, options = {}) {
|
|
|
126
135
|
const uuid = existingMeta.appliedId || options.uuid || crypto.randomUUID();
|
|
127
136
|
|
|
128
137
|
const models = collectModels(config);
|
|
129
|
-
const baseUrl = normalizeAnthropicBaseUrl(config.baseUrl);
|
|
130
|
-
if (!baseUrl.startsWith('https://')) {
|
|
131
|
-
throw new Error('Claude 桌面应用要求 Gateway Base URL 使用 HTTPS');
|
|
132
|
-
}
|
|
133
138
|
|
|
134
139
|
const entry = {
|
|
135
140
|
inferenceProvider: 'gateway',
|