skillmkt 0.2.3 → 0.2.4
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/public/app.js +11 -6
- package/package.json +1 -1
package/client/public/app.js
CHANGED
|
@@ -159,12 +159,10 @@ async function render() {
|
|
|
159
159
|
<div class="card"><h3>第 3 步 · 保存</h3>
|
|
160
160
|
<div class="row"><button class="primary" id="save">保存设置</button><span id="save-out" class="mut"></span></div></div>`;
|
|
161
161
|
const modelMap = new Map(); // 扫描后填充:model → base_url(选中模型自动回填地址)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
app.querySelector('#probe').onclick = async () => {
|
|
167
|
-
app.querySelector('#probe-out').textContent = '扫描中…';
|
|
162
|
+
let lastScan = 0;
|
|
163
|
+
const doScan = async (quiet = false) => {
|
|
164
|
+
lastScan = Date.now();
|
|
165
|
+
if (!quiet) app.querySelector('#probe-out').textContent = '扫描中…';
|
|
168
166
|
const eps = await api('/probe');
|
|
169
167
|
modelMap.clear();
|
|
170
168
|
for (const e of eps) for (const m of e.models) if (!modelMap.has(m)) modelMap.set(m, e.base_url);
|
|
@@ -180,6 +178,13 @@ async function render() {
|
|
|
180
178
|
app.querySelector('#murl').value = d.dataset.b;
|
|
181
179
|
});
|
|
182
180
|
};
|
|
181
|
+
app.querySelector('#probe').onclick = () => doScan();
|
|
182
|
+
app.querySelector('#mmodel').addEventListener('input', (e) => {
|
|
183
|
+
const b = modelMap.get(e.target.value);
|
|
184
|
+
if (b) app.querySelector('#murl').value = b;
|
|
185
|
+
});
|
|
186
|
+
// 点进模型框时自动重扫——下载了新模型不用先点「扫描」
|
|
187
|
+
app.querySelector('#mmodel').addEventListener('focus', () => { if (Date.now() - lastScan > 10e3) doScan(true); });
|
|
183
188
|
app.querySelector('#smoke').onclick = async () => {
|
|
184
189
|
app.querySelector('#smoke-out').textContent = '测试中…';
|
|
185
190
|
const r = await api('/llm-smoke', { method: 'POST', body: JSON.stringify({ base_url: app.querySelector('#murl').value, model: app.querySelector('#mmodel').value, api_key: app.querySelector('#mkey').value }) });
|