skillmkt 0.3.14 → 0.3.15
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/client/commands/serve.js +1 -0
- package/client/public/app.js +4 -1
- package/package.json +1 -1
package/client/commands/serve.js
CHANGED
|
@@ -183,6 +183,7 @@ export async function startServer(ctx, { quiet = false, port = 0 } = {}) {
|
|
|
183
183
|
}
|
|
184
184
|
if (!fs.existsSync(file) || fs.statSync(file).isDirectory()) { res.writeHead(404); return res.end('nf'); }
|
|
185
185
|
res.setHeader('content-type', MIME[path.extname(file)] || 'application/octet-stream');
|
|
186
|
+
res.setHeader('cache-control', 'no-store'); // 每次请求都读磁盘——迭代期不让浏览器拿缓存旧 app.js
|
|
186
187
|
fs.createReadStream(file).pipe(res);
|
|
187
188
|
});
|
|
188
189
|
|
package/client/public/app.js
CHANGED
|
@@ -176,6 +176,7 @@ async function render() {
|
|
|
176
176
|
const cur = app.querySelector('#murl').value.trim().replace(/\/+$/, '');
|
|
177
177
|
const known = epsList.some((e) => sameBase(e.base_url, cur));
|
|
178
178
|
curOpts = [...modelMap.keys()].filter((m) => !known || sameBase(modelMap.get(m), cur));
|
|
179
|
+
renderDrop(); // 数组变了 DOM 也要重建——verifyKey 等只调 refreshOpts 的路径才不会漏渲染
|
|
179
180
|
return curOpts.length;
|
|
180
181
|
};
|
|
181
182
|
// 自绘搜索下拉(Safari 不支持 <datalist>,会把 option 当文本渲染盖住布局)
|
|
@@ -248,7 +249,9 @@ async function render() {
|
|
|
248
249
|
if (!key) return;
|
|
249
250
|
const out = app.querySelector('#smoke-out');
|
|
250
251
|
out.textContent = '验证密钥…';
|
|
251
|
-
|
|
252
|
+
let r;
|
|
253
|
+
try { r = await api('/models', { method: 'POST', body: JSON.stringify({ base_url: cur, api_key: key }) }); }
|
|
254
|
+
catch (e) { out.textContent = `请求失败:${e.message}`; return; }
|
|
252
255
|
if (r.models?.length) {
|
|
253
256
|
keyOk = true; keyFailed = false;
|
|
254
257
|
for (const m of r.models) { modelMap.set(m, cur); loadedModels.set(m, cur); }
|