mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-02-26 07:56:34 +08:00
plugin(tool): 新增morning-news tool
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
## 插件描述
|
||||
一个能让chatgpt联网,搜索,数字运算的插件,将赋予强大且丰富的扩展能力
|
||||
使用该插件需在触发机器人回复条件时,在对话内容前加$tool
|
||||
使用该插件需在机器人回复你的前提下,在对话内容前加$tool;仅输入$tool将返回tool插件帮助信息,用于测试插件是否加载成功
|
||||
### 本插件所有工具同步存放至专用仓库:[chatgpt-tool-hub](https://github.com/goldfishh/chatgpt-tool-hub)
|
||||
|
||||
|
||||
@@ -9,15 +9,19 @@
|
||||
### 1. python
|
||||
###### python解释器,使用它来解释执行python指令,可以配合你想要chatgpt生成的代码输出结果或执行事务
|
||||
|
||||
### 2. requests
|
||||
### 2. url-get
|
||||
###### 往往用来获取某个网站具体内容,结果可能会被反爬策略影响
|
||||
|
||||
### 3. terminal
|
||||
###### 在你运行的电脑里执行shell命令,可以配合你想要chatgpt生成的代码使用,给予自然语言控制手段
|
||||
|
||||
> terminal调优记录:https://github.com/zhayujie/chatgpt-on-wechat/issues/776#issue-1659347640
|
||||
|
||||
### 4. meteo-weather
|
||||
###### 回答你有关天气的询问, 需要获取时间、地点上下文信息,本工具使用了[meteo open api](https://open-meteo.com/)
|
||||
注:该工具需提供时间,地点信息,获取的数据不保证准确性
|
||||
注:该工具需要较高的对话技巧,不保证你问的任何问题均能得到满意的回复
|
||||
|
||||
> meteo调优记录:https://github.com/zhayujie/chatgpt-on-wechat/issues/776#issuecomment-1500771334
|
||||
|
||||
## 使用本插件对话(prompt)技巧
|
||||
### 1. 有指引的询问
|
||||
@@ -37,12 +41,20 @@
|
||||
### 6. news *
|
||||
###### 从全球 80,000 多个信息源中获取当前和历史新闻文章
|
||||
|
||||
### 7. bing-search *
|
||||
### 7. morning-news *
|
||||
###### 每日60秒早报,每天凌晨一点更新,本工具使用了[alapi-每日60秒早报](https://alapi.cn/api/view/93)
|
||||
|
||||
> 该tool每天返回内容相同
|
||||
|
||||
### 8. bing-search *
|
||||
###### bing搜索引擎,从此你不用再烦恼搜索要用哪些关键词
|
||||
|
||||
### 8. wolfram-alpha *
|
||||
### 9. wolfram-alpha *
|
||||
###### 知识搜索引擎、科学问答系统,常用于专业学科计算
|
||||
|
||||
### 10. google-search *
|
||||
###### google搜索引擎,申请流程较bing-search繁琐
|
||||
|
||||
###### 注1:带*工具需要获取api-key才能使用,部分工具需要外网支持
|
||||
#### [申请方法](https://github.com/goldfishh/chatgpt-tool-hub/blob/master/docs/apply_optional_tool.md)
|
||||
|
||||
@@ -50,17 +62,19 @@
|
||||
###### 默认工具无需配置,其它工具需手动配置,一个例子:
|
||||
```json
|
||||
{
|
||||
"tools": ["wikipedia"],
|
||||
"tools": ["wikipedia"], // 填入你想用到的额外工具名
|
||||
"kwargs": {
|
||||
"top_k_results": 2,
|
||||
"no_default": false,
|
||||
"model_name": "gpt-3.5-turbo"
|
||||
"request_timeout": 60, // openai接口超时时间
|
||||
"no_default": false, // 是否不使用默认的4个工具
|
||||
"OPTIONAL_API_NAME": "OPTIONAL_API_KEY" // 带*工具需要申请api-key,在这里填入,api_name参考前述`申请方法`
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
注:config.json文件非必须,未创建仍可使用本tool
|
||||
- `tools`:本插件初始化时加载的工具, 目前可选集:["wikipedia", "wolfram-alpha", "bing-search", "google-search", "news"],其中后4个工具需要申请服务api
|
||||
- `kwargs`:工具执行时的配置,一般在这里存放api-key,或环境配置
|
||||
注:config.json文件非必须,未创建仍可使用本tool;带*工具需在kwargs填入对应api-key键值对
|
||||
- `tools`:本插件初始化时加载的工具, 目前可选集:["wikipedia", "wolfram-alpha", "bing-search", "google-search", "news", "morning-news"] & 默认工具,除wikipedia工具之外均需要申请api-key
|
||||
- `kwargs`:工具执行时的配置,一般在这里存放**api-key**,或环境配置
|
||||
- `request_timeout`: 访问openai接口的超时时间,默认与wechat-on-chatgpt配置一致,可单独配置
|
||||
- `no_default`: 用于配置默认加载4个工具的行为,如果为true则仅使用tools列表工具,不加载默认工具
|
||||
- `top_k_results`: 控制所有有关搜索的工具返回条目数,数字越高则参考信息越多,但无用信息可能干扰判断,该值一般为2
|
||||
- `model_name`: 用于控制tool插件底层使用的llm模型,目前暂未测试3.5以外的模型,一般保持默认
|
||||
@@ -69,4 +83,6 @@
|
||||
## 备注
|
||||
- 强烈建议申请搜索工具搭配使用,推荐bing-search
|
||||
- 虽然我会有意加入一些限制,但请不要使用本插件做危害他人的事情,请提前了解清楚某些内容是否会违反相关规定,建议提前做好过滤
|
||||
- 未来一段时间我会实现一些有意思的工具,比如stable diffusion 中文prompt翻译、cv方向的模型推理,欢迎有想法的朋友关注,一起扩展这个项目
|
||||
- 如有本插件问题,请将debug设置为true无上下文重新问一遍,如仍有问题请访问[chatgpt-tool-hub](https://github.com/goldfishh/chatgpt-tool-hub)建个issue,将日志贴进去,我无法处理不能复现的问题
|
||||
- 欢迎 star & 宣传,有能力请提pr
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"tools": ["python", "requests", "terminal", "meteo-weather"],
|
||||
"tools": ["python", "url-get", "terminal", "meteo-weather"],
|
||||
"kwargs": {
|
||||
"top_k_results": 2,
|
||||
"no_default": false,
|
||||
|
||||
@@ -121,6 +121,7 @@ class Tool(Plugin):
|
||||
return {
|
||||
"openai_api_key": conf().get("open_ai_api_key", ""),
|
||||
"proxy": conf().get("proxy", ""),
|
||||
"request_timeout": conf().get("request_timeout", 60),
|
||||
# note: 目前tool暂未对其他模型测试,但这里仍对配置来源做了优先级区分,一般插件配置可覆盖全局配置
|
||||
"model_name": tool_model_name if tool_model_name else conf().get("model", "gpt-3.5-turbo"),
|
||||
"no_default": kwargs.get("no_default", False),
|
||||
@@ -136,6 +137,12 @@ class Tool(Plugin):
|
||||
"searx_host": kwargs.get("searx_host", ""),
|
||||
# for wolfram-alpha tool
|
||||
"wolfram_alpha_appid": kwargs.get("wolfram_alpha_appid", ""),
|
||||
# for morning-news tool
|
||||
"zaobao_api_key": kwargs.get("zaobao_api_key", ""),
|
||||
# for visual_dl tool
|
||||
"cuda_device": kwargs.get("cuda_device", "cpu"),
|
||||
# for browser tool
|
||||
"phantomjs_exec_path": kwargs.get("phantomjs_exec_path", ""),
|
||||
}
|
||||
|
||||
def _filter_tool_list(self, tool_list: list):
|
||||
|
||||
@@ -21,4 +21,4 @@ web.py
|
||||
|
||||
# chatgpt-tool-hub plugin
|
||||
--extra-index-url https://pypi.python.org/simple
|
||||
chatgpt_tool_hub>=0.3.7
|
||||
chatgpt_tool_hub>=0.3.9
|
||||
Reference in New Issue
Block a user