From 546ae24e39a0c37c8d41c825befcf7b1fdd1f318 Mon Sep 17 00:00:00 2001 From: zdongs Date: Thu, 5 Sep 2024 16:17:36 +0800 Subject: [PATCH] Upgrade --- .obsidian/workspace.json | 12 +++++---- ...\242\347\273\204\344\273\266duckduckgo.md" | 27 +++++++++++++++++++ _tabs/about.md | 2 +- _template/tech_note.md | 1 - 4 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 "_posts/engineering/2024-09-05-\345\205\215\350\264\271\344\270\224\347\247\201\345\257\206\347\232\204\350\201\224\347\275\221\346\220\234\347\264\242\347\273\204\344\273\266duckduckgo.md" diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index da97d55..0faa24f 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -13,7 +13,7 @@ "state": { "type": "markdown", "state": { - "file": "_posts/pool/2024-09-04-模板测试.md", + "file": "_template/tech_note.md", "mode": "source", "source": false } @@ -85,7 +85,7 @@ "state": { "type": "backlink", "state": { - "file": "_posts/pool/2024-09-04-模板测试.md", + "file": "_template/tech_note.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -102,7 +102,7 @@ "state": { "type": "outgoing-link", "state": { - "file": "_posts/pool/2024-09-04-模板测试.md", + "file": "_template/tech_note.md", "linksCollapsed": false, "unlinkedCollapsed": true } @@ -125,7 +125,7 @@ "state": { "type": "outline", "state": { - "file": "_posts/pool/2024-09-04-模板测试.md" + "file": "_template/tech_note.md" } } } @@ -148,9 +148,11 @@ }, "active": "f8e8887be817ee17", "lastOpenFiles": [ + "_posts/pool/2024-09-05.md", "_template/tech_note.md", - "_posts/pool/2024-09-04-模板测试.md", "_template/time_note.md", + "_posts/pool/2024-09-04-模板测试.md", + "_posts/engineering/2024-09-05-免费且私密的联网搜索组件duckduckgo.md", "_posts/coding/2024-08-13-数据结构知识池.md", "_posts/coding/2024-08-13-json.dumps输出美化版json.md", "_posts/coding/2024-08-13-chatglm-PPO训练路径探索.md", diff --git "a/_posts/engineering/2024-09-05-\345\205\215\350\264\271\344\270\224\347\247\201\345\257\206\347\232\204\350\201\224\347\275\221\346\220\234\347\264\242\347\273\204\344\273\266duckduckgo.md" "b/_posts/engineering/2024-09-05-\345\205\215\350\264\271\344\270\224\347\247\201\345\257\206\347\232\204\350\201\224\347\275\221\346\220\234\347\264\242\347\273\204\344\273\266duckduckgo.md" new file mode 100644 index 0000000..ff84143 --- /dev/null +++ "b/_posts/engineering/2024-09-05-\345\205\215\350\264\271\344\270\224\347\247\201\345\257\206\347\232\204\350\201\224\347\275\221\346\220\234\347\264\242\347\273\204\344\273\266duckduckgo.md" @@ -0,0 +1,27 @@ +--- +title: 免费且私密的联网搜索组件duckduckgo +author: X +date: 2024-09-05 15:51:05 +0800 +categories: + - engineering + - pool +tags: + - 黑科技 +--- +# 背景 +玩agentscope(开源)的react_agent,试用其service板块的toolkit功能,在其中add一个联网搜索的插件,但其提供的联网插件都需要api-key,就想着用一个免费的。我记得是有一些,但忘了叫什么,一番搜索后最后引入了这个(不是我一开始记忆里的某个s开头的免费api),这准确来说是一个逆向封装后的包(信源:[用duckduckgo的搜索API免费给大模型接入联网功能,让普通模型也能实现类似new bing的效果](https://linux.do/t/topic/122537)),确实比较方便好用,看论坛说对网络有要求(可能是不能没有梯子,这方面没有测试),但个人使用感受是非常舒服快捷的。 + +# 使用方法 +pypi包: +[duckduckgo-search](https://pypi.org/project/duckduckgo-search/#2-text---text-search-by-duckduckgocom) + +github库: +[duckduckgo_search](https://github.com/deedy5/duckduckgo_search) + +目前用的就是`DDGS().text('test', max_results=1)`,返回的格式是: + +``` +[{'title': 'Stardew Valley 中文维基', 'href': 'https://zh.stardewvalleywiki.com/Stardew_Valley_Wiki', 'body': '星露谷物语是一个牧场类的rpg游戏。你继承了爷爷在星露谷的农场,但是你手头上只有最基础的农具和少许的金钱 +,你得靠此开始你的新生活。你能把这片杂草丛生的田地变成一个繁荣的家园吗?这很不容易,自从joja公司来到了小镇 +,以前的生活都变了。'}] +``` \ No newline at end of file diff --git a/_tabs/about.md b/_tabs/about.md index a298fdc..6051766 100644 --- a/_tabs/about.md +++ b/_tabs/about.md @@ -5,5 +5,5 @@ order: 4 --- > XYZ三个好朋友的小领地,目前由X维护,其余人由X邀请加入。 -你来到了没有知识的荒原 {: .prompt-tip } +你来到了没有知识的荒原 diff --git a/_template/tech_note.md b/_template/tech_note.md index c98c846..ed2c467 100644 --- a/_template/tech_note.md +++ b/_template/tech_note.md @@ -5,4 +5,3 @@ date: "{{date}} {{time:HH:mm:ss}} +0800" categories: tags: --- -s \ No newline at end of file