yymaxapi 1.0.120 → 1.0.121
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/yymaxapi.js +51 -7
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -337,6 +337,12 @@ function resolveHermesModelType(modelId, preferredType = '') {
|
|
|
337
337
|
return requestedType || 'claude';
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
+
function getKnownModelName(modelId) {
|
|
341
|
+
const normalized = String(modelId || '').trim();
|
|
342
|
+
const model = [...CLAUDE_MODELS, ...CODEX_MODELS].find(item => item.id === normalized);
|
|
343
|
+
return model?.name || normalized || '未选择模型';
|
|
344
|
+
}
|
|
345
|
+
|
|
340
346
|
async function promptHermesModelSelection(args = {}, message = '选择 Hermes 默认模型:') {
|
|
341
347
|
const requestedModel = (args['model-id'] || args.model || '').toString().trim();
|
|
342
348
|
const requestedType = normalizeHermesModelType(
|
|
@@ -5957,10 +5963,11 @@ async function activateHermes(paths, args = {}) {
|
|
|
5957
5963
|
async function main() {
|
|
5958
5964
|
console.clear();
|
|
5959
5965
|
|
|
5960
|
-
console.log(chalk.cyan.bold('\n🔧
|
|
5966
|
+
console.log(chalk.cyan.bold('\n🔧 yymaxapi 配置工具\n'));
|
|
5961
5967
|
|
|
5962
5968
|
const paths = getConfigPath();
|
|
5963
|
-
console.log(chalk.gray(
|
|
5969
|
+
console.log(chalk.gray(`OpenClaw 配置: ${paths.openclawConfig}`));
|
|
5970
|
+
console.log(chalk.gray(`Hermes 配置: ${getHermesConfigPath()}\n`));
|
|
5964
5971
|
|
|
5965
5972
|
// 首次运行备份
|
|
5966
5973
|
if (backupOriginalConfig(paths.openclawConfig, paths.configDir)) {
|
|
@@ -5999,10 +6006,15 @@ async function main() {
|
|
|
5999
6006
|
|
|
6000
6007
|
while (true) {
|
|
6001
6008
|
// 显示当前状态
|
|
6002
|
-
const
|
|
6003
|
-
|
|
6009
|
+
const statusLines = [
|
|
6010
|
+
getConfigStatusLine(paths),
|
|
6011
|
+
getHermesStatusLine()
|
|
6012
|
+
].filter(Boolean);
|
|
6013
|
+
if (statusLines.length > 0) {
|
|
6004
6014
|
console.log(chalk.gray('─'.repeat(40)));
|
|
6005
|
-
|
|
6015
|
+
for (const statusLine of statusLines) {
|
|
6016
|
+
console.log(statusLine);
|
|
6017
|
+
}
|
|
6006
6018
|
console.log(chalk.gray('─'.repeat(40)) + '\n');
|
|
6007
6019
|
}
|
|
6008
6020
|
|
|
@@ -6125,7 +6137,7 @@ function getConfigStatusLine(paths) {
|
|
|
6125
6137
|
}
|
|
6126
6138
|
|
|
6127
6139
|
if (parts.length === 0 && otherCount === 0) {
|
|
6128
|
-
return chalk.gray('
|
|
6140
|
+
return chalk.gray('OpenClaw: 未配置任何模型');
|
|
6129
6141
|
}
|
|
6130
6142
|
|
|
6131
6143
|
const primaryModelId = primary.split('/')[1] || '';
|
|
@@ -6133,7 +6145,39 @@ function getConfigStatusLine(paths) {
|
|
|
6133
6145
|
|
|
6134
6146
|
const gwEnv = detectGatewayEnv();
|
|
6135
6147
|
const envTag = gwEnv === 'wsl' ? chalk.cyan(' [WSL]') : '';
|
|
6136
|
-
return chalk.gray('
|
|
6148
|
+
return chalk.gray('OpenClaw: ') + parts.join(' ') + chalk.gray(' (✓ 主模型 ○ 已配置)') + modelTag + envTag;
|
|
6149
|
+
} catch {
|
|
6150
|
+
return null;
|
|
6151
|
+
}
|
|
6152
|
+
}
|
|
6153
|
+
|
|
6154
|
+
function getHermesStatusLine() {
|
|
6155
|
+
try {
|
|
6156
|
+
let config = readHermesCliConfig();
|
|
6157
|
+
let wslMirror = null;
|
|
6158
|
+
|
|
6159
|
+
if (process.platform === 'win32') {
|
|
6160
|
+
wslMirror = getHermesWslMirrorInfo();
|
|
6161
|
+
if (!config.configured && (wslMirror.configPath || wslMirror.envPath)) {
|
|
6162
|
+
config = readHermesWslCliConfig(wslMirror);
|
|
6163
|
+
}
|
|
6164
|
+
}
|
|
6165
|
+
|
|
6166
|
+
if (!config.configured) return null;
|
|
6167
|
+
|
|
6168
|
+
const modelName = getKnownModelName(config.modelId);
|
|
6169
|
+
const readyMark = config.apiKey ? chalk.green('✓') : chalk.yellow('○');
|
|
6170
|
+
const modelTag = config.modelId ? chalk.cyan(` [模型: ${config.modelId}]`) : '';
|
|
6171
|
+
const protocolTag = config.type === 'codex' ? chalk.cyan(' [GPT]') : chalk.cyan(' [Claude]');
|
|
6172
|
+
const hasWslTarget = !!(wslMirror?.sourceConfigPath || wslMirror?.commandPath);
|
|
6173
|
+
let envTag = '';
|
|
6174
|
+
if (hasWslTarget && wslMirror?.target?.user) {
|
|
6175
|
+
envTag = chalk.cyan(` [WSL ${wslMirror.target.user}]`);
|
|
6176
|
+
} else if (hasWslTarget) {
|
|
6177
|
+
envTag = chalk.cyan(' [WSL]');
|
|
6178
|
+
}
|
|
6179
|
+
|
|
6180
|
+
return chalk.gray('Hermes-Agent: ') + chalk.green(`${modelName} ${readyMark}`) + protocolTag + modelTag + envTag;
|
|
6137
6181
|
} catch {
|
|
6138
6182
|
return null;
|
|
6139
6183
|
}
|