dsh-model-doctor 0.5.0 → 0.5.1

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.
@@ -746,6 +746,8 @@ window.__ModuleLoader__.load({
746
746
 
747
747
  let reportSignature = ''
748
748
  let reportAt = 0
749
+ /** 最近一次写入的报告是否包含「菜单已打开」的现场。 */
750
+ let lastReportHadMenu = false
749
751
 
750
752
  function describe(el) {
751
753
  if (el === null || el === undefined) return null
@@ -754,16 +756,19 @@ window.__ModuleLoader__.load({
754
756
  return { tag: el.tagName, role: el.getAttribute('role') ?? '', cls, text }
755
757
  }
756
758
 
757
- function reportDiagnostics(state, force = false) {
759
+ function reportDiagnostics(state, menuVisible = false) {
758
760
  if (doctor === null) return
759
761
  const { at, ...rest } = state
760
762
  const signature = JSON.stringify(rest)
761
763
  const now = Date.now()
762
- // 状态没变时:菜单开着也最多 5 秒写一次,避免刷屏
763
- if (signature === reportSignature && now - reportAt < (force ? 5000 : 1200)) return
764
+ const isError = typeof state.error === 'string'
765
+ // 报告里已经留下「菜单打开」的现场时,不要被随后「菜单关闭」的空扫描覆盖(错误除外)
766
+ if (!menuVisible && !isError && lastReportHadMenu) return
767
+ if (!isError && signature === reportSignature && now - reportAt < (menuVisible ? 5000 : 1200)) return
764
768
  if (now - reportAt < 400) return
765
769
  reportSignature = signature
766
770
  reportAt = now
771
+ lastReportHadMenu = menuVisible
767
772
  void doctor.clientReport(state)
768
773
  }
769
774
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-model-doctor",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "模型医生:在对话输入区的模型选择菜单里,为每个模型选项追加「连通检测」与「删除」按钮——直接适配 DSH 官方模型菜单(按官方 DOM 契约精确定位,不依赖任何菜单渲染插件),检测直连各网关探测连通性/欠费/额度,删除直接从 llm-pi-ai 配置移除模型(自动备份配置文档)。",
5
5
  "keywords": [
6
6
  "deepseek",