fix docs, break context

This commit is contained in:
goldfishh
2023-04-01 01:32:03 +08:00
parent f49806558e
commit 71d288f550
2 changed files with 21 additions and 19 deletions

View File

@@ -7,19 +7,19 @@
## 使用说明
使用该插件后将默认使用4个工具, 无需额外配置长期生效:
### 1. python_repl
###### python解释器使用它来解释执行python指令
###### python解释器使用它来解释执行python指令可以配合你想要chatgpt生成的代码输出结果或执行事务
### 2. requests
###### 往往用来获取某个网站具体内容
###### 往往用来获取某个网站具体内容,结果可能会被反爬策略影响
### 3. terminal
###### 在你运行的电脑里执行shell命令
###### 在你运行的电脑里执行shell命令可以配合你想要chatgpt生成的代码使用给予自然语言控制手段
### 4. meteo-weather
###### 回答你有关天气的询问, 本工具使用了[meteo open api](https://open-meteo.com/)
注:该工具需提供时间,地点信息,获取的数据不一定准确
###### 回答你有关天气的询问, 需要获取时间、地点上下文信息,本工具使用了[meteo open api](https://open-meteo.com/)
注:该工具需提供时间,地点信息,获取的数据不保证准确
## 使用本工具对话prompt技巧
## 使用本插件对话prompt技巧
### 1. 有指引的询问
#### 例如:
- 总结这个链接的内容 https://www.36kr.com/p/2186160784654466
@@ -27,16 +27,18 @@
- 使用python查询今天日期
### 2. 使用搜索引擎工具
- 如果有搜索工具就能让chatgpt获取到你的未传达清楚的上下文信息chatgpt不知道你的地理位置现在时间等所以不可能给你正确回答
- 如果有搜索工具就能让chatgpt获取到你的未传达清楚的上下文信息比如chatgpt不知道你的地理位置现在时间等所以无法查询到天气
## 其他工具
###### 除上述以外还有其他工具,比如搜索联网、数学运算、百科、新闻需要获取api-key,
###### 由于这些工具使用方法暂时还在整理中,如果你不熟悉请不要尝试使用这些工具
###### 除上述以外还有其他工具比如搜索联网、数学运算、新闻需要获取api-key,
###### 由于这些工具使用方法暂时还在整理中,如果你不熟悉请不要尝试使用这些工具
### 5. wikipedia
###### 可以回答你想要知道确切的人事物
## config.json 配置说明
###### 一个例子
###### 默认工具无需配置,其它工具需手动配置,一个例子
```json
{
"tools": ["wikipedia"],
@@ -45,9 +47,9 @@
}
}
```
不创建该文件也能使用本tool
config.json文件非必须未创建仍能使用本tool
- `tools`:本插件初始化时加载的工具, 目前可选集:["wikipedia", "wolfram-alpha", "google-search", "news-api"]
- `kwargs`工具执行时的配置一般在这里存放api-key
- `kwargs`工具执行时的配置一般在这里存放api-key,或搜索引擎等输出的条数
## 备注

View File

@@ -14,7 +14,7 @@ from config import conf
from plugins import *
@plugins.register(name="tool", desc="Arming your ChatGPT bot with various tools", version="0.2", author="goldfishh", desire_priority=0)
@plugins.register(name="tool", desc="Arming your ChatGPT bot with various tools", version="0.3", author="goldfishh", desire_priority=0)
class Tool(Plugin):
def __init__(self):
super().__init__()
@@ -67,8 +67,8 @@ class Tool(Plugin):
return
elif content_list[1].startswith("reset"):
logger.debug("[tool]: remind")
reply.content = "请你随机用一种聊天风格提醒用户如果想重置tool插件reset之后不要加任何字符"
e_context['reply'] = reply
e_context['context'].content = "请你随机用一种聊天风格提醒用户如果想重置tool插件reset之后不要加任何字符"
e_context.action = EventAction.BREAK
return
@@ -88,9 +88,9 @@ class Tool(Plugin):
logger.exception(e)
logger.error(str(e))
e_context['context'].content = "这个问题tool插件暂时无法处理"
e_context['context'].content = "请你随机用一种聊天风格,提醒用户:这个问题tool插件暂时无法处理"
reply.type = ReplyType.ERROR
e_context.action = EventAction.CONTINUE
e_context.action = EventAction.BREAK
return
reply.content = _reply