nonebot-plugin-aigf-master 2.0.0b3__tar.gz → 2.0.0b4__tar.gz
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.
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/PKG-INFO +14 -8
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/README.md +13 -7
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/__init__.py +5 -1
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/config.py +3 -2
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/search_client.py +58 -1
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master.egg-info/PKG-INFO +14 -8
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/pyproject.toml +1 -1
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/LICENSE +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/anime_recognizer.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/animetrace_client.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/api_hooks.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/cache_cleanup.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/command_learner.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/context_bus.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/image_gen_client.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/image_handler.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/llm_client.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/meme_store.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/memory_store.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/models.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/notice.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/peer_client.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/plugin_discovery.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/plugin_invoker.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/preset_store.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/processor.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/prompt_builder.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/response_parser.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/session.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/unimsg.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master/vlm_client.py +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master.egg-info/SOURCES.txt +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master.egg-info/dependency_links.txt +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master.egg-info/requires.txt +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/nonebot_plugin_aigf_master.egg-info/top_level.txt +0 -0
- {nonebot_plugin_aigf_master-2.0.0b3 → nonebot_plugin_aigf_master-2.0.0b4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nonebot-plugin-aigf-master
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b4
|
|
4
4
|
Summary: 群聊特化LLM聊天机器人(增强版),具有记忆、表情包、跨插件调用、跨bot通信与跨适配器支持
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Requires-Python: <4.0,>=3.10
|
|
@@ -55,7 +55,7 @@ Dynamic: license-file
|
|
|
55
55
|
- 🧠 **LLM 命令学习**:通过观察群聊自动学习命令用法,支持学习、编辑、删除
|
|
56
56
|
- 🌐 **跨 bot 通信**:通过 HTTP 获取其它 bot(同一 QQ 号下)的插件输出,并可远程调用其命令
|
|
57
57
|
- 🖼️ **表情包功能**:AI 自主决定发表情包;自动从群聊中收藏
|
|
58
|
-
- 🔍 **联网搜索**:支持 Tavily / Bocha / Bing,自动搜索不懂的梗和网络用语
|
|
58
|
+
- 🔍 **联网搜索**:支持 Tavily / Bocha / Bing / DeepSeek / 本地 open-websearch,自动搜索不懂的梗和网络用语
|
|
59
59
|
- 🧠 **四层记忆系统**:短期记忆、长期记忆、群友信息、文化记忆,LLM 自主管理
|
|
60
60
|
- 🎨 **AI 生图**:LLM可调用生图模型生成图片发到群里,尺寸由 LLM 决定(程序限最大尺寸),支持参考图改绘(回复图片消息或从聊天记录选图)
|
|
61
61
|
|
|
@@ -80,9 +80,9 @@ Dynamic: license-file
|
|
|
80
80
|
>
|
|
81
81
|
> 从 2.0 起插件还依赖 `nonebot-plugin-alconna` 与 `nonebot-plugin-uninfo`(跨适配器收发与会话/成员信息),用下面的方式安装时会自动装上。
|
|
82
82
|
|
|
83
|
-
### 安装 beta 版本(2.0.
|
|
83
|
+
### 安装 beta 版本(2.0.0b4)
|
|
84
84
|
|
|
85
|
-
`2.0.
|
|
85
|
+
`2.0.0b4` 是**预发布(pre-release)版本**,因此:
|
|
86
86
|
|
|
87
87
|
- `pip install nonebot-plugin-aigf-master` 装的仍是稳定版 **1.6.x**
|
|
88
88
|
- `nb plugin install nonebot-plugin-aigf-master` 同样只装稳定版,而且 nb-cli **不支持指定版本**,所以 beta 只能用 pip 装
|
|
@@ -90,7 +90,7 @@ Dynamic: license-file
|
|
|
90
90
|
要装 beta,**必须显式写出版本号**:
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
pip install nonebot-plugin-aigf-master==2.0.
|
|
93
|
+
pip install nonebot-plugin-aigf-master==2.0.0b4
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
在 `pyproject.toml` 中添加:
|
|
@@ -158,10 +158,11 @@ AIGFM_ENERGY_BASELINE=0.7 # 社交能量基线(默认 0.7,范
|
|
|
158
158
|
|
|
159
159
|
# --- 联网搜索 ---
|
|
160
160
|
AIGFM_SEARCH_ENABLED=false # 是否启用联网搜索(默认 false)
|
|
161
|
-
AIGFM_SEARCH_API=tavily # 搜索API: tavily / bocha / bing / openwebsearch(默认 tavily)
|
|
162
|
-
AIGFM_SEARCH_API_KEY="xxx" # 搜索 API Key(api=tavily/bocha/bing
|
|
161
|
+
AIGFM_SEARCH_API=tavily # 搜索API: tavily / bocha / bing / openwebsearch / deepseek(默认 tavily)
|
|
162
|
+
AIGFM_SEARCH_API_KEY="xxx" # 搜索 API Key(api=tavily/bocha/bing 时必填;deepseek 留空则沿用 LLM Key)
|
|
163
163
|
AIGFM_SEARCH_MAX_RESULTS=3 # 最大搜索结果数(默认 3)
|
|
164
164
|
AIGFM_OPENWEBSEARCH_URL="" # open-websearch 本地服务地址(api=openwebsearch 时必填,如 http://127.0.0.1:3210)
|
|
165
|
+
AIGFM_SEARCH_BASE_URL="" # 搜索 API 根地址(api=deepseek 时用,留空则用官方 https://api.deepseek.com)
|
|
165
166
|
|
|
166
167
|
# --- 代理 ---
|
|
167
168
|
AIGFM_PROXY_ENABLED=false # 是否启用代理(默认 false)
|
|
@@ -274,7 +275,11 @@ AIGFM_PEER_CAPTURE_PLUGINS=[] # 要捕获输出的插件名列表,为
|
|
|
274
275
|
| YunHu | ✅ | ✅ | ✅ | 未测 | ⚠️ | ✅ | ✅ | ✅ | ✅ |
|
|
275
276
|
| bilibili Live | ✅ | ✅ | ✅ | ❌ 无好友私聊类型 | ⚠️ | ✅ | ✅ | ⚠️ | ✅ |
|
|
276
277
|
|
|
277
|
-
|
|
278
|
+
**图例:**
|
|
279
|
+
- **✅ 已实测通过**
|
|
280
|
+
- **⚠️ 已实现但未验证通过**(离线构造不出该适配器的事件,或需要真实 API / 真机)
|
|
281
|
+
- **❌ 该适配器没有这类事件,或库层无法把该通知定位到群/频道会话(通知会被跳过)**
|
|
282
|
+
- **未测** 本次未构造该场景。
|
|
278
283
|
|
|
279
284
|
**已知特例**
|
|
280
285
|
|
|
@@ -559,6 +564,7 @@ LLM 可以:
|
|
|
559
564
|
| `bocha` | 国产 AI 搜索 API,中文搜索效果好 | 无 | https://open.bochaai.com |
|
|
560
565
|
| `bing` | 微软必应搜索(Azure Bing Search API v7) | 无 | https://portal.azure.com |
|
|
561
566
|
| `openwebsearch` | 本地 Node.js 搜索服务,聚合多引擎(bing/baidu/duckduckgo 等) | 需先启动 daemon:`cd open-webSearch && npm install && npm run serve`,配置 `AIGFM_OPENWEBSEARCH_URL` | 无需 Key,项目:https://github.com/Aas-ee/open-webSearch |
|
|
567
|
+
| `deepseek` | DeepSeek 自带联网搜索,摘要写得很适合喂给模型 | 无(`AIGFM_SEARCH_API_KEY` 留空则沿用 LLM Key) | https://platform.deepseek.com |
|
|
562
568
|
|
|
563
569
|
> **Tavily** 需额外安装依赖:`pip install tavily-python`(或安装本插件时带上 extra:`pip install "nonebot-plugin-aigf-master[tavily]"`)
|
|
564
570
|
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
- 🧠 **LLM 命令学习**:通过观察群聊自动学习命令用法,支持学习、编辑、删除
|
|
34
34
|
- 🌐 **跨 bot 通信**:通过 HTTP 获取其它 bot(同一 QQ 号下)的插件输出,并可远程调用其命令
|
|
35
35
|
- 🖼️ **表情包功能**:AI 自主决定发表情包;自动从群聊中收藏
|
|
36
|
-
- 🔍 **联网搜索**:支持 Tavily / Bocha / Bing,自动搜索不懂的梗和网络用语
|
|
36
|
+
- 🔍 **联网搜索**:支持 Tavily / Bocha / Bing / DeepSeek / 本地 open-websearch,自动搜索不懂的梗和网络用语
|
|
37
37
|
- 🧠 **四层记忆系统**:短期记忆、长期记忆、群友信息、文化记忆,LLM 自主管理
|
|
38
38
|
- 🎨 **AI 生图**:LLM可调用生图模型生成图片发到群里,尺寸由 LLM 决定(程序限最大尺寸),支持参考图改绘(回复图片消息或从聊天记录选图)
|
|
39
39
|
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
>
|
|
59
59
|
> 从 2.0 起插件还依赖 `nonebot-plugin-alconna` 与 `nonebot-plugin-uninfo`(跨适配器收发与会话/成员信息),用下面的方式安装时会自动装上。
|
|
60
60
|
|
|
61
|
-
### 安装 beta 版本(2.0.
|
|
61
|
+
### 安装 beta 版本(2.0.0b4)
|
|
62
62
|
|
|
63
|
-
`2.0.
|
|
63
|
+
`2.0.0b4` 是**预发布(pre-release)版本**,因此:
|
|
64
64
|
|
|
65
65
|
- `pip install nonebot-plugin-aigf-master` 装的仍是稳定版 **1.6.x**
|
|
66
66
|
- `nb plugin install nonebot-plugin-aigf-master` 同样只装稳定版,而且 nb-cli **不支持指定版本**,所以 beta 只能用 pip 装
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
要装 beta,**必须显式写出版本号**:
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
|
-
pip install nonebot-plugin-aigf-master==2.0.
|
|
71
|
+
pip install nonebot-plugin-aigf-master==2.0.0b4
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
在 `pyproject.toml` 中添加:
|
|
@@ -136,10 +136,11 @@ AIGFM_ENERGY_BASELINE=0.7 # 社交能量基线(默认 0.7,范
|
|
|
136
136
|
|
|
137
137
|
# --- 联网搜索 ---
|
|
138
138
|
AIGFM_SEARCH_ENABLED=false # 是否启用联网搜索(默认 false)
|
|
139
|
-
AIGFM_SEARCH_API=tavily # 搜索API: tavily / bocha / bing / openwebsearch(默认 tavily)
|
|
140
|
-
AIGFM_SEARCH_API_KEY="xxx" # 搜索 API Key(api=tavily/bocha/bing
|
|
139
|
+
AIGFM_SEARCH_API=tavily # 搜索API: tavily / bocha / bing / openwebsearch / deepseek(默认 tavily)
|
|
140
|
+
AIGFM_SEARCH_API_KEY="xxx" # 搜索 API Key(api=tavily/bocha/bing 时必填;deepseek 留空则沿用 LLM Key)
|
|
141
141
|
AIGFM_SEARCH_MAX_RESULTS=3 # 最大搜索结果数(默认 3)
|
|
142
142
|
AIGFM_OPENWEBSEARCH_URL="" # open-websearch 本地服务地址(api=openwebsearch 时必填,如 http://127.0.0.1:3210)
|
|
143
|
+
AIGFM_SEARCH_BASE_URL="" # 搜索 API 根地址(api=deepseek 时用,留空则用官方 https://api.deepseek.com)
|
|
143
144
|
|
|
144
145
|
# --- 代理 ---
|
|
145
146
|
AIGFM_PROXY_ENABLED=false # 是否启用代理(默认 false)
|
|
@@ -252,7 +253,11 @@ AIGFM_PEER_CAPTURE_PLUGINS=[] # 要捕获输出的插件名列表,为
|
|
|
252
253
|
| YunHu | ✅ | ✅ | ✅ | 未测 | ⚠️ | ✅ | ✅ | ✅ | ✅ |
|
|
253
254
|
| bilibili Live | ✅ | ✅ | ✅ | ❌ 无好友私聊类型 | ⚠️ | ✅ | ✅ | ⚠️ | ✅ |
|
|
254
255
|
|
|
255
|
-
|
|
256
|
+
**图例:**
|
|
257
|
+
- **✅ 已实测通过**
|
|
258
|
+
- **⚠️ 已实现但未验证通过**(离线构造不出该适配器的事件,或需要真实 API / 真机)
|
|
259
|
+
- **❌ 该适配器没有这类事件,或库层无法把该通知定位到群/频道会话(通知会被跳过)**
|
|
260
|
+
- **未测** 本次未构造该场景。
|
|
256
261
|
|
|
257
262
|
**已知特例**
|
|
258
263
|
|
|
@@ -537,6 +542,7 @@ LLM 可以:
|
|
|
537
542
|
| `bocha` | 国产 AI 搜索 API,中文搜索效果好 | 无 | https://open.bochaai.com |
|
|
538
543
|
| `bing` | 微软必应搜索(Azure Bing Search API v7) | 无 | https://portal.azure.com |
|
|
539
544
|
| `openwebsearch` | 本地 Node.js 搜索服务,聚合多引擎(bing/baidu/duckduckgo 等) | 需先启动 daemon:`cd open-webSearch && npm install && npm run serve`,配置 `AIGFM_OPENWEBSEARCH_URL` | 无需 Key,项目:https://github.com/Aas-ee/open-webSearch |
|
|
545
|
+
| `deepseek` | DeepSeek 自带联网搜索,摘要写得很适合喂给模型 | 无(`AIGFM_SEARCH_API_KEY` 留空则沿用 LLM Key) | https://platform.deepseek.com |
|
|
540
546
|
|
|
541
547
|
> **Tavily** 需额外安装依赖:`pip install tavily-python`(或安装本插件时带上 extra:`pip install "nonebot-plugin-aigf-master[tavily]"`)
|
|
542
548
|
|
|
@@ -89,8 +89,12 @@ _image_gen = ImageGenClient(
|
|
|
89
89
|
_proxy,
|
|
90
90
|
) if plugin_config.aigfm_image_gen_enabled else None
|
|
91
91
|
_search = create_search_client(
|
|
92
|
-
plugin_config.aigfm_search_api,
|
|
92
|
+
plugin_config.aigfm_search_api,
|
|
93
|
+
# deepseek 的 Key 一般和 LLM 是同一个,没单独配就沿用 LLM Key
|
|
94
|
+
plugin_config.aigfm_search_api_key
|
|
95
|
+
or (plugin_config.aigfm_llm_api_key if plugin_config.aigfm_search_api == "deepseek" else ""),
|
|
93
96
|
plugin_config.aigfm_openwebsearch_url,
|
|
97
|
+
plugin_config.aigfm_search_base_url,
|
|
94
98
|
) if plugin_config.aigfm_search_enabled else None
|
|
95
99
|
_peer_client = PeerClient(plugin_config.aigfm_peer_bots) if plugin_config.aigfm_peer_bots else None
|
|
96
100
|
|
|
@@ -71,10 +71,11 @@ class PluginConfig(BaseModel):
|
|
|
71
71
|
|
|
72
72
|
# 搜索
|
|
73
73
|
aigfm_search_enabled: bool = Field(False, description="是否启用联网搜索")
|
|
74
|
-
aigfm_search_api: Literal["tavily", "bocha", "bing", "openwebsearch"] = Field("tavily", description="搜索 API")
|
|
75
|
-
aigfm_search_api_key: str = Field("", description="搜索 API Key(tavily/bocha/bing
|
|
74
|
+
aigfm_search_api: Literal["tavily", "bocha", "bing", "openwebsearch", "deepseek"] = Field("tavily", description="搜索 API")
|
|
75
|
+
aigfm_search_api_key: str = Field("", description="搜索 API Key(tavily/bocha/bing 必填;deepseek 留空则用 LLM Key)")
|
|
76
76
|
aigfm_search_max_results: int = Field(3, description="最大搜索结果数")
|
|
77
77
|
aigfm_openwebsearch_url: str = Field("", description="open-websearch 本地服务地址(如 http://127.0.0.1:3210)")
|
|
78
|
+
aigfm_search_base_url: str = Field("", description="搜索 API 根地址(deepseek 用,留空则用官方 https://api.deepseek.com)")
|
|
78
79
|
|
|
79
80
|
# 代理
|
|
80
81
|
aigfm_proxy_enabled: bool = Field(False, description="是否启用代理")
|
|
@@ -112,7 +112,62 @@ class OpenWebSearchClient(SearchClient):
|
|
|
112
112
|
return []
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
class DeepSeekSearchClient(SearchClient):
|
|
116
|
+
"""DeepSeek 联网搜索(POST {base}/v1/tools/search)
|
|
117
|
+
|
|
118
|
+
文档:https://api-docs.deepseek.com/zh-cn/api/search
|
|
119
|
+
- 按**成功请求次数**计费(不按 token、不按条数),`results` 为空数组不算成功、不计费
|
|
120
|
+
- `summary` 是给模型看的长摘要,`snippet` 是短摘要;`content` 只有传 `need_content`
|
|
121
|
+
才会带网页正文(默认不带,省掉额外抓取)
|
|
122
|
+
- QPS 100;401 = Key 无效,402 = 余额不足
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
def __init__(self, api_key: str, base_url: str = ""):
|
|
126
|
+
self._api_key = api_key
|
|
127
|
+
self._base_url = (base_url or "https://api.deepseek.com").rstrip("/")
|
|
128
|
+
|
|
129
|
+
async def search(self, query: str, max_results: int = 3) -> list[dict]:
|
|
130
|
+
try:
|
|
131
|
+
headers = {"Authorization": f"Bearer {self._api_key}", "Content-Type": "application/json"}
|
|
132
|
+
# count 取值范围 1-50,越界会被判 400
|
|
133
|
+
payload = {"query": query, "count": max(1, min(int(max_results or 1), 50))}
|
|
134
|
+
async with httpx.AsyncClient(timeout=15.0) as client:
|
|
135
|
+
resp = await client.post(f"{self._base_url}/v1/tools/search", headers=headers, json=payload)
|
|
136
|
+
if resp.status_code != 200:
|
|
137
|
+
self._log_failure(resp)
|
|
138
|
+
return []
|
|
139
|
+
data = resp.json()
|
|
140
|
+
results = []
|
|
141
|
+
for r in data.get("results", []):
|
|
142
|
+
content = (r.get("summary") or r.get("snippet") or "").strip()
|
|
143
|
+
results.append({"title": r.get("title", ""), "content": content, "url": r.get("url", "")})
|
|
144
|
+
return results
|
|
145
|
+
except Exception as e:
|
|
146
|
+
logger.error(f"[搜索] DeepSeek 失败: {e}")
|
|
147
|
+
return []
|
|
148
|
+
|
|
149
|
+
def _log_failure(self, resp):
|
|
150
|
+
"""DeepSeek 的错误体是 OpenAI 兼容格式,挑出人能看懂的说明"""
|
|
151
|
+
try:
|
|
152
|
+
err = (resp.json() or {}).get("error", {}) or {}
|
|
153
|
+
msg = err.get("message") or ""
|
|
154
|
+
except Exception:
|
|
155
|
+
msg = ""
|
|
156
|
+
hint = {
|
|
157
|
+
400: "请求参数不合法",
|
|
158
|
+
401: "API Key 无效",
|
|
159
|
+
402: "余额不足",
|
|
160
|
+
429: "触发 QPS 限制",
|
|
161
|
+
500: "服务端错误",
|
|
162
|
+
504: "下游超时",
|
|
163
|
+
}.get(resp.status_code, "")
|
|
164
|
+
logger.error(f"[搜索] DeepSeek 失败: HTTP {resp.status_code}"
|
|
165
|
+
+ (f"({hint})" if hint else "")
|
|
166
|
+
+ (f" {msg}" if msg else ""))
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def create_search_client(api: str, api_key: str, base_url: str = "",
|
|
170
|
+
api_base_url: str = "") -> SearchClient | None:
|
|
116
171
|
api = api.lower()
|
|
117
172
|
if api == "tavily":
|
|
118
173
|
return TavilySearchClient(api_key) if api_key else None
|
|
@@ -122,4 +177,6 @@ def create_search_client(api: str, api_key: str, base_url: str = "") -> SearchCl
|
|
|
122
177
|
return BingSearchClient(api_key) if api_key else None
|
|
123
178
|
elif api == "openwebsearch":
|
|
124
179
|
return OpenWebSearchClient(base_url) if base_url else None
|
|
180
|
+
elif api == "deepseek":
|
|
181
|
+
return DeepSeekSearchClient(api_key, api_base_url) if api_key else None
|
|
125
182
|
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nonebot-plugin-aigf-master
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b4
|
|
4
4
|
Summary: 群聊特化LLM聊天机器人(增强版),具有记忆、表情包、跨插件调用、跨bot通信与跨适配器支持
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Requires-Python: <4.0,>=3.10
|
|
@@ -55,7 +55,7 @@ Dynamic: license-file
|
|
|
55
55
|
- 🧠 **LLM 命令学习**:通过观察群聊自动学习命令用法,支持学习、编辑、删除
|
|
56
56
|
- 🌐 **跨 bot 通信**:通过 HTTP 获取其它 bot(同一 QQ 号下)的插件输出,并可远程调用其命令
|
|
57
57
|
- 🖼️ **表情包功能**:AI 自主决定发表情包;自动从群聊中收藏
|
|
58
|
-
- 🔍 **联网搜索**:支持 Tavily / Bocha / Bing,自动搜索不懂的梗和网络用语
|
|
58
|
+
- 🔍 **联网搜索**:支持 Tavily / Bocha / Bing / DeepSeek / 本地 open-websearch,自动搜索不懂的梗和网络用语
|
|
59
59
|
- 🧠 **四层记忆系统**:短期记忆、长期记忆、群友信息、文化记忆,LLM 自主管理
|
|
60
60
|
- 🎨 **AI 生图**:LLM可调用生图模型生成图片发到群里,尺寸由 LLM 决定(程序限最大尺寸),支持参考图改绘(回复图片消息或从聊天记录选图)
|
|
61
61
|
|
|
@@ -80,9 +80,9 @@ Dynamic: license-file
|
|
|
80
80
|
>
|
|
81
81
|
> 从 2.0 起插件还依赖 `nonebot-plugin-alconna` 与 `nonebot-plugin-uninfo`(跨适配器收发与会话/成员信息),用下面的方式安装时会自动装上。
|
|
82
82
|
|
|
83
|
-
### 安装 beta 版本(2.0.
|
|
83
|
+
### 安装 beta 版本(2.0.0b4)
|
|
84
84
|
|
|
85
|
-
`2.0.
|
|
85
|
+
`2.0.0b4` 是**预发布(pre-release)版本**,因此:
|
|
86
86
|
|
|
87
87
|
- `pip install nonebot-plugin-aigf-master` 装的仍是稳定版 **1.6.x**
|
|
88
88
|
- `nb plugin install nonebot-plugin-aigf-master` 同样只装稳定版,而且 nb-cli **不支持指定版本**,所以 beta 只能用 pip 装
|
|
@@ -90,7 +90,7 @@ Dynamic: license-file
|
|
|
90
90
|
要装 beta,**必须显式写出版本号**:
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
pip install nonebot-plugin-aigf-master==2.0.
|
|
93
|
+
pip install nonebot-plugin-aigf-master==2.0.0b4
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
在 `pyproject.toml` 中添加:
|
|
@@ -158,10 +158,11 @@ AIGFM_ENERGY_BASELINE=0.7 # 社交能量基线(默认 0.7,范
|
|
|
158
158
|
|
|
159
159
|
# --- 联网搜索 ---
|
|
160
160
|
AIGFM_SEARCH_ENABLED=false # 是否启用联网搜索(默认 false)
|
|
161
|
-
AIGFM_SEARCH_API=tavily # 搜索API: tavily / bocha / bing / openwebsearch(默认 tavily)
|
|
162
|
-
AIGFM_SEARCH_API_KEY="xxx" # 搜索 API Key(api=tavily/bocha/bing
|
|
161
|
+
AIGFM_SEARCH_API=tavily # 搜索API: tavily / bocha / bing / openwebsearch / deepseek(默认 tavily)
|
|
162
|
+
AIGFM_SEARCH_API_KEY="xxx" # 搜索 API Key(api=tavily/bocha/bing 时必填;deepseek 留空则沿用 LLM Key)
|
|
163
163
|
AIGFM_SEARCH_MAX_RESULTS=3 # 最大搜索结果数(默认 3)
|
|
164
164
|
AIGFM_OPENWEBSEARCH_URL="" # open-websearch 本地服务地址(api=openwebsearch 时必填,如 http://127.0.0.1:3210)
|
|
165
|
+
AIGFM_SEARCH_BASE_URL="" # 搜索 API 根地址(api=deepseek 时用,留空则用官方 https://api.deepseek.com)
|
|
165
166
|
|
|
166
167
|
# --- 代理 ---
|
|
167
168
|
AIGFM_PROXY_ENABLED=false # 是否启用代理(默认 false)
|
|
@@ -274,7 +275,11 @@ AIGFM_PEER_CAPTURE_PLUGINS=[] # 要捕获输出的插件名列表,为
|
|
|
274
275
|
| YunHu | ✅ | ✅ | ✅ | 未测 | ⚠️ | ✅ | ✅ | ✅ | ✅ |
|
|
275
276
|
| bilibili Live | ✅ | ✅ | ✅ | ❌ 无好友私聊类型 | ⚠️ | ✅ | ✅ | ⚠️ | ✅ |
|
|
276
277
|
|
|
277
|
-
|
|
278
|
+
**图例:**
|
|
279
|
+
- **✅ 已实测通过**
|
|
280
|
+
- **⚠️ 已实现但未验证通过**(离线构造不出该适配器的事件,或需要真实 API / 真机)
|
|
281
|
+
- **❌ 该适配器没有这类事件,或库层无法把该通知定位到群/频道会话(通知会被跳过)**
|
|
282
|
+
- **未测** 本次未构造该场景。
|
|
278
283
|
|
|
279
284
|
**已知特例**
|
|
280
285
|
|
|
@@ -559,6 +564,7 @@ LLM 可以:
|
|
|
559
564
|
| `bocha` | 国产 AI 搜索 API,中文搜索效果好 | 无 | https://open.bochaai.com |
|
|
560
565
|
| `bing` | 微软必应搜索(Azure Bing Search API v7) | 无 | https://portal.azure.com |
|
|
561
566
|
| `openwebsearch` | 本地 Node.js 搜索服务,聚合多引擎(bing/baidu/duckduckgo 等) | 需先启动 daemon:`cd open-webSearch && npm install && npm run serve`,配置 `AIGFM_OPENWEBSEARCH_URL` | 无需 Key,项目:https://github.com/Aas-ee/open-webSearch |
|
|
567
|
+
| `deepseek` | DeepSeek 自带联网搜索,摘要写得很适合喂给模型 | 无(`AIGFM_SEARCH_API_KEY` 留空则沿用 LLM Key) | https://platform.deepseek.com |
|
|
562
568
|
|
|
563
569
|
> **Tavily** 需额外安装依赖:`pip install tavily-python`(或安装本插件时带上 extra:`pip install "nonebot-plugin-aigf-master[tavily]"`)
|
|
564
570
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|