u1s1-cli 0.7.1 → 0.7.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/index.js +16 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -74,6 +74,22 @@ async function runAgent(cfg, args) {
|
|
|
74
74
|
// Shift+Enter,输入框就会换行,真·Alt+Enter(\x1b[13;3u)不受影响。
|
|
75
75
|
class ShiftEnterEditor extends CustomEditor {
|
|
76
76
|
handleInput(data) {
|
|
77
|
+
// 拦截 /login 和 /logout,不让 pi 弹出内置供应商列表
|
|
78
|
+
if (data === "\r" || data === "\n") {
|
|
79
|
+
const text = this.getText().trim();
|
|
80
|
+
if (text.startsWith("/login")) {
|
|
81
|
+
console.log(" u1s1 不需要额外登录,直接用 /model 切换模型即可");
|
|
82
|
+
this.setText("");
|
|
83
|
+
this.addToHistory?.(text);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (text === "/logout") {
|
|
87
|
+
console.log(" u1s1 统一使用同一个 API Key,不需要单独登出");
|
|
88
|
+
this.setText("");
|
|
89
|
+
this.addToHistory?.(text);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
77
93
|
super.handleInput(data === "\x1b\r" ? "\x1b[13;2u" : data);
|
|
78
94
|
}
|
|
79
95
|
}
|
|
@@ -114,19 +130,6 @@ async function runAgent(cfg, args) {
|
|
|
114
130
|
return;
|
|
115
131
|
persistPreferredModel(loadConfig(), event.model.id);
|
|
116
132
|
});
|
|
117
|
-
// 拦截 /login 和 /logout,不让 pi 弹出内置供应商列表
|
|
118
|
-
pi.on("input", (event, ctx) => {
|
|
119
|
-
const text = event.text.trim();
|
|
120
|
-
if (text.startsWith("/login")) {
|
|
121
|
-
ctx.ui.notify("u1s1 不需要额外登录,直接用 /model 切换模型即可", "info");
|
|
122
|
-
return { action: "handled" };
|
|
123
|
-
}
|
|
124
|
-
if (text.startsWith("/logout")) {
|
|
125
|
-
ctx.ui.notify("u1s1 统一使用同一个 API Key,不需要单独登出", "info");
|
|
126
|
-
return { action: "handled" };
|
|
127
|
-
}
|
|
128
|
-
return { action: "continue" };
|
|
129
|
-
});
|
|
130
133
|
pi.on("session_start", (_event, ctx) => {
|
|
131
134
|
const previous = ctx.ui.getEditorComponent();
|
|
132
135
|
ctx.ui.setEditorComponent((tui, theme, keybindings) => {
|