@klarkxy/dsh-zhihu 0.2.8 → 0.2.10
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 -12
- package/docs/README.zh-CN.md +15 -13
- package/lib/client.js +12 -8
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/open-platform.js +3 -3
- package/lib/open-platform.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[简体中文](docs/README.zh-CN.md)
|
|
6
6
|
|
|
7
|
-
Use Zhihu as a research source for the model: site search, web search, hot list, Zhida answers, knowledge bases, question discovery, and creator statistics. The `zhihu_sync` tool also saves and validates article, question, or pin drafts and uploads images. Every request uses your own Zhihu Access Secret
|
|
7
|
+
Use Zhihu as a research source for the model: site search, web search, hot list, Zhida answers, knowledge bases, question discovery, and creator statistics. The `zhihu_sync` tool also saves and validates article, question, or pin drafts and uploads images. Every request uses your own Zhihu Access Secret, and returned items serve as reference material.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -12,11 +12,11 @@ Use Zhihu as a research source for the model: site search, web search, hot list,
|
|
|
12
12
|
dsh plugin --profile web add @klarkxy/dsh-zhihu
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Replace `web` with your profile name and restart DSH Web.
|
|
15
|
+
Replace `web` with your profile name and restart DSH Web. Always specify the full scoped name `@klarkxy/dsh-zhihu`, as the unscoped `dsh-zhihu` is a separate package by another author.
|
|
16
16
|
|
|
17
17
|
## Use
|
|
18
18
|
|
|
19
|
-
Open **
|
|
19
|
+
Open **Settings → Zhihu** and enter your Access Secret under **Settings**. Other tabs:
|
|
20
20
|
|
|
21
21
|
- **Stats**: local daily calls, failures, and result counts;
|
|
22
22
|
- **Official quota**: remaining free allowance as reported by Zhihu;
|
|
@@ -27,11 +27,11 @@ With the Web Search plugin installed, Zhihu web search also appears in its provi
|
|
|
27
27
|
|
|
28
28
|
## Drafts and media
|
|
29
29
|
|
|
30
|
-
In **
|
|
30
|
+
In **Settings → Zhihu → Settings**, configure the publishing App Key and App Secret obtained from the [Zhihu publishing assistant](https://www.zhihu.com/playground/zhihu-publisher). These are separate from the search Access Secret. You can also paste Zhihu’s authorization text directly into the App Secret field when both credentials appear as `ZHIHU_OPENAPI_APP_KEY:"…"` and `ZHIHU_OPENAPI_APP_SECRET:"…"`; the plugin extracts and keeps those two values only. The `zhihu_sync` tool then lets the model save, list, read, and validate drafts for articles, questions, or pins, and upload images for them. Drafts persist across DSH restarts. This plugin covers draft preparation and validation; publishing is done on Zhihu.
|
|
31
31
|
|
|
32
32
|
## Give the tools to the model
|
|
33
33
|
|
|
34
|
-
These model tools are enabled by default
|
|
34
|
+
These model tools are enabled by default in your agent presets:
|
|
35
35
|
|
|
36
36
|
| Tool | Purpose |
|
|
37
37
|
| --- | --- |
|
|
@@ -44,9 +44,11 @@ These model tools are enabled by default; no agent preset changes needed:
|
|
|
44
44
|
| `zhihu_quota` | Check official quota |
|
|
45
45
|
| `zhihu_sync` | Save, list, read, and validate drafts or upload images |
|
|
46
46
|
|
|
47
|
+
Site search and web search return an empty list when nothing matches, along with the service's explanation when provided.
|
|
48
|
+
|
|
47
49
|
## Cost protection
|
|
48
50
|
|
|
49
|
-
By default research requests use only Zhihu's free allowance: before each request the plugin checks the official quota and
|
|
51
|
+
By default research requests use only Zhihu's free allowance: before each request the plugin checks the official quota and sends the request only when free quota remains. It also caps usage at 100 requests per day (Beijing time). Both are configurable:
|
|
50
52
|
|
|
51
53
|
```yaml
|
|
52
54
|
config:
|
|
@@ -54,16 +56,16 @@ config:
|
|
|
54
56
|
dailyCallLimit: 100
|
|
55
57
|
```
|
|
56
58
|
|
|
57
|
-
Paid use is
|
|
59
|
+
Paid use is enabled only when you set `allowPaid: true` yourself.
|
|
58
60
|
|
|
59
61
|
## Limits
|
|
60
62
|
|
|
61
|
-
-
|
|
63
|
+
- Other clients sharing the same account can consume the free allowance between quota checks.
|
|
62
64
|
- Knowledge-base uploads are stored on Zhihu's servers and limited to 20 MB per file. Draft images are also uploaded to Zhihu.
|
|
63
|
-
- Drafts support articles, questions, and pins
|
|
64
|
-
- Draft and image operations use Zhihu's publishing authorization
|
|
65
|
-
-
|
|
66
|
-
-
|
|
65
|
+
- Drafts support articles, questions, and pins. Supported images: JPEG, PNG, GIF, WebP, and BMP (up to 15 MB for GIF, and up to 30 MB for other formats; convert HEIC/AVIF to a supported format before uploading).
|
|
66
|
+
- Draft and image operations use Zhihu's publishing authorization, separate from search quota and paid-search settings.
|
|
67
|
+
- Each request runs once without automatic retries.
|
|
68
|
+
- Scope covers research queries, knowledge bases, creator stats, and draft preparation; publishing drafts, OAuth account switching, top-ups, and wallet queries stay on Zhihu.
|
|
67
69
|
|
|
68
70
|
## License
|
|
69
71
|
|
package/docs/README.zh-CN.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[English](../README.md)
|
|
6
6
|
|
|
7
|
-
把知乎交给模型当调研信源:站内搜索、全网搜索、热榜、知乎直答、知识库、问题发现和创作数据。`zhihu_sync` 工具还可以保存、校验文章、提问或想法草稿并上传配图。每次请求只用你自己的知乎 Access Secret
|
|
7
|
+
把知乎交给模型当调研信源:站内搜索、全网搜索、热榜、知乎直答、知识库、问题发现和创作数据。`zhihu_sync` 工具还可以保存、校验文章、提问或想法草稿并上传配图。每次请求只用你自己的知乎 Access Secret,返回内容作为调研参考资料。
|
|
8
8
|
|
|
9
9
|
## 安装
|
|
10
10
|
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
dsh plugin --profile web add @klarkxy/dsh-zhihu
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
把 `web` 换成你的 profile 名,重启 DSH Web。请使用完整的 scoped
|
|
15
|
+
把 `web` 换成你的 profile 名,重启 DSH Web。请使用完整的 scoped 包名 `@klarkxy/dsh-zhihu`(无 scope 的 `dsh-zhihu` 属于其他维护者)。
|
|
16
16
|
|
|
17
17
|
## 使用
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
打开「设置 → 知乎」,在「设置」页签中填写 Access Secret。其他页签:
|
|
20
20
|
|
|
21
21
|
- **统计**:本机记录的每日调用、失败和结果条数;
|
|
22
22
|
- **官方用量**:知乎返回的剩余免费额度;
|
|
@@ -27,11 +27,11 @@ dsh plugin --profile web add @klarkxy/dsh-zhihu
|
|
|
27
27
|
|
|
28
28
|
## 草稿与配图
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
在「设置 → 知乎 → 设置」页签填写发布用 App Key 和 App Secret,可从[知乎同步助手](https://www.zhihu.com/playground/zhihu-publisher)申请;它们与检索 Access Secret 分开配置。知乎的授权说明也可以整段粘进 App Secret 输入框(包含 `ZHIHU_OPENAPI_APP_KEY:"…"` 与 `ZHIHU_OPENAPI_APP_SECRET:"…"` 两项),插件会自动提取并仅保存这两项凭据。`zhihu_sync` 工具随后可让模型保存、列出、读取并校验文章、提问或想法草稿,并为其上传配图;草稿在重启 DSH 后仍可继续处理。插件负责草稿准备与校验,正式发布请在知乎完成。
|
|
31
31
|
|
|
32
32
|
## 让模型使用
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
以下模型工具默认在 Agent 预设中启用:
|
|
35
35
|
|
|
36
36
|
| 工具 | 用途 |
|
|
37
37
|
| --- | --- |
|
|
@@ -44,9 +44,11 @@ dsh plugin --profile web add @klarkxy/dsh-zhihu
|
|
|
44
44
|
| `zhihu_quota` | 查询官方额度 |
|
|
45
45
|
| `zhihu_sync` | 保存、列出、读取并校验草稿,上传配图 |
|
|
46
46
|
|
|
47
|
+
站内搜索和全网搜索无匹配内容时返回空列表;服务提供原因说明时会一并显示。
|
|
48
|
+
|
|
47
49
|
## 费用保护
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
检索与创作查询默认只用知乎的免费额度:每次请求前先查官方额度,确认有剩余免费额度才发送。另外每天(北京时间)最多 100 次请求。两项都可在插件配置中修改:
|
|
50
52
|
|
|
51
53
|
```yaml
|
|
52
54
|
config:
|
|
@@ -54,16 +56,16 @@ config:
|
|
|
54
56
|
dailyCallLimit: 100
|
|
55
57
|
```
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
仅在你主动将 `allowPaid` 设为 `true` 时才启用付费调用。
|
|
58
60
|
|
|
59
61
|
## 限制
|
|
60
62
|
|
|
61
|
-
-
|
|
62
|
-
- 知识库文件保存在知乎云端,单个文件最大 20 MB
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
63
|
+
- 同一账号下的其他客户端可能在两次额度检查之间消耗免费额度。
|
|
64
|
+
- 知识库文件保存在知乎云端,单个文件最大 20 MB;草稿配图同样上传至知乎。
|
|
65
|
+
- 草稿支持文章、提问和想法。图片支持 JPEG、PNG、GIF、WebP、BMP(GIF 最大 15 MB,其他格式最大 30 MB;HEIC/AVIF 请先转换为上述格式再上传)。
|
|
66
|
+
- 草稿与图片操作使用知乎提供的发布授权,独立于搜索额度与付费搜索开关。
|
|
67
|
+
- 每次请求单次执行,由调用方按需决定是否重试。
|
|
68
|
+
- 功能范围涵盖调研检索、知识库、创作统计与草稿准备;草稿发布、OAuth 账号切换、充值与钱包查询请在知乎端操作。
|
|
67
69
|
|
|
68
70
|
## 许可证
|
|
69
71
|
|
package/lib/client.js
CHANGED
|
@@ -592,7 +592,7 @@ ${scope} {
|
|
|
592
592
|
* The shared contract paints this page: the type tiers, the card, the field,
|
|
593
593
|
* the banners, the empty state, the focus ring and every control's own recipe.
|
|
594
594
|
* What is left here is only the geometry the contract does not cover — the
|
|
595
|
-
* reading width of the
|
|
595
|
+
* reading width of the settings page, two inline SVG charts, the quota matrix and
|
|
596
596
|
* the day table.
|
|
597
597
|
*
|
|
598
598
|
* Nothing below declares a colour of its own beyond naming a host token for a
|
|
@@ -1727,7 +1727,7 @@ function ZhihuQuotaSection({ rpc }) {
|
|
|
1727
1727
|
/**
|
|
1728
1728
|
* 知乎发布助手的应用凭据设置。
|
|
1729
1729
|
*
|
|
1730
|
-
*
|
|
1730
|
+
* 只有设置页的知乎分区(settings.section)里才有这段表单:右侧栏工作台不发凭据,
|
|
1731
1731
|
* 也不重复提供入口。凭据本身由宿主管理(remote.credentials),插件只读写引用。
|
|
1732
1732
|
*/
|
|
1733
1733
|
const ZHIHU_APP_KEY_REF = "ZHIHU_OPENAPI_APP_KEY";
|
|
@@ -2084,8 +2084,7 @@ const inject = [
|
|
|
2084
2084
|
"remote.credentials",
|
|
2085
2085
|
"locale"
|
|
2086
2086
|
];
|
|
2087
|
-
const
|
|
2088
|
-
const SLOT_ORDER = 120;
|
|
2087
|
+
const SLOT_ORDER = 160;
|
|
2089
2088
|
const activityText = (children) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.TextShimmer, {
|
|
2090
2089
|
active: true,
|
|
2091
2090
|
children
|
|
@@ -3616,11 +3615,16 @@ function apply(ctx) {
|
|
|
3616
3615
|
credentials: wrapCredentials(client.remote.credentials),
|
|
3617
3616
|
locale
|
|
3618
3617
|
});
|
|
3619
|
-
ctx.effect(() => client.slots.inject("
|
|
3620
|
-
name: "
|
|
3621
|
-
|
|
3618
|
+
ctx.effect(() => client.slots.inject("settings.section", () => [client.slots.register({
|
|
3619
|
+
name: "settings.section",
|
|
3620
|
+
id: "zhihu",
|
|
3621
|
+
order: SLOT_ORDER,
|
|
3622
|
+
label: () => (locale ? locale.getSnapshot().active : "zh").startsWith("zh") ? "知乎" : "Zhihu"
|
|
3623
|
+
}, settingsRender), client.slots.inject("settings.section.icon", () => client.slots.register({
|
|
3624
|
+
name: "settings.section.icon",
|
|
3625
|
+
id: "zhihu",
|
|
3622
3626
|
order: SLOT_ORDER
|
|
3623
|
-
},
|
|
3627
|
+
}, _deepseek_ai_dsh_client_ui_primitives.IconQuestionOutlineRegular))]), "zhihu.settings");
|
|
3624
3628
|
}
|
|
3625
3629
|
//#endregion
|
|
3626
3630
|
exports.CapabilitiesNote = CapabilitiesNote;
|
package/lib/index.js
CHANGED
|
@@ -2859,7 +2859,7 @@ async function apply(ctx, config = {}) {
|
|
|
2859
2859
|
const syncDomain = await ctx.storageDomain.open(zhihuSyncDomainSpec);
|
|
2860
2860
|
const sync = createZhihuSyncService(syncDomain.table("drafts"), { resolveCredentials: async () => {
|
|
2861
2861
|
const [key, secret] = await Promise.all(ZHIHU_SYNC_CREDENTIAL_REFS.map((ref) => host.credentials.resolve(credentialRef(ref))));
|
|
2862
|
-
if (!key?.value.trim() || !secret?.value.trim()) throw new ZhihuSyncServiceError("sync-credentials-missing", "
|
|
2862
|
+
if (!key?.value.trim() || !secret?.value.trim()) throw new ZhihuSyncServiceError("sync-credentials-missing", "请在「设置 → 知乎」中填写发布 App Key 和 App Secret。");
|
|
2863
2863
|
return {
|
|
2864
2864
|
appKey: key.value.trim(),
|
|
2865
2865
|
appSecret: secret.value.trim()
|