skillmkt 0.3.4 → 0.3.5

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.
@@ -85,7 +85,7 @@ export async function run(ctx) {
85
85
  // 冒烟:真实 chat 调用
86
86
  try {
87
87
  const probe = { base_url, model, api_key: keyEnv.v ? process.env[keyEnv.v.slice(4)] ?? '' : '', timeout_ms: 15000 };
88
- const reply = await chat(probe, { user: 'Reply with exactly: OK', maxTokens: 8 });
88
+ const reply = await chat(probe, { user: 'Reply with exactly: OK', maxTokens: 64 });
89
89
  ok(`llm smoke: ${reply.trim().slice(0, 40) || '(empty reply)'}`);
90
90
  } catch (e) {
91
91
  warn(`llm smoke failed: ${e.message}(配置已写入,功能将降级)`);
@@ -103,8 +103,9 @@ export async function startServer(ctx, { quiet = false, port = 0 } = {}) {
103
103
  }
104
104
  if (u.pathname === '/api/llm-smoke') { // init 冒烟
105
105
  const key = resolveKeyRef(b.api_key, ctx); // env: 引用走 hub/.env 等解析链
106
- const r = await chat({ base_url: b.base_url, model: b.model, api_key: key, timeout_ms: 15000 }, { user: 'Reply with exactly: OK', maxTokens: 8 });
107
- return res.end(JSON.stringify({ ok: true, reply: r.trim().slice(0, 80) }));
106
+ const sent = 'Reply with exactly: OK';
107
+ const r = await chat({ base_url: b.base_url, model: b.model, api_key: key, timeout_ms: 15000 }, { user: sent, maxTokens: 64 });
108
+ return res.end(JSON.stringify({ ok: true, sent, reply: r.trim().slice(0, 200) }));
108
109
  }
109
110
  if (u.pathname === '/api/models') { // 指定端点+密钥拉模型列表
110
111
  const key = resolveKeyRef(b.api_key, ctx);
package/client/lib/llm.js CHANGED
@@ -106,7 +106,8 @@ export async function chat(llm, { system = '', user, maxTokens = 64, temperature
106
106
  });
107
107
  if (!res.ok) throw new Error(`llm ${res.status}: ${(await res.text()).slice(0, 200)}`);
108
108
  const data = await res.json();
109
- return data.choices?.[0]?.message?.content ?? '';
109
+ const msg = data.choices?.[0]?.message;
110
+ return msg?.content ?? msg?.reasoning_content ?? ''; // 思考型模型可能只回 reasoning_content
110
111
  } finally { clearTimeout(t); }
111
112
  }
112
113
 
@@ -148,12 +148,13 @@ async function render() {
148
148
  <div class="row"><button id="probe">扫描本机模型服务</button><span id="probe-out" class="mut"></span></div>
149
149
  <div id="eps"></div>
150
150
  <div class="frow"><span class="lab">服务地址</span><input type="text" id="murl" placeholder="http://localhost:1234/v1" value="${esc(cfg.llm?.base_url || '')}"></div>
151
- <div class="frow" id="key-row" style="display:none"><span class="lab">访问密钥</span><input type="text" id="mkey" value="${esc(cfg.llm?.api_key || '')}"><span class="fhint" id="key-hint"></span></div>
152
- <p class="mut" style="margin:8px 0 0">本机服务一般留空。填了密钥会用本机机器码加密后存入 config.yml——文件拷到别的机器解不开,换机需重填。</p>
151
+ <div class="frow" id="key-row" style="display:none"><span class="lab">访问密钥</span><input type="text" id="mkey" value="${esc(cfg.llm?.api_key || '')}"><span class="fhint" id="key-hint"></span>
152
+ <div class="fsub">填了密钥会用本机机器码加密后存入 config.yml——文件拷到别的机器解不开,换机需重填。</div></div>
153
153
  <div class="frow" id="model-box"><span class="lab">模型名称</span>
154
154
  <div class="combo"><input type="text" id="mmodel" autocomplete="off" placeholder="可输入关键字搜索,扫描后自动列出发现的模型" value="${esc(cfg.llm?.model || '')}">
155
155
  <div class="combo-list" id="model-drop" style="display:none"></div></div>
156
- <button id="smoke">测试连接</button><span id="smoke-out" class="mut"></span></div></div>
156
+ <button id="smoke">测试连接</button>
157
+ <div id="smoke-out" class="fsub"></div></div></div>
157
158
  <div class="card"><h3>第 2 步 · skill 默认安装位置</h3>
158
159
  <p class="mut">勾选的 AI 工具会在你安装新 skill 时自动收到一份副本。已勾过的话保存即生效。</p>
159
160
  ${h.map((x) => `<label class="check"><input type="checkbox" data-h="${esc(x.id)}" ${sel.has(x.id) ? 'checked' : ''} ${x.state === 'absent' ? 'disabled' : ''}> ${esc(x.id)} ${pill(x.state)} <span class="mut">${esc(x.primaryDir || '')}</span></label>`).join('')}</div>
@@ -265,9 +266,12 @@ async function render() {
265
266
  renderDrop(); app.querySelector('#model-drop').style.display = 'block';
266
267
  });
267
268
  app.querySelector('#smoke').onclick = async () => {
268
- app.querySelector('#smoke-out').textContent = '测试中…';
269
+ const out = app.querySelector('#smoke-out');
270
+ out.textContent = '测试中…';
269
271
  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 }) });
270
- app.querySelector('#smoke-out').textContent = r.ok ? `连接成功,模型回复:${r.reply}` : `连接失败:${r.error}`;
272
+ out.innerHTML = r.ok
273
+ ? `连接成功<br>发送:${esc(r.sent)}<br>回复:${esc(r.reply || '(空回复)')}`
274
+ : `连接失败:${esc(r.error)}`;
271
275
  };
272
276
  app.querySelector('#save').onclick = async () => {
273
277
  const targets = [...app.querySelectorAll('[data-h]:checked')].map((x) => x.dataset.h);
@@ -87,6 +87,7 @@ datalist { display: none; }
87
87
  .frow input[type=text], .frow input:not([type]), .frow .combo { flex: 1; min-width: 0; }
88
88
  .frow button { flex: none; }
89
89
  .fhint { flex: none; font-size: 14px; color: var(--color-accent); font-weight: 600; }
90
+ .fsub { flex-basis: 100%; margin: 2px 0 0 88px; font-size: 13.5px; color: var(--color-ink-mut); line-height: 1.55; }
90
91
  label.check { display: flex; gap: 10px; align-items: center; padding: 7px 4px; cursor: pointer; border-radius: 6px; }
91
92
  label.check:hover { background: color-mix(in oklch, var(--color-ink) 4%, var(--color-surface)); }
92
93
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillmkt",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "description": "Local-first agent skill manager: install, audit, merge, distribute.",
6
6
  "license": "MIT",