@dcrays/web-search 0.1.4-beta.1 → 0.1.4-beta.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/cordis.patch.yml +5 -5
- package/package.json +3 -3
- package/plugin/index.js +14 -1
- package/src/tools.js +14 -1
package/cordis.patch.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
- insert:
|
|
2
|
-
- id: mbh-web-search
|
|
3
|
-
name: '@dcrays/web-search'
|
|
4
|
-
config:
|
|
5
|
-
enabled: true
|
|
1
|
+
- insert:
|
|
2
|
+
- id: mbh-web-search
|
|
3
|
+
name: '@dcrays/web-search'
|
|
4
|
+
config:
|
|
5
|
+
enabled: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcrays/web-search",
|
|
3
|
-
"version": "0.1.4-beta.
|
|
3
|
+
"version": "0.1.4-beta.10",
|
|
4
4
|
"description": "DeepSeek Harness web search plugin for Mobook",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "plugin/index.js",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"dependencies": {},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
34
|
-
"@deepseek-ai/dsh-home-paths": "0.1.
|
|
35
|
-
"@deepseek-ai/dsh-tools": "
|
|
34
|
+
"@deepseek-ai/dsh-home-paths": "0.1.5-rc.2",
|
|
35
|
+
"@deepseek-ai/dsh-tools": "0.1.5-rc.2",
|
|
36
36
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
package/plugin/index.js
CHANGED
|
@@ -257,6 +257,19 @@ ${nonce}`;
|
|
|
257
257
|
|
|
258
258
|
// dist/src/tools.js
|
|
259
259
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
260
|
+
function renderSearchResult(result) {
|
|
261
|
+
const lines = [`\u641C\u7D22\u8BCD\uFF1A${result.query}`, `\u641C\u7D22\u7ED3\u679C\uFF1A${result.results.length} \u6761`];
|
|
262
|
+
for (const [index, item] of result.results.entries()) {
|
|
263
|
+
lines.push("", `${index + 1}. ${item.title}`, ` \u94FE\u63A5\uFF1A${item.url}`);
|
|
264
|
+
if (item.siteName)
|
|
265
|
+
lines.push(` \u6765\u6E90\uFF1A${item.siteName}`);
|
|
266
|
+
if (item.publishedAt)
|
|
267
|
+
lines.push(` \u53D1\u5E03\u65F6\u95F4\uFF1A${item.publishedAt}`);
|
|
268
|
+
if (item.snippet)
|
|
269
|
+
lines.push(` \u6458\u8981\uFF1A${item.snippet}`);
|
|
270
|
+
}
|
|
271
|
+
return lines.join("\n");
|
|
272
|
+
}
|
|
260
273
|
function createWebSearchTool(search) {
|
|
261
274
|
return defineTool({
|
|
262
275
|
name: "web_search",
|
|
@@ -279,7 +292,7 @@ function createWebSearchTool(search) {
|
|
|
279
292
|
},
|
|
280
293
|
output: {
|
|
281
294
|
schema: { type: "json" },
|
|
282
|
-
render: (_args, value) => [{ type: "text", text:
|
|
295
|
+
render: (_args, value) => [{ type: "text", text: renderSearchResult(value) }]
|
|
283
296
|
},
|
|
284
297
|
timeoutMs: 35e3,
|
|
285
298
|
async execute(args, exec) {
|
package/src/tools.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { defineTool } from '@deepseek-ai/dsh-tools';
|
|
2
|
+
function renderSearchResult(result) {
|
|
3
|
+
const lines = [`搜索词:${result.query}`, `搜索结果:${result.results.length} 条`];
|
|
4
|
+
for (const [index, item] of result.results.entries()) {
|
|
5
|
+
lines.push('', `${index + 1}. ${item.title}`, ` 链接:${item.url}`);
|
|
6
|
+
if (item.siteName)
|
|
7
|
+
lines.push(` 来源:${item.siteName}`);
|
|
8
|
+
if (item.publishedAt)
|
|
9
|
+
lines.push(` 发布时间:${item.publishedAt}`);
|
|
10
|
+
if (item.snippet)
|
|
11
|
+
lines.push(` 摘要:${item.snippet}`);
|
|
12
|
+
}
|
|
13
|
+
return lines.join('\n');
|
|
14
|
+
}
|
|
2
15
|
export function createWebSearchTool(search) {
|
|
3
16
|
return defineTool({
|
|
4
17
|
name: 'web_search',
|
|
@@ -21,7 +34,7 @@ export function createWebSearchTool(search) {
|
|
|
21
34
|
},
|
|
22
35
|
output: {
|
|
23
36
|
schema: { type: 'json' },
|
|
24
|
-
render: (_args, value) => [{ type: 'text', text:
|
|
37
|
+
render: (_args, value) => [{ type: 'text', text: renderSearchResult(value) }]
|
|
25
38
|
},
|
|
26
39
|
timeoutMs: 35_000,
|
|
27
40
|
async execute(args, exec) {
|