dsh-zhihu-search 1.2.4 → 1.2.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.
- package/README.md +33 -10
- package/README_en.md +38 -15
- package/lib/present/search.js +4 -1
- package/lib/tools/global-search.js +4 -2
- package/lib/tools/search.js +4 -2
- package/lib/types.d.ts +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">dsh-zhihu-search</h1>
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[](.node-version)
|
|
7
|
-
[](package.json)
|
|
5
|
+
<div align="center">
|
|
6
|
+
<p><strong>赋予 DeepSeek Harness 检索知乎社区的能力</strong></p>
|
|
7
|
+
<p><em>Empowering DeepSeek Harness with Zhihu Insights</em></p>
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<p>
|
|
10
|
+
<a href="https://developer.zhihu.com/"><img src="https://img.shields.io/badge/Zhihu%20Open%20Platform-Official%20API-0084FF?style=flat&logo=zhihu&logoColor=white" alt="知乎开放平台官方 API"></a>
|
|
11
|
+
<a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/DeepSeek%20Harness-Plugin-4176E6?style=flat" alt="DeepSeek Harness Plugin"></a>
|
|
12
|
+
<a href="https://github.com/topics/dsh-plugin"><img src="https://img.shields.io/badge/dsh--plugin-Auto%20Discovered-orange?style=flat" alt="dsh-plugin"></a>
|
|
13
|
+
</p>
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
<p>
|
|
16
|
+
<a href="https://github.com/zlZayn/dsh-zhihu-search/actions/workflows/ci.yml"><img src="https://github.com/zlZayn/dsh-zhihu-search/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
17
|
+
<a href="https://www.npmjs.com/package/dsh-zhihu-search"><img src="https://img.shields.io/npm/v/dsh-zhihu-search.svg" alt="npm"></a>
|
|
18
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="MIT 许可证"></a>
|
|
19
|
+
<a href="https://slsa.dev/"><img src="https://img.shields.io/badge/SLSA-Provenance-green?logo=slsa" alt="SLSA Provenance"></a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p>
|
|
23
|
+
<strong><a href="README.md">简体中文</a></strong> · <a href="README_en.md">English</a>
|
|
24
|
+
</p>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
---
|
|
12
28
|
|
|
13
|
-
!
|
|
29
|
+
> [!NOTE]
|
|
30
|
+
> **基于知乎开放平台官方 API 构建**,非爬虫抓取。所有检索结果均附带可引用的原始链接,知乎站内结果另附点赞数,让模型的每一次回答都有据可查。
|
|
31
|
+
|
|
32
|
+
给 DSH 装上知乎:站内检索、全网检索与直答三个工具,返回可引用的来源列表,而不是一段无法核对的摘要。
|
|
14
33
|
|
|
15
|
-
|
|
34
|
+
<p align="center">
|
|
35
|
+
<img src="assets/settings-card.png" alt="插件配置页中的「知乎搜索」卡片" width="600">
|
|
36
|
+
<br>
|
|
37
|
+
<em>在 <strong>设置 → 插件 → 插件配置</strong> 中与其他插件并排,Access Secret 就地填写、立即生效。</em>
|
|
38
|
+
</p>
|
|
16
39
|
|
|
17
40
|
## 工具一览
|
|
18
41
|
|
package/README_en.md
CHANGED
|
@@ -1,18 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">dsh-zhihu-search</h1>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<div align="center">
|
|
6
|
+
<p><strong>Empowering DeepSeek Harness with Zhihu Insights</strong></p>
|
|
7
|
+
<p><em>赋予 DeepSeek Harness 检索知乎社区的能力</em></p>
|
|
8
|
+
|
|
9
|
+
<p>
|
|
10
|
+
<a href="https://developer.zhihu.com/"><img src="https://img.shields.io/badge/Zhihu%20Open%20Platform-Official%20API-0084FF?style=flat&logo=zhihu&logoColor=white" alt="Zhihu Open Platform Official API"></a>
|
|
11
|
+
<a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/DeepSeek%20Harness-Plugin-4176E6?style=flat" alt="DeepSeek Harness Plugin"></a>
|
|
12
|
+
<a href="https://github.com/topics/dsh-plugin"><img src="https://img.shields.io/badge/dsh--plugin-Auto%20Discovered-orange?style=flat" alt="dsh-plugin"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p>
|
|
16
|
+
<a href="https://github.com/zlZayn/dsh-zhihu-search/actions/workflows/ci.yml"><img src="https://github.com/zlZayn/dsh-zhihu-search/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
17
|
+
<a href="https://www.npmjs.com/package/dsh-zhihu-search"><img src="https://img.shields.io/npm/v/dsh-zhihu-search.svg" alt="npm"></a>
|
|
18
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="MIT License"></a>
|
|
19
|
+
<a href="https://slsa.dev/"><img src="https://img.shields.io/badge/SLSA-Provenance-green?logo=slsa" alt="SLSA Provenance"></a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p>
|
|
23
|
+
<a href="README.md">简体中文</a> · <strong><a href="README_en.md">English</a></strong>
|
|
24
|
+
</p>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
> [!NOTE]
|
|
30
|
+
> **Built on the official Zhihu Open Platform API**, not web scraping. All search results include citable original links, and Zhihu's own results also carry their upvote counts, ensuring every model response is verifiable.
|
|
31
|
+
|
|
32
|
+
Equips DSH with three Zhihu tools: in-site search, global web search, and Zhida direct answers — returning a list of citable sources instead of an unverifiable summary.
|
|
33
|
+
|
|
34
|
+
<p align="center">
|
|
35
|
+
<img src="assets/settings-card_en.png" alt="Zhihu Search card in the plugin settings" width="600">
|
|
36
|
+
<br>
|
|
37
|
+
<em>Sits alongside other plugins in <strong>Settings → Plugins → Plugin configuration</strong>. Enter your Access Secret and it takes effect immediately.</em>
|
|
38
|
+
</p>
|
|
16
39
|
|
|
17
40
|
## Tools
|
|
18
41
|
|
package/lib/present/search.js
CHANGED
|
@@ -41,7 +41,10 @@ export function renderSearch(value) {
|
|
|
41
41
|
const lines = [`找到 ${String(value.items.length)} 条关于 "${value.query}" 的知乎结果:`, ''];
|
|
42
42
|
for (const item of value.items) {
|
|
43
43
|
lines.push(`### [${escapeLinkText(item.title)}](${item.url})`);
|
|
44
|
-
const meta = [`**作者**: ${item.author || '匿名'}
|
|
44
|
+
const meta = [`**作者**: ${item.author || '匿名'}`];
|
|
45
|
+
// 点赞数缺失时整段省略:写 `**点赞**: 0` 会把「不知道」说成「没人赞」。
|
|
46
|
+
if (item.voteUpCount !== undefined)
|
|
47
|
+
meta.push(`**点赞**: ${String(item.voteUpCount)}`);
|
|
45
48
|
// 类型缺失时整段省略,而不是渲染成空的「类型: 」。
|
|
46
49
|
if (item.contentType !== '')
|
|
47
50
|
meta.push(`**类型**: ${item.contentType}`);
|
|
@@ -39,7 +39,9 @@ function projectItem(item) {
|
|
|
39
39
|
url,
|
|
40
40
|
snippet: sanitizeSnippet(typeof item.ContentText === 'string' ? item.ContentText : ''),
|
|
41
41
|
author: sanitizeSnippet(typeof item.AuthorName === 'string' ? item.AuthorName : '', 60),
|
|
42
|
-
|
|
42
|
+
// 上游没报点赞数时整个键省略,不兜底成 0:全网的第三方网页没有这个字段,
|
|
43
|
+
// 写 0 等于告诉模型「这个页面没人赞」,而事实是「不知道」。
|
|
44
|
+
...(typeof item.VoteUpCount === 'number' && Number.isFinite(item.VoteUpCount) ? { voteUpCount: item.VoteUpCount } : {}),
|
|
43
45
|
// ContentType 缺失时留空,不编造标签:实测第三方网页(如接单平台)就没有这个字段,
|
|
44
46
|
// 兜底成 'Article' 会让模型把广告页当成知乎文章。
|
|
45
47
|
contentType: typeof item.ContentType === 'string' ? item.ContentType : '',
|
|
@@ -83,7 +85,7 @@ export function createZhihuGlobalSearchTool(deps) {
|
|
|
83
85
|
url: { type: 'string', required: true },
|
|
84
86
|
snippet: { type: 'string', required: true },
|
|
85
87
|
author: { type: 'string', required: true },
|
|
86
|
-
voteUpCount: { type: 'number'
|
|
88
|
+
voteUpCount: { type: 'number' },
|
|
87
89
|
contentType: { type: 'string', required: true },
|
|
88
90
|
},
|
|
89
91
|
},
|
package/lib/tools/search.js
CHANGED
|
@@ -41,7 +41,9 @@ function projectItem(item) {
|
|
|
41
41
|
url,
|
|
42
42
|
snippet: sanitizeSnippet(typeof item.ContentText === 'string' ? item.ContentText : ''),
|
|
43
43
|
author: sanitizeSnippet(typeof item.AuthorName === 'string' ? item.AuthorName : '', 60),
|
|
44
|
-
|
|
44
|
+
// 上游没报点赞数时整个键省略,不兜底成 0:全网的第三方网页没有这个字段,
|
|
45
|
+
// 写 0 等于告诉模型「这个页面没人赞」,而事实是「不知道」。
|
|
46
|
+
...(typeof item.VoteUpCount === 'number' && Number.isFinite(item.VoteUpCount) ? { voteUpCount: item.VoteUpCount } : {}),
|
|
45
47
|
// ContentType 缺失时留空,不编造标签:实测外部网页根本没有这个字段,
|
|
46
48
|
// 兜底成 'Answer' 会让模型把一个陌生网页当成知乎回答。
|
|
47
49
|
contentType: typeof item.ContentType === 'string' ? item.ContentType : '',
|
|
@@ -100,7 +102,7 @@ export function createZhihuSearchTool(deps) {
|
|
|
100
102
|
url: { type: 'string', required: true },
|
|
101
103
|
snippet: { type: 'string', required: true },
|
|
102
104
|
author: { type: 'string', required: true },
|
|
103
|
-
voteUpCount: { type: 'number'
|
|
105
|
+
voteUpCount: { type: 'number' },
|
|
104
106
|
contentType: { type: 'string', required: true },
|
|
105
107
|
},
|
|
106
108
|
},
|
package/lib/types.d.ts
CHANGED
|
@@ -114,7 +114,11 @@ export interface SearchOutput {
|
|
|
114
114
|
/** 已清洗 <em> 标签的纯文本摘要。 */
|
|
115
115
|
snippet: string;
|
|
116
116
|
author: string;
|
|
117
|
-
|
|
117
|
+
/**
|
|
118
|
+
* 点赞数。上游没报该字段时**整个键省略**,不兜底成 0 ——
|
|
119
|
+
* 全网的第三方网页就不带这个字段,「0 赞」与「不知道」是两回事。
|
|
120
|
+
*/
|
|
121
|
+
voteUpCount?: number;
|
|
118
122
|
contentType: string;
|
|
119
123
|
}>;
|
|
120
124
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-zhihu-search",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "DSH plugin: Zhihu in-site search, global web search, and Zhida over the official Zhihu Open Platform API — with a native settings card and source-cited results.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|