dsh-pick 0.6.1 → 0.7.0
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/README.md +14 -2
- package/data/catalog.json +1 -1
- package/lib/ai-pick.js +172 -0
- package/lib/engine.js +3 -0
- package/lib/overall.js +84 -23
- package/package.json +1 -1
- package/plugin/index.js +30 -0
- package/plugin/tools.js +17 -3
- package/web/panel.html +71 -3
- package/web/panel.js +207 -29
package/lib/ai-pick.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// lib/ai-pick.js — 面板里的「AI 精选」:用 DSH 当前的大模型(和对话里同一个)挑插件
|
|
2
|
+
//
|
|
3
|
+
// 关键字搜索只会字面匹配,不懂需求;对话里的大模型会读懂意思、看简介再判断,所以推荐得更准。
|
|
4
|
+
// 这里把同样的能力搬进面板,分两步:
|
|
5
|
+
// 1. 查全:让模型把需求展开成一组关键字(中英文、同义说法),每个关键字在全目录里召回候选,合并成 ≤40 个
|
|
6
|
+
// 2. 挑准:把候选的简介和数据交给模型,让它按「是不是真能解决这个需求」挑出 ≤8 个,每个写一句理由
|
|
7
|
+
// 模型给的包名逐个核对:不在候选里的丢掉(防止编造);数字只用我们给的,不让模型自己推算。
|
|
8
|
+
// 点了按钮才调用(花用户的 token),打开面板不花。
|
|
9
|
+
//
|
|
10
|
+
// 调模型的写法照 dsh-vps-manager:DSH 的 llm 服务 + agentDefaultModel(默认模型选择)。
|
|
11
|
+
|
|
12
|
+
import { randomUUID } from 'node:crypto'
|
|
13
|
+
import { searchByNeed } from './engine.js'
|
|
14
|
+
|
|
15
|
+
const MAX_CANDIDATES = 40
|
|
16
|
+
const MAX_PICKS = 8
|
|
17
|
+
|
|
18
|
+
/** 调一次模型,返回整段文字 */
|
|
19
|
+
export async function callModel({ llm, defaultModel, system, user, maxTokens = 1500, signal, purpose = 'dsh-pick' }) {
|
|
20
|
+
if (!llm || typeof llm.stream !== 'function' || !defaultModel || typeof defaultModel.currentSelection !== 'function') {
|
|
21
|
+
throw Object.assign(new Error('这个版本的 DSH 不让插件直接调用模型'), { code: 'no_llm' })
|
|
22
|
+
}
|
|
23
|
+
const route = defaultModel.currentSelection()
|
|
24
|
+
const timeout = AbortSignal.timeout(120000)
|
|
25
|
+
let text = ''
|
|
26
|
+
let finish = { kind: 'stop' }
|
|
27
|
+
for await (const chunk of llm.stream({
|
|
28
|
+
provider: route.provider,
|
|
29
|
+
model: route.model,
|
|
30
|
+
system,
|
|
31
|
+
messages: [{ role: 'user', id: randomUUID(), content: [{ type: 'text', text: user }], source: { kind: 'plugin:dsh-pick' } }],
|
|
32
|
+
maxTokens,
|
|
33
|
+
purpose,
|
|
34
|
+
signal: signal ? AbortSignal.any([signal, timeout]) : timeout,
|
|
35
|
+
})) {
|
|
36
|
+
if (chunk.type === 'text-delta') text += chunk.text
|
|
37
|
+
else if (chunk.type === 'finish') finish = chunk.reason ?? finish
|
|
38
|
+
}
|
|
39
|
+
if (finish && (finish.kind === 'error' || finish.kind === 'aborted')) {
|
|
40
|
+
throw Object.assign(new Error((finish.failure && finish.failure.message) || '模型调用失败'), { code: finish.failure && finish.failure.code })
|
|
41
|
+
}
|
|
42
|
+
return { text: text.trim(), model: route.model }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 从模型的回答里取出第一个 JSON 对象(模型常在前后加说明或代码块) */
|
|
46
|
+
export function extractJson(text) {
|
|
47
|
+
const s = String(text || '')
|
|
48
|
+
const start = s.indexOf('{')
|
|
49
|
+
if (start < 0) return null
|
|
50
|
+
let depth = 0, inStr = false, esc = false
|
|
51
|
+
for (let i = start; i < s.length; i++) {
|
|
52
|
+
const c = s[i]
|
|
53
|
+
if (inStr) {
|
|
54
|
+
if (esc) esc = false
|
|
55
|
+
else if (c === '\\') esc = true
|
|
56
|
+
else if (c === '"') inStr = false
|
|
57
|
+
continue
|
|
58
|
+
}
|
|
59
|
+
if (c === '"') inStr = true
|
|
60
|
+
else if (c === '{') depth++
|
|
61
|
+
else if (c === '}' && --depth === 0) {
|
|
62
|
+
try { return JSON.parse(s.slice(start, i + 1)) } catch { return null }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return null
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const KEYWORD_SYSTEM = [
|
|
69
|
+
'你帮用户在 DeepSeek Harness(DSH)的插件目录里找插件。目录按包名、关键字、简介做字面匹配。',
|
|
70
|
+
'把用户的需求展开成 4~10 个用来搜索的关键字:中文和英文都要有,包括同义说法和插件作者常用的英文词(比如 database、sql、notify、wechat、memory、theme)。',
|
|
71
|
+
'只回答一个 JSON 对象,形如 {"keywords":["...","..."]},不要别的文字。',
|
|
72
|
+
].join('\n')
|
|
73
|
+
|
|
74
|
+
const PICK_SYSTEM = [
|
|
75
|
+
'你是 DeepSeek Harness(DSH)插件选型顾问,目标是给用户推荐真正好用、真能解决他需求的插件。',
|
|
76
|
+
'下面给出用户的需求和一批候选插件(简介 + 数据)。请挑出真正适合的,最多 8 个,按合适程度排序;只是沾边、功能不对、装不了的不要选。',
|
|
77
|
+
'判断依据:先看功能是否对得上需求,再看数据:日常基线(去噪后的每日使用量,比周下载可靠)、最近更新、是否被精选或官方收录、GitHub 星标。周下载含 CI 和镜像流量,不等于用户数。',
|
|
78
|
+
'只能用给出的信息,不要编造插件或数字。理由用中文,每条不超过 40 个字,说清楚为什么适合;有明显的坑(比如很久没更新、只支持某个平台)写在 caveat 里。',
|
|
79
|
+
'只回答一个 JSON 对象,形如 {"picks":[{"name":"包名","fit":0到100,"reason":"理由","caveat":"注意事项,可省略"}],"note":"一句话总结,可省略"},不要别的文字。一个都不合适时 picks 为空数组,并在 note 里说明。',
|
|
80
|
+
].join('\n')
|
|
81
|
+
|
|
82
|
+
const num = n => (n == null ? '—' : Number(n).toLocaleString('en-US'))
|
|
83
|
+
|
|
84
|
+
/** 一个候选给模型看的一行 */
|
|
85
|
+
function candidateLine(i, rec, extra) {
|
|
86
|
+
const d = rec.deep
|
|
87
|
+
const days = d && d.age != null ? `${d.age} 天前更新` : rec.t ? `最近发版 ${String(rec.t).slice(0, 10)}` : ''
|
|
88
|
+
return [
|
|
89
|
+
`${i + 1}. ${rec.n}`,
|
|
90
|
+
rec.cat ? `分类:${rec.cat}` : '',
|
|
91
|
+
`周下载 ${num(rec.w)}`,
|
|
92
|
+
d ? `日常基线 ${num(d.base)}/天` : '',
|
|
93
|
+
rec.gh && rec.gh.s != null ? `GitHub ★${num(rec.gh.s)}` : '',
|
|
94
|
+
rec.gh && rec.gh.a ? '仓库已归档' : '',
|
|
95
|
+
days,
|
|
96
|
+
rec.src && rec.src.length ? `收录于 ${rec.src.join('、')}` : '',
|
|
97
|
+
extra,
|
|
98
|
+
`简介:${String(rec.d || '').slice(0, 160)}`,
|
|
99
|
+
].filter(Boolean).join(' · ')
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 用关键字召回候选:每个关键字各取一批,按「最好的相关度」合并,再按相关度为主、使用量为辅排序
|
|
104
|
+
* @returns {object[]} 目录记录
|
|
105
|
+
*/
|
|
106
|
+
export function recall(catalog, need, keywords) {
|
|
107
|
+
const best = new Map()
|
|
108
|
+
const add = (list, weight) => {
|
|
109
|
+
for (const r of list) {
|
|
110
|
+
const score = r.relevance * weight
|
|
111
|
+
if (!best.has(r.name) || best.get(r.name) < score) best.set(r.name, score)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
add(searchByNeed(catalog, need, { limit: 20 }), 1)
|
|
115
|
+
for (const k of keywords) add(searchByNeed(catalog, k, { limit: 12 }), 0.9)
|
|
116
|
+
return [...best.entries()]
|
|
117
|
+
.map(([name, score]) => ({ rec: catalog.packages[name], score }))
|
|
118
|
+
.filter(x => x.rec)
|
|
119
|
+
.sort((a, b) => b.score + Math.log10((b.rec.w || 0) + 1) * 3 - (a.score + Math.log10((a.rec.w || 0) + 1) * 3))
|
|
120
|
+
.slice(0, MAX_CANDIDATES)
|
|
121
|
+
.map(x => x.rec)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* AI 精选
|
|
126
|
+
* @param {object} opt
|
|
127
|
+
* @param {string} opt.need 用户的需求(原话)
|
|
128
|
+
* @param {object} opt.catalog 目录(loadCatalog 的结果)
|
|
129
|
+
* @param {object} opt.llm DSH 的 llm 服务
|
|
130
|
+
* @param {object} opt.defaultModel DSH 的 agentDefaultModel 服务
|
|
131
|
+
* @param {Set<string>} [opt.installed] 已装的插件
|
|
132
|
+
* @returns {Promise<{picks: object[], note: string, keywords: string[], candidates: number, model: string}>}
|
|
133
|
+
*/
|
|
134
|
+
export async function aiPick({ need, catalog, llm, defaultModel, installed = new Set(), signal }) {
|
|
135
|
+
const q = String(need || '').trim().slice(0, 300)
|
|
136
|
+
if (!q) throw Object.assign(new Error('先写下你想解决什么问题'), { code: 'empty' })
|
|
137
|
+
|
|
138
|
+
// 1. 查全
|
|
139
|
+
const k = await callModel({ llm, defaultModel, system: KEYWORD_SYSTEM, user: q, maxTokens: 300, signal, purpose: 'dsh-pick-keywords' })
|
|
140
|
+
const parsed = extractJson(k.text)
|
|
141
|
+
const keywords = [...new Set((parsed && Array.isArray(parsed.keywords) ? parsed.keywords : [])
|
|
142
|
+
.filter(w => typeof w === 'string').map(w => w.trim().slice(0, 40)).filter(Boolean))].slice(0, 12)
|
|
143
|
+
const cands = recall(catalog, q, keywords)
|
|
144
|
+
if (!cands.length) return { picks: [], note: '目录里没找到相关的插件,换个说法试试。', keywords, candidates: 0, model: k.model }
|
|
145
|
+
|
|
146
|
+
// 2. 挑准
|
|
147
|
+
const lines = cands.map((rec, i) => candidateLine(i, rec, [
|
|
148
|
+
installed.has(rec.n) ? '已安装' : '',
|
|
149
|
+
rec.inst && rec.inst.b === false ? '没声明 dsh.bundle,DSH 装不了' : '',
|
|
150
|
+
rec.inst && rec.inst.p && rec.inst.p !== 'web' ? `${rec.inst.p} 客户端插件` : '',
|
|
151
|
+
].filter(Boolean).join(' · ')))
|
|
152
|
+
const p = await callModel({
|
|
153
|
+
llm, defaultModel, system: PICK_SYSTEM,
|
|
154
|
+
user: `用户的需求:${q}\n\n候选插件(共 ${cands.length} 个):\n${lines.join('\n')}`,
|
|
155
|
+
maxTokens: 1800, signal, purpose: 'dsh-pick-rerank',
|
|
156
|
+
})
|
|
157
|
+
const out = extractJson(p.text) || {}
|
|
158
|
+
const names = new Set(cands.map(r => r.n))
|
|
159
|
+
const seen = new Set()
|
|
160
|
+
const picks = (Array.isArray(out.picks) ? out.picks : [])
|
|
161
|
+
.filter(x => x && typeof x.name === 'string' && names.has(x.name) && !seen.has(x.name) && seen.add(x.name))
|
|
162
|
+
.slice(0, MAX_PICKS)
|
|
163
|
+
.map(x => ({
|
|
164
|
+
name: x.name,
|
|
165
|
+
fit: Math.max(0, Math.min(100, Math.round(Number(x.fit) || 0))),
|
|
166
|
+
reason: typeof x.reason === 'string' ? x.reason.trim().slice(0, 80) : '',
|
|
167
|
+
caveat: typeof x.caveat === 'string' ? x.caveat.trim().slice(0, 80) : '',
|
|
168
|
+
}))
|
|
169
|
+
const note = typeof out.note === 'string' ? out.note.trim().slice(0, 160) : ''
|
|
170
|
+
if (!picks.length && !note && !extractJson(p.text)) throw new Error('模型没按格式回答,再试一次')
|
|
171
|
+
return { picks, note, keywords, candidates: cands.length, model: p.model }
|
|
172
|
+
}
|
package/lib/engine.js
CHANGED
|
@@ -564,6 +564,9 @@ export async function loadCatalog({ env = process.env } = {}) {
|
|
|
564
564
|
// 每日目录是旧代码构建的、还没有某个榜(比如刚加的综合榜):先用随包自带的那份顶上,下次每日构建后就齐了
|
|
565
565
|
if (pick && pick.source === 'remote' && bundled && bundled.boards) {
|
|
566
566
|
pick.boards = { ...bundled.boards, ...(pick.boards || {}) }
|
|
567
|
+
// 每日目录的综合榜是旧代码算的(没有分角度的分数),自带的有:用自带的
|
|
568
|
+
const hasAngles = o => Boolean(o && o.rows && o.rows[0] && o.rows[0].a)
|
|
569
|
+
if (!hasAngles(pick.boards.overall) && hasAngles(bundled.boards.overall)) pick.boards.overall = bundled.boards.overall
|
|
567
570
|
}
|
|
568
571
|
cache = pick ? normalize(pick) : { asOf: null, anchor: null, packages: {}, total: 0, source: 'none' }
|
|
569
572
|
return cache
|
package/lib/overall.js
CHANGED
|
@@ -7,12 +7,18 @@
|
|
|
7
7
|
// official DeepSeek 官方的可选 / 按需插件
|
|
8
8
|
// npm 本身不算市场:它只是发布渠道。
|
|
9
9
|
//
|
|
10
|
-
//
|
|
11
|
-
// 使用
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
10
|
+
// 排名有六个角度(面板里切换;同一份数据,权重不同,每个角度的算法写在页面上):
|
|
11
|
+
// rec 综合推荐 使用 30 + 关注 15 + 维护 15 + 精选 15 + 稳定 15 + 覆盖 10
|
|
12
|
+
// use 最多人用 只看日常基线(去噪),没有去噪数据的不参与
|
|
13
|
+
// rep 口碑 GitHub 星标 65% + 被精选或官方收录 35%
|
|
14
|
+
// stable 稳定可靠 上架满 60 天;版本节奏平稳、有许可证、未关闭问题少、还在维护,再加一点使用量
|
|
15
|
+
// rise 上升最快 有一定使用量(日常基线 ≥ 20/天)的前提下看近 7 日增速
|
|
16
|
+
// new 新上架 最近 30 天才被市场收录的
|
|
17
|
+
// 和第一版(使用 40% 起步)相比改了三处,都是为了少奖励「刷出来的数字」:
|
|
18
|
+
// - 下载量从 40% 降到 30%:npm 下载里有 CI、镜像、自动更新的拉取,发版越勤数字越高
|
|
19
|
+
// - 维护只看「还在不在维护」(60 天内有发版或提交就满分),不再按发版频率加分,免得和下载量重复奖励频繁发版
|
|
20
|
+
// - 「共识」拆成两项:精选(dsh-m 精选、DeepSeek 官方,有人挑过)15%;覆盖(被几个市场收录,多是按关键字自动收录)10%
|
|
21
|
+
// 使用、关注两项取「百分位」和「对数比例」的平均,不让一个几十万星的仓库压倒一切。
|
|
16
22
|
// 一票否决(不进榜):仓库已归档、没声明 dsh.bundle(DSH 装不了)、终端版插件。
|
|
17
23
|
//
|
|
18
24
|
// 只在 GitHub 上、没发到 npm 的插件也收:按 gh:owner/repo 合并,没有下载数据,使用项是 0。
|
|
@@ -20,8 +26,9 @@
|
|
|
20
26
|
export const MARKETS = ['dshmarket', 'dsh-m', 'shop', 'official']
|
|
21
27
|
/** 市场 → buildBoards 交出来的名单的 key */
|
|
22
28
|
const MEMBER_KEY = { dshmarket: 'community', 'dsh-m': 'picks', shop: 'shop', official: 'official' }
|
|
23
|
-
export const WEIGHTS = { use:
|
|
24
|
-
const
|
|
29
|
+
export const WEIGHTS = { use: 30, stars: 15, maint: 15, curated: 15, stable: 15, reach: 10 }
|
|
30
|
+
export const ANGLES = ['rec', 'use', 'rep', 'stable', 'rise', 'new']
|
|
31
|
+
const KEEP_PER_ANGLE = 120 // 每个角度落盘前多少名(合并去重后一起存)
|
|
25
32
|
const DAY = 86400000
|
|
26
33
|
|
|
27
34
|
const repoKey = url => {
|
|
@@ -61,12 +68,28 @@ export function spread(logs) {
|
|
|
61
68
|
return logs.map((v, i) => (max > 0 ? (p[i] + Math.max(0, v) / max) / 2 : 0))
|
|
62
69
|
}
|
|
63
70
|
|
|
64
|
-
/** 维护分:最近一次发版或提交距今多少天 → 0~1 */
|
|
71
|
+
/** 维护分:最近一次发版或提交距今多少天 → 0~1。60 天内都算「还在维护」给满分,之后到 180 天线性降到 0 */
|
|
65
72
|
export function maintScore(dates, now = Date.now()) {
|
|
66
73
|
const ts = dates.map(d => Date.parse(d || '')).filter(Number.isFinite)
|
|
67
74
|
if (!ts.length) return null
|
|
68
75
|
const days = Math.max(0, (now - Math.max(...ts)) / DAY)
|
|
69
|
-
return Math.max(0, 1 - days /
|
|
76
|
+
return days <= 60 ? 1 : Math.max(0, 1 - (days - 60) / 120)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const clamp01 = x => Math.max(0, Math.min(1, x))
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 稳定分 0~1:上架时间、版本节奏是否平稳、有没有许可证、未关闭问题多不多
|
|
83
|
+
* @param {{firstDays: number|null, cadence: number|null, license: boolean|null, issues: number|null, stars: number|null}} f
|
|
84
|
+
*/
|
|
85
|
+
export function stableScore({ firstDays, cadence, license, issues, stars }) {
|
|
86
|
+
const age = firstDays == null ? 0.5 : clamp01(firstDays / 60)
|
|
87
|
+
// 0.5 天一个版本以下算「发得太勤」(0 分),3 天以上算平稳(满分)
|
|
88
|
+
const calm = cadence == null ? 0.5 : clamp01((cadence - 0.5) / 2.5)
|
|
89
|
+
const lic = license == null ? 0.3 : license ? 1 : 0
|
|
90
|
+
// 每 10 个星标里有几个没关的 issue/PR:越少越好
|
|
91
|
+
const iss = issues == null ? 0.5 : 1 - clamp01(issues / ((stars || 0) + 10) * 2)
|
|
92
|
+
return 0.35 * age + 0.25 * calm + 0.2 * lic + 0.2 * iss
|
|
70
93
|
}
|
|
71
94
|
|
|
72
95
|
/**
|
|
@@ -116,7 +139,8 @@ export function buildOverall({ packages, members, previousSrc = {}, now = Date.n
|
|
|
116
139
|
if (!c) continue // npm 名字不在目录里(多半是 npm 上已经没有了)
|
|
117
140
|
c.src.add(market)
|
|
118
141
|
if (c.stars == null && Number.isFinite(m.s)) c.stars = m.s
|
|
119
|
-
|
|
142
|
+
// 第一次被市场收录的日期(「新上架」「稳定可靠」要用)
|
|
143
|
+
if (m.added && (!c.added || m.added < c.added)) c.added = m.added
|
|
120
144
|
}
|
|
121
145
|
}
|
|
122
146
|
|
|
@@ -139,52 +163,89 @@ export function buildOverall({ packages, members, previousSrc = {}, now = Date.n
|
|
|
139
163
|
const useOf = c => (c.rec ? (c.rec.deep ? c.rec.deep.base : (c.rec.w || 0) / 7 * ratio) : 0)
|
|
140
164
|
const useP = spread(out.map(c => Math.log1p(useOf(c))))
|
|
141
165
|
const starP = spread(out.map(c => Math.log1p(c.stars || 0)))
|
|
166
|
+
// 「最多人用」只认真实的去噪基线
|
|
167
|
+
const deepIdx = out.map((c, i) => (c.rec && c.rec.deep ? i : -1)).filter(i => i >= 0)
|
|
168
|
+
const deepP = spread(deepIdx.map(i => Math.log1p(out[i].rec.deep.base)))
|
|
169
|
+
const deepUse = new Map(deepIdx.map((i, k) => [i, deepP[k]]))
|
|
170
|
+
// 「上升最快」:日常基线 ≥ 20/天、有增速的,按增速排百分位
|
|
171
|
+
const riseIdx = out.map((c, i) => (c.rec && c.rec.deep && c.rec.deep.base >= 20 && Number.isFinite(c.rec.deep.growth) ? i : -1)).filter(i => i >= 0)
|
|
172
|
+
const riseP = percentiles(riseIdx.map(i => out[i].rec.deep.growth + 1)) // +1:增速可能是负数,百分位只认正数
|
|
173
|
+
const riseOf = new Map(riseIdx.map((i, k) => [i, riseP[k]]))
|
|
142
174
|
|
|
175
|
+
const curatedSet = new Set(['dsh-m', 'official'])
|
|
143
176
|
out.forEach((c, i) => {
|
|
144
177
|
const rec = c.rec
|
|
145
178
|
const d = rec && rec.deep
|
|
146
|
-
const
|
|
179
|
+
const gh = rec && rec.gh
|
|
180
|
+
const firstDays = c.added ? Math.max(0, Math.floor((now - Date.parse(c.added)) / DAY)) : null
|
|
181
|
+
const maint = maintScore([d && d.lastRelease, rec && rec.t, gh && gh.p], now)
|
|
182
|
+
const stable = stableScore({ firstDays, cadence: d ? d.cadence : null, license: gh ? Boolean(gh.l) : null, issues: gh ? gh.i : null, stars: c.stars })
|
|
183
|
+
const curated = [...c.src].some(m => curatedSet.has(m)) ? 1 : 0
|
|
147
184
|
const parts = {
|
|
148
185
|
use: useP[i],
|
|
149
186
|
stars: starP[i],
|
|
150
|
-
maint:
|
|
151
|
-
|
|
152
|
-
|
|
187
|
+
maint: maint ?? 0.4, // 不知道就给个中间偏下的分
|
|
188
|
+
curated,
|
|
189
|
+
stable,
|
|
190
|
+
reach: c.src.size / MARKETS.length,
|
|
153
191
|
}
|
|
154
192
|
c.parts = parts
|
|
155
|
-
c.
|
|
156
|
-
|
|
157
|
-
|
|
193
|
+
c.firstDays = firstDays
|
|
194
|
+
const rec100 = Math.round(Object.entries(WEIGHTS).reduce((sum, [k, w]) => sum + parts[k] * w, 0))
|
|
195
|
+
c.a = {
|
|
196
|
+
rec: rec100,
|
|
197
|
+
use: deepUse.has(i) ? Math.round(deepUse.get(i) * 100) : null,
|
|
198
|
+
rep: c.stars || curated ? Math.round((0.65 * starP[i] + 0.35 * curated) * 100) : null,
|
|
199
|
+
stable: firstDays != null && firstDays >= 60 && (maint ?? 0) > 0 ? Math.round((0.7 * stable + 0.3 * useP[i]) * 100) : null,
|
|
200
|
+
rise: riseOf.has(i) ? Math.round(riseOf.get(i) * 100) : null,
|
|
201
|
+
new: firstDays != null && firstDays <= 30 ? Math.round((1 - firstDays / 30) * 60 + useP[i] * 40) : null,
|
|
202
|
+
}
|
|
203
|
+
c.score = rec100
|
|
204
|
+
if (rec && !c.outside) {
|
|
205
|
+
rec.sc = rec100
|
|
158
206
|
rec.src = [...c.src]
|
|
159
207
|
}
|
|
160
208
|
})
|
|
161
|
-
|
|
209
|
+
|
|
210
|
+
// 每个角度取前 KEEP_PER_ANGLE 名,合并去重;按综合推荐排
|
|
211
|
+
const keep = new Set()
|
|
212
|
+
for (const angle of ANGLES) {
|
|
213
|
+
out.filter(c => c.a[angle] != null)
|
|
214
|
+
.sort((x, y) => y.a[angle] - x.a[angle] || (y.rec ? y.rec.w || 0 : 0) - (x.rec ? x.rec.w || 0 : 0))
|
|
215
|
+
.slice(0, KEEP_PER_ANGLE)
|
|
216
|
+
.forEach(c => keep.add(c))
|
|
217
|
+
}
|
|
218
|
+
const rows = [...keep].sort((x, y) => y.score - x.score || (y.rec ? y.rec.w || 0 : 0) - (x.rec ? x.rec.w || 0 : 0))
|
|
162
219
|
|
|
163
220
|
const pct = v => Math.round(v * 100)
|
|
164
221
|
return {
|
|
165
222
|
total: out.length,
|
|
166
223
|
excluded,
|
|
167
224
|
weights: WEIGHTS,
|
|
225
|
+
angles: ANGLES,
|
|
168
226
|
markets: MARKETS,
|
|
169
227
|
useRatio: Math.round(ratio * 1000) / 1000,
|
|
170
|
-
rows:
|
|
228
|
+
rows: rows.map(c => {
|
|
171
229
|
const rec = c.rec
|
|
230
|
+
const d = rec && rec.deep
|
|
172
231
|
const row = {
|
|
173
232
|
k: c.n || c.key, // npm 包名,或 gh:owner/repo
|
|
174
233
|
n: c.n,
|
|
175
234
|
sc: c.score,
|
|
176
|
-
|
|
235
|
+
a: c.a, // 六个角度各自的分数(不参与的为 null)
|
|
236
|
+
p: [pct(c.parts.use), pct(c.parts.stars), pct(c.parts.maint), pct(c.parts.curated), pct(c.parts.stable), pct(c.parts.reach)],
|
|
177
237
|
src: [...c.src],
|
|
178
238
|
}
|
|
179
239
|
if (!c.n) {
|
|
180
240
|
row.name = c.name
|
|
181
241
|
row.repo = c.repo
|
|
182
|
-
if (c.added) row.added = c.added
|
|
183
242
|
}
|
|
243
|
+
if (c.added) row.added = c.added
|
|
184
244
|
// 不在 npm 目录里的(官方插件):面板查不到它的记录,名字、版本、下载量跟着行走
|
|
185
245
|
if (c.outside) Object.assign(row, { name: rec.n, v: rec.v, d: rec.d, w: rec.w })
|
|
186
246
|
if (c.stars != null) row.s = c.stars
|
|
187
|
-
if (
|
|
247
|
+
if (d && Number.isFinite(d.growth)) row.g = Math.round(d.growth * 100) / 100
|
|
248
|
+
if (d && d.lastRelease) row.last = d.lastRelease
|
|
188
249
|
else if (rec && rec.t) row.last = String(rec.t).slice(0, 10)
|
|
189
250
|
return row
|
|
190
251
|
}),
|
package/package.json
CHANGED
package/plugin/index.js
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
// POST /api-dsh-pick/uninstall 从 DSH 卸载本插件
|
|
16
16
|
// GET /api-dsh-pick/installed DSH 里已装的插件名(面板的「已安装」标记)
|
|
17
17
|
// GET /api-dsh-pick/live?names=a,b 实时查 npm(「我的监控」的刷新,最多 30 个)
|
|
18
|
+
// GET /api-dsh-pick/ai-pick 能不能用「AI 精选」(DSH 给不给插件调模型)
|
|
19
|
+
// POST /api-dsh-pick/ai-pick AI 精选:用 DSH 当前的模型按需求挑插件 { need }
|
|
18
20
|
// GET /api-dsh-pick/market dsh-pick 的插件索引在不在 DSH「插件 → 发现」的索引源里
|
|
19
21
|
// POST /api-dsh-pick/market 把它加进去(设置页的按钮)
|
|
20
22
|
//
|
|
@@ -32,6 +34,7 @@ import { registerTools } from './tools.js'
|
|
|
32
34
|
import { loadCatalog, liveStats, parseWatchNames } from '../lib/engine.js'
|
|
33
35
|
import { refreshCatalog, remoteState, CHECK_EVERY_MS } from '../lib/remote.js'
|
|
34
36
|
import { ensureMarketSource, marketStatus } from '../lib/market-source.js'
|
|
37
|
+
import { aiPick } from '../lib/ai-pick.js'
|
|
35
38
|
|
|
36
39
|
/** 本包根目录:插件就是完整的 dsh-pick 包 */
|
|
37
40
|
const PKG_ROOT = fileURLToPath(new URL('..', import.meta.url))
|
|
@@ -259,6 +262,12 @@ export function apply(ctx) {
|
|
|
259
262
|
profile = ctx.get && ctx.get('profileContext') && ctx.get('profileContext').name
|
|
260
263
|
} catch { profile = undefined }
|
|
261
264
|
|
|
265
|
+
// AI 精选:DSH 的模型(llm 服务)和默认模型选择。都是可选的,老版本 DSH 没有就不显示这个按钮
|
|
266
|
+
let llm, defaultModel
|
|
267
|
+
ctx.inject(['llm'], (c) => { llm = c.llm || (c.get && c.get('llm')) })
|
|
268
|
+
ctx.inject(['agentDefaultModel'], (c) => { defaultModel = c.agentDefaultModel || (c.get && c.get('agentDefaultModel')) })
|
|
269
|
+
const canAiPick = () => Boolean(llm && typeof llm.stream === 'function' && defaultModel && typeof defaultModel.currentSelection === 'function')
|
|
270
|
+
|
|
262
271
|
// DSH「插件 → 发现」的索引源(实验功能「自定义插件索引」打开时才有这个服务):自动加一次 dsh-pick 的插件索引
|
|
263
272
|
let pluginMarket
|
|
264
273
|
ctx.inject(['pluginMarket'], (mCtx) => {
|
|
@@ -420,6 +429,27 @@ export function apply(ctx) {
|
|
|
420
429
|
},
|
|
421
430
|
}))
|
|
422
431
|
|
|
432
|
+
// AI 精选(点了才调用模型,花的是用户的 token)
|
|
433
|
+
track(ws.register({
|
|
434
|
+
kind: 'exact',
|
|
435
|
+
path: '/api-dsh-pick/ai-pick',
|
|
436
|
+
handler: async (req, res) => {
|
|
437
|
+
if (req.method === 'GET') return sendJson(res, 200, { available: canAiPick() })
|
|
438
|
+
if (!isSafePost(req)) return sendJson(res, 403, { ok: false, message: '只接受本页面发出的请求' })
|
|
439
|
+
if (!canAiPick()) return sendJson(res, 200, { ok: false, message: '这个版本的 DSH 不让插件直接调用模型,可以点「+AI 帮我挑」在对话里问' })
|
|
440
|
+
const { need } = await readJsonBody(req)
|
|
441
|
+
try {
|
|
442
|
+
const result = await aiPick({
|
|
443
|
+
need, catalog: await loadCatalog(), llm, defaultModel,
|
|
444
|
+
installed: (await installedNames(pluginManager)) || new Set(),
|
|
445
|
+
})
|
|
446
|
+
sendJson(res, 200, { ok: true, ...result })
|
|
447
|
+
} catch (e) {
|
|
448
|
+
sendJson(res, 200, { ok: false, message: e.code === 'empty' ? e.message : `AI 精选失败:${e.message}` })
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
}))
|
|
452
|
+
|
|
423
453
|
// 「发现」的索引源:查状态 / 用户点按钮加进去
|
|
424
454
|
track(ws.register({
|
|
425
455
|
kind: 'exact',
|
package/plugin/tools.js
CHANGED
|
@@ -246,6 +246,7 @@ export async function buildToolDefinitions(deps = {}) {
|
|
|
246
246
|
metric: { type: 'string', enum: ['weekly', 'baseline', 'growth', 'score', 'stars', 'pushed', 'downloads', 'newest'], description: '排序指标,默认 baseline(日常基线,最接近真实使用量);stars = GitHub 星标,pushed = GitHub 最近提交' },
|
|
247
247
|
category: { type: 'string', enum: CATS, description: '只看某一类(可省略)' },
|
|
248
248
|
limit: { type: 'integer', description: '前几名,默认 10,最多 30' },
|
|
249
|
+
angle: { type: 'string', enum: ['rec', 'use', 'rep', 'stable', 'rise', 'new'], description: 'board=overall 时的排序角度:rec 综合推荐(默认)· use 最多人用(只看去噪基线)· rep 口碑(星标 + 精选/官方)· stable 稳定可靠 · rise 上升最快 · new 新上架' },
|
|
249
250
|
board: { type: 'string', enum: ['overall', 'official', 'community', 'shop'], description: '看别的榜单(可省略,省略就是 npm / GitHub):overall = 综合榜(几个插件市场合并去重,按综合分排,用户问「最值得装的」先用它);official = DeepSeek 官方插件;community = awesome-dsh-plugin 社区目录(dshmarket 用的就是它);shop = dsh-plugin-shop 插件商店(第三方)。community / shop 时 metric 可填 stars / downloads / newest' },
|
|
250
251
|
},
|
|
251
252
|
output: {
|
|
@@ -263,16 +264,29 @@ export async function buildToolDefinitions(deps = {}) {
|
|
|
263
264
|
if (!o) return plain({ header: header(cat), board: '综合榜:还没有数据', rows: [] })
|
|
264
265
|
const W = o.weights
|
|
265
266
|
const LABEL = { dshmarket: 'dshmarket', 'dsh-m': 'dsh-m 精选', shop: 'dsh-plugin-shop', official: 'DeepSeek 官方' }
|
|
267
|
+
const ANGLE = { rec: '综合推荐', use: '最多人用(去噪基线)', rep: '口碑(星标 + 精选/官方)', stable: '稳定可靠', rise: '上升最快(近 7 日增速)', new: '新上架(30 天内被收录)' }
|
|
268
|
+
const angle = ANGLE[args.angle] && o.rows[0] && o.rows[0].a ? args.angle : 'rec'
|
|
269
|
+
const val = r => (r.a ? r.a[angle] : r.sc)
|
|
266
270
|
const category = CATS.includes(args.category) ? args.category : null
|
|
267
271
|
const have = await installed()
|
|
268
|
-
const rows = o.rows
|
|
272
|
+
const rows = o.rows
|
|
273
|
+
.filter(r => val(r) != null && (!category || (r.n && cat.packages[r.n] && cat.packages[r.n].cat === category)))
|
|
274
|
+
.sort((x, y) => angle === 'new' ? String(y.added || '').localeCompare(String(x.added || '')) || val(y) - val(x) : val(y) - val(x))
|
|
275
|
+
.slice(0, limit)
|
|
276
|
+
const parts = r => (r.p && r.p.length >= 6
|
|
277
|
+
? `使用 ${r.p[0]} · 关注 ${r.p[1]} · 维护 ${r.p[2]} · 精选 ${r.p[3]} · 稳定 ${r.p[4]} · 覆盖 ${r.p[5]}`
|
|
278
|
+
: (r.p || []).join(' · '))
|
|
279
|
+
const formula = W.curated != null
|
|
280
|
+
? `综合推荐 = 使用 ${W.use}% + 关注 ${W.stars}% + 维护 ${W.maint}% + 精选 ${W.curated}% + 稳定 ${W.stable}% + 覆盖 ${W.reach}%`
|
|
281
|
+
: `综合分 = ${Object.entries(W).map(([k, v]) => `${k} ${v}%`).join(' + ')}`
|
|
269
282
|
return plain({
|
|
270
283
|
header: header(cat),
|
|
271
|
-
board:
|
|
284
|
+
board: `综合榜 · ${ANGLE[angle]}(${num(o.total)} 个插件参与排名;${formula},各项 0~100)`,
|
|
272
285
|
rows: rows.map((r, i) => {
|
|
273
286
|
const rec = r.n ? cat.packages[r.n] : null
|
|
274
287
|
const name = r.n || r.name
|
|
275
|
-
|
|
288
|
+
const angleNote = angle === 'rec' ? '' : angle === 'rise' && r.g != null ? ` · 近 7 日增速 ${Math.round(r.g * 100)}%` : angle === 'new' && r.added ? ` · ${r.added} 被收录` : ` · ${ANGLE[angle]}分 ${val(r)}`
|
|
289
|
+
return `${i + 1}. ${name} · 综合推荐 ${r.sc}(${parts(r)})${angleNote}` +
|
|
276
290
|
` · 收录于 ${r.src.map(k => LABEL[k] || k).join('、') || '(只在 npm)'}` +
|
|
277
291
|
(rec ? ` · 周下载 ${num(rec.w)}` : r.w != null ? ` · 周下载 ${num(r.w)}` : '') +
|
|
278
292
|
(r.s != null ? ` · ★${num(r.s)}` : '') +
|
package/web/panel.html
CHANGED
|
@@ -115,11 +115,56 @@ h1{margin:0;font-size:19px;font-weight:650;letter-spacing:-.2px}
|
|
|
115
115
|
table.rank td.nm .sub{font-size:10.5px;color:var(--t3);font-weight:400;margin-top:2px}
|
|
116
116
|
table.rank td.nm .desc{min-width:150px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
|
117
117
|
/* 综合榜:收录于哪几个市场 */
|
|
118
|
+
/* 比较清单 */
|
|
119
|
+
.pickbar{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin-top:14px;padding-top:12px;border-top:1px dashed var(--line);font-size:12px}
|
|
120
|
+
.pickbar .lbl{color:var(--t3);font-weight:600}
|
|
121
|
+
.pickbar .none{color:var(--t3)}
|
|
122
|
+
.pickchip{display:inline-flex;align-items:center;gap:4px;background:var(--accent-bg);color:var(--accent);border-radius:12px;padding:2px 4px 2px 9px;font-weight:600}
|
|
123
|
+
.pickchip button{appearance:none;border:none;background:none;color:inherit;cursor:pointer;font-size:14px;line-height:1;padding:0 3px}
|
|
124
|
+
.addwrap{position:relative;flex:1;min-width:160px}
|
|
125
|
+
.addwrap input{width:100%;box-sizing:border-box;border:1px solid var(--line);border-radius:8px;padding:6px 10px;font-size:12.5px;font-family:inherit;background:var(--input);color:var(--text)}
|
|
126
|
+
.addwrap input:focus{outline:none;border-color:var(--accent)}
|
|
127
|
+
.sug{position:absolute;left:0;right:0;top:100%;margin-top:4px;z-index:50;background:var(--panel);border:1px solid var(--line);border-radius:9px;box-shadow:0 6px 18px var(--shadow);max-height:300px;overflow:auto}
|
|
128
|
+
.sug .opt{padding:7px 10px;cursor:pointer;border-bottom:1px solid var(--soft)}
|
|
129
|
+
.sug .opt:last-child{border-bottom:none}
|
|
130
|
+
.sug .opt.on,.sug .opt:hover{background:var(--accent-bg)}
|
|
131
|
+
.sug .opt b{color:var(--text);font-size:12.5px}
|
|
132
|
+
.sug .opt span{display:block;color:var(--t3);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
133
|
+
/* AI 精选 */
|
|
134
|
+
.aip{border:1px solid var(--line);border-radius:11px;padding:11px 13px;margin-bottom:9px;background:var(--input)}
|
|
135
|
+
.aip .top{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
|
136
|
+
.aip .nm{font-weight:650;font-size:13.5px;color:var(--text)}
|
|
137
|
+
.aip .fit{font-size:11px;font-weight:700;color:var(--ai);background:color-mix(in srgb,var(--ai) 14%,transparent);border-radius:10px;padding:1px 8px}
|
|
138
|
+
.aip .why{font-size:12.5px;color:var(--text);margin:6px 0 2px;line-height:1.55}
|
|
139
|
+
.aip .cav{font-size:11.5px;color:var(--warn-text)}
|
|
140
|
+
.aip .data{font-size:11px;color:var(--t3);margin-top:5px;font-variant-numeric:tabular-nums}
|
|
141
|
+
.aip .acts{display:flex;align-items:center;gap:6px;margin-top:8px;flex-wrap:wrap}
|
|
142
|
+
.aip .cmpbtn{appearance:none;font-family:inherit;font-size:11px;font-weight:600;border:1px solid var(--line);border-radius:6px;padding:2px 9px;background:var(--panel);color:var(--t2);cursor:pointer}
|
|
143
|
+
.aip .cmpbtn.on{background:var(--accent-bg);color:var(--accent);border-color:var(--accent)}
|
|
144
|
+
.ai-wait{color:var(--t3);font-size:12.5px;padding:8px 0}
|
|
118
145
|
.srcchip{display:inline-block;font-size:10px;font-weight:500;color:var(--t2);background:var(--soft);border-radius:4px;padding:0 5px;margin:2px 3px 0 0;white-space:nowrap}
|
|
119
146
|
.srcchip.off{color:var(--accent);background:var(--accent-bg)}
|
|
120
147
|
.srcchip.gh{color:var(--t3)}
|
|
121
148
|
table.rank td .sc{font-size:13px;font-weight:700;color:var(--text);cursor:help}
|
|
122
|
-
|
|
149
|
+
/* 排行榜操作列的四个图标一样大:+、安装、GitHub、npm,都是 24×22 */
|
|
150
|
+
.ib{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:22px;padding:0;margin-right:4px;
|
|
151
|
+
border:1px solid var(--line);border-radius:6px;background:var(--panel);color:var(--accent);font-size:12px;line-height:1;vertical-align:top;cursor:default;font-family:inherit}
|
|
152
|
+
button.ib{cursor:pointer}
|
|
153
|
+
button.ib:hover{border-color:var(--accent);background:var(--accent-bg)}
|
|
154
|
+
.ib.inst-ic.confirm{background:var(--accent);border-color:var(--accent);color:#fff}
|
|
155
|
+
.ib.inst-ic:disabled{opacity:.6;cursor:default}
|
|
156
|
+
.ib.in{color:var(--ok-text);background:var(--ok-bg);border-color:transparent}
|
|
157
|
+
.ib.no{color:var(--t3);background:var(--soft);border-color:transparent;cursor:help}
|
|
158
|
+
table.rank .wadd{width:24px;height:22px;font-size:14px}
|
|
159
|
+
/* 综合榜固定列宽:插件名占剩下的空间,太长的省略、简介两行;数字始终看得见 */
|
|
160
|
+
table.rank.ov{table-layout:fixed;min-width:0}
|
|
161
|
+
table.rank.ov th,table.rank.ov td{padding-left:5px;padding-right:5px}
|
|
162
|
+
table.rank.ov td.nm{overflow:hidden}
|
|
163
|
+
table.rank.ov td.nm > .nmline{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
164
|
+
table.rank.ov td.nm .desc{min-width:0}
|
|
165
|
+
table.rank.ov td.nm .chips{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
166
|
+
table.rank.ov .srcchip{margin-right:2px;padding:0 3px}
|
|
167
|
+
table.rank.ov td.lks{width:112px}
|
|
123
168
|
table.rank td .arch{font-size:10.5px;color:var(--t3);background:var(--soft);border-radius:5px;padding:1px 6px}
|
|
124
169
|
.section h2 .h2-acts{margin-left:auto;display:inline-flex;gap:8px;align-items:center}
|
|
125
170
|
.section h2 .h2-acts .ai{margin-left:0}
|
|
@@ -236,7 +281,7 @@ td.down{color:var(--bad);font-weight:600}
|
|
|
236
281
|
/* 我的监控:和排行榜一样一行一个插件,上面是列名。名字和最后的图标宽度固定,
|
|
237
282
|
中间各列用 minmax(0, 1fr) 平分剩下的宽度,栏变窄时一起压缩,放不下的用省略号 */
|
|
238
283
|
/* 数字列留够短写数字(312k、#3088)的最小宽度,不会被截断;压缩主要由「分类」承担 */
|
|
239
|
-
#watchList{--mcols:minmax(84px,3.4fr) minmax(36px,.7fr) minmax(0,1.2fr) minmax(40px,.9fr) minmax(32px,.8fr) minmax(30px,.7fr) minmax(36px,.8fr)
|
|
284
|
+
#watchList{--mcols:minmax(84px,3.4fr) minmax(36px,.7fr) minmax(0,1.2fr) minmax(40px,.9fr) minmax(32px,.8fr) minmax(30px,.7fr) minmax(36px,.8fr) 76px}
|
|
240
285
|
.mrow{display:grid;grid-template-columns:var(--mcols);align-items:center;column-gap:6px;padding:8px 0;border-bottom:1px solid var(--soft);font-size:12px;color:var(--t2)}
|
|
241
286
|
.mrow:last-child{border-bottom:none}
|
|
242
287
|
.mrow.mhead{font-size:11px;color:var(--t3);font-weight:600;padding:0 0 7px;border-bottom:1px solid var(--line)}
|
|
@@ -247,7 +292,8 @@ td.down{color:var(--bad);font-weight:600}
|
|
|
247
292
|
.mrow .nm{font-size:13px;font-weight:650;color:var(--text)}
|
|
248
293
|
.mrow.mhead .nm{font-size:11px;font-weight:600;color:var(--t3)}
|
|
249
294
|
.mrow .ver{color:var(--t3);font-weight:400;font-size:11px}
|
|
250
|
-
|
|
295
|
+
/* 最后一列固定宽度(两个链接图标 + ×):每一行是各自的网格,宽度要是按内容来,表头(空的)和数据行就对不齐 */
|
|
296
|
+
.mrow .acts{display:flex;align-items:center;justify-content:flex-end;overflow:visible;width:76px}
|
|
251
297
|
.mrow .livedot{display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--ok);margin-right:5px;vertical-align:middle}
|
|
252
298
|
.mrow .x{appearance:none;border:none;background:none;color:var(--t3);cursor:pointer;font-size:16px;line-height:1;padding:0 2px 0 4px;flex:none}
|
|
253
299
|
.mrow .x:hover{color:var(--bad)}
|
|
@@ -339,6 +385,7 @@ td.down{color:var(--bad);font-weight:600}
|
|
|
339
385
|
<div class="row">
|
|
340
386
|
<input id="need" placeholder="例如:我想装个数据库 / 我想让 DSH 能连微信 / 记忆能力" autocomplete="off">
|
|
341
387
|
<button class="btn" id="btnFind">找候选</button>
|
|
388
|
+
<button class="btn ghost hidden" id="btnAi" title="用 DSH 当前的大模型读懂你的需求,再从目录里挑真正合适的(会消耗你的模型额度)">AI 精选</button>
|
|
342
389
|
</div>
|
|
343
390
|
<div class="examples">
|
|
344
391
|
<span>试试:</span>
|
|
@@ -350,6 +397,21 @@ td.down{color:var(--bad);font-weight:600}
|
|
|
350
397
|
<button class="chip">费用统计</button>
|
|
351
398
|
<button class="chip">远程服务器</button>
|
|
352
399
|
</div>
|
|
400
|
+
<!-- 比较清单:搜索结果之外的插件,输入名字也能加进来比较 -->
|
|
401
|
+
<div class="pickbar">
|
|
402
|
+
<span class="lbl">比较清单</span>
|
|
403
|
+
<span id="pickChips"><span class="none">还没有,点候选卡片或在右边输入插件名</span></span>
|
|
404
|
+
<span class="addwrap">
|
|
405
|
+
<input id="addCmp" placeholder="输入插件名,加入比较" autocomplete="off" aria-label="输入插件名,加入比较">
|
|
406
|
+
<div id="addSug" class="sug hidden" role="listbox"></div>
|
|
407
|
+
</span>
|
|
408
|
+
</div>
|
|
409
|
+
</div>
|
|
410
|
+
|
|
411
|
+
<div class="section hidden" id="secAi">
|
|
412
|
+
<h2><span class="n">✦</span>AI 精选 <span style="font-size:11.5px;color:var(--t3);font-weight:500" id="aiMeta"></span></h2>
|
|
413
|
+
<p class="cap">用 DSH 当前的大模型:先把需求展开成一组关键字,从全部目录里召回候选,再逐个读简介和数据,挑出真正能解决问题的。理由是模型写的,数字来自目录。</p>
|
|
414
|
+
<div id="aiList"></div>
|
|
353
415
|
</div>
|
|
354
416
|
|
|
355
417
|
<div class="section hidden" id="secCand">
|
|
@@ -393,6 +455,12 @@ td.down{color:var(--bad);font-weight:600}
|
|
|
393
455
|
</div>
|
|
394
456
|
<p class="cap" id="rankCap"></p>
|
|
395
457
|
<div class="filters" id="rankFilters">
|
|
458
|
+
<button class="chip on" data-board="overall" data-m="rec">综合推荐</button>
|
|
459
|
+
<button class="chip" data-board="overall" data-m="use">最多人用</button>
|
|
460
|
+
<button class="chip" data-board="overall" data-m="rep">口碑</button>
|
|
461
|
+
<button class="chip" data-board="overall" data-m="stable">稳定可靠</button>
|
|
462
|
+
<button class="chip" data-board="overall" data-m="rise">上升最快</button>
|
|
463
|
+
<button class="chip" data-board="overall" data-m="new">新上架</button>
|
|
396
464
|
<button class="chip on hidden" data-board="npm" data-m="base">日常基线</button>
|
|
397
465
|
<button class="chip hidden" data-board="npm" data-m="w">周下载</button>
|
|
398
466
|
<button class="chip hidden" data-board="npm" data-m="growth">增速最快</button>
|