mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-03-06 16:42:09 +08:00
plugin(tool) add a config.json template and fix something
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
## 使用说明
|
||||
使用该插件后将默认使用4个工具, 无需额外配置长期生效:
|
||||
### 1. python_repl
|
||||
### 1. python
|
||||
###### python解释器,使用它来解释执行python指令,可以配合你想要chatgpt生成的代码输出结果或执行事务
|
||||
|
||||
### 2. requests
|
||||
@@ -22,7 +22,7 @@
|
||||
## 使用本插件对话(prompt)技巧
|
||||
### 1. 有指引的询问
|
||||
#### 例如:
|
||||
- 总结这个链接的内容 https://www.36kr.com/p/2186160784654466
|
||||
- 总结这个链接的内容 https://github.com/goldfishh/chatgpt-tool-hub
|
||||
- 使用Terminal执行curl cip.cc
|
||||
- 使用python查询今天日期
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
## 其他工具
|
||||
###### 除上述以外还有其他工具,比如搜索联网、数学运算、新闻需要获取api-key,
|
||||
###### 由于这些工具使用方法暂时还在整理中,如果你不熟悉请不要尝试使用这些工具
|
||||
|
||||
#### [申请方法](https://github.com/goldfishh/chatgpt-tool-hub/blob/master/docs/apply_optional_tool.md)
|
||||
|
||||
### 5. wikipedia
|
||||
###### 可以回答你想要知道确切的人事物
|
||||
|
||||
@@ -43,13 +44,15 @@
|
||||
{
|
||||
"tools": ["wikipedia"],
|
||||
"kwargs": {
|
||||
"top_k_results": 2
|
||||
"top_k_results": 2,
|
||||
"no_default": false,
|
||||
"model_name": "gpt-3.5-turbo"
|
||||
}
|
||||
}
|
||||
```
|
||||
注:config.json文件非必须,未创建仍能使用本tool
|
||||
- `tools`:本插件初始化时加载的工具, 目前可选集:["wikipedia", "wolfram-alpha", "google-search", "news-api"]
|
||||
- `kwargs`:工具执行时的配置,一般在这里存放api-key,或搜索引擎等输出的条数
|
||||
注:config.json文件非必须,未创建仍可使用本tool
|
||||
- `tools`:本插件初始化时加载的工具, 目前可选集:["wikipedia", "wolfram-alpha", "bing-search", "google-search", "news"],其中后4个工具需要申请服务api
|
||||
- `kwargs`:工具执行时的配置,一般在这里存放api-key,或环境配置,no_default用于配置是否默认使用4个工具,如果为false则仅使用tools列表工具
|
||||
|
||||
|
||||
## 备注
|
||||
|
||||
8
plugins/tool/config.json.template
Normal file
8
plugins/tool/config.json.template
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"tools": ["python", "requests", "terminal", "meteo-weather"],
|
||||
"kwargs": {
|
||||
"top_k_results": 2,
|
||||
"no_default": false,
|
||||
"model_name": "gpt-3.5-turbo"
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ class Tool(Plugin):
|
||||
_reply = self.app.ask(query, user_session)
|
||||
e_context.action = EventAction.BREAK_PASS
|
||||
all_sessions.session_reply(_reply, e_context['context']['session_id'])
|
||||
except ValueError as e:
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
logger.error(str(e))
|
||||
|
||||
|
||||
@@ -14,4 +14,4 @@ wechaty_puppet>=0.4.23
|
||||
chardet>=5.1.0
|
||||
SpeechRecognition
|
||||
tiktoken>=0.3.2
|
||||
chatgpt_tool_hub>=0.3.0
|
||||
chatgpt_tool_hub>=0.3.4
|
||||
Reference in New Issue
Block a user