@crazyhappyone/dsh-tui 0.1.0-alpha.37 → 0.1.0-alpha.39
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/index.js +14 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -58695,7 +58695,7 @@ var import_react40 = __toESM(require_react(), 1);
|
|
|
58695
58695
|
// packages/tui/tui-render/src/content.ts
|
|
58696
58696
|
var GRAPHEME = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
58697
58697
|
function escapeContent(text4) {
|
|
58698
|
-
return text4.replace(
|
|
58698
|
+
return text4.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(
|
|
58699
58699
|
/[\u0000-\u0008\u000B-\u001F\u007F]/g,
|
|
58700
58700
|
(char) => `\\x${char.charCodeAt(0).toString(16).padStart(2, "0")}`
|
|
58701
58701
|
).replace(/\u001B/g, "\\x1b");
|
|
@@ -81498,7 +81498,7 @@ function profileModelEntryFor(entry) {
|
|
|
81498
81498
|
function customProviderProfileFrom(head, models) {
|
|
81499
81499
|
return {
|
|
81500
81500
|
api: head.api,
|
|
81501
|
-
baseURL: head.baseURL,
|
|
81501
|
+
baseURL: head.baseURL.replace(/\/+$/, ""),
|
|
81502
81502
|
apiKeyEnv: head.apiKeyEnv ?? credentialEnvName(head.name),
|
|
81503
81503
|
displayName: head.displayName ?? head.name,
|
|
81504
81504
|
models: models.map(profileModelEntryFor)
|
|
@@ -81694,7 +81694,7 @@ function parseSettingsFieldValue(namespace, field, current, draft, knownProvider
|
|
|
81694
81694
|
if (field === "baseURL" || field.endsWith(".baseURL")) {
|
|
81695
81695
|
const trimmed = draft.trim();
|
|
81696
81696
|
if (trimmed === "") throw new TypeError("baseURL \u63A5\u53E3\u5730\u5740\u4E3A\u5FC5\u586B\u9879\uFF0C\u4E0D\u53EF\u4E3A\u7A7A");
|
|
81697
|
-
return trimmed;
|
|
81697
|
+
return trimmed.replace(/\/+$/, "");
|
|
81698
81698
|
}
|
|
81699
81699
|
if (field === "apiKeyEnv" || field === "secretEnv" || field.endsWith("Env") || field.endsWith("Ref")) {
|
|
81700
81700
|
const trimmed = draft.trim();
|
|
@@ -85735,7 +85735,17 @@ var RuntimeController = class _RuntimeController {
|
|
|
85735
85735
|
* @returns a user-visible failure reason.
|
|
85736
85736
|
*/
|
|
85737
85737
|
friendlyDiscoveryError(error51, apiKey) {
|
|
85738
|
-
|
|
85738
|
+
let reason = errorReason(error51);
|
|
85739
|
+
if (typeof error51 === "object" && error51 !== null && "cause" in error51) {
|
|
85740
|
+
const cause = error51.cause;
|
|
85741
|
+
const causeMsg = errorReason(cause);
|
|
85742
|
+
if (causeMsg && !reason.includes(causeMsg)) {
|
|
85743
|
+
reason = `${reason} (${causeMsg})`;
|
|
85744
|
+
}
|
|
85745
|
+
}
|
|
85746
|
+
if (reason.includes("could not reach") || reason.includes("fetch failed")) {
|
|
85747
|
+
return `${reason} \xB7 \u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u4EE3\u7406\uFF0C\u6216\u76F4\u63A5\u8F93\u5165 "\u540D\u79F0 \u7AEF\u70B9 \u6A21\u578B1,\u6A21\u578B2" \u624B\u52A8\u6307\u5B9A\u6A21\u578B`;
|
|
85748
|
+
}
|
|
85739
85749
|
if (apiKey === void 0 && (reason.includes("401") || reason.includes("403"))) {
|
|
85740
85750
|
return `${reason} \xB7 \u8BF7\u5148\u4F7F\u7528 /key \u914D\u7F6E API key`;
|
|
85741
85751
|
}
|