u1s1-cli 1.13.1 → 1.13.2
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/dist/config.js +6 -2
- package/dist/index.js +5 -0
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -25,9 +25,13 @@ export function isPortableInstall() {
|
|
|
25
25
|
/** 默认连中国站;国际站由安装脚本写入 baseUrl 或 `u1s1 login --site global` 切换。 */
|
|
26
26
|
export const DEFAULT_BASE_URL = SITES.cn.apiBase;
|
|
27
27
|
export const PROVIDER_ID = "u1s1";
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Make a short alias from a model id by stripping common prefixes:厂商前缀
|
|
30
|
+
* `anthropic.claude-…`(前缀只含字母数字、点后接字母)和 `vendor/model`。
|
|
31
|
+
* 版本号里的点不算前缀:claude-fable-5.1 以前被截成「1」。
|
|
32
|
+
*/
|
|
29
33
|
function defaultAliases(id) {
|
|
30
|
-
const short = id.replace(/^[
|
|
34
|
+
const short = id.replace(/^[a-z0-9]+\.(?=[a-z])/i, "").replace(/^[^/]+\//, "");
|
|
31
35
|
const parts = short.split(/[-_.:]/);
|
|
32
36
|
const aliases = [short, ...parts.filter((p) => p.length > 1)];
|
|
33
37
|
return [...new Set(aliases)];
|
package/dist/index.js
CHANGED
|
@@ -544,6 +544,11 @@ async function runAgent(cfg, args) {
|
|
|
544
544
|
];
|
|
545
545
|
const hasModelArg = args.some((a) => a === "--model" || a.startsWith("--model=") || a === "--provider");
|
|
546
546
|
const pref = resolvePreferredModel(cfg);
|
|
547
|
+
// 拿到了目录但本站一个模型都没上(国际站上线初期就是这样):别让 pi 报「Model not found」
|
|
548
|
+
if (!hasModelArg && modelsResp && MODELS.length === 0 && pref.provider === PROVIDER_ID) {
|
|
549
|
+
console.error(tr(` ${siteOf(cfg).origin} 暂时还没有可用的模型,请稍后再试。`, ` No models are available on ${siteOf(cfg).origin} yet. Please try again later.`));
|
|
550
|
+
process.exit(1);
|
|
551
|
+
}
|
|
547
552
|
if (cfg.model !== pref.id || (cfg.modelProvider ?? PROVIDER_ID) !== pref.provider) {
|
|
548
553
|
persistPreferredModel(cfg, pref.provider, pref.id);
|
|
549
554
|
}
|