plugin(tool) add a config.json template and fix something

This commit is contained in:
goldfishh
2023-04-02 22:33:31 +08:00
parent 71d288f550
commit 7835379f8f
4 changed files with 20 additions and 9 deletions

View File

@@ -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列表工具
## 备注

View 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"
}
}

View File

@@ -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))

View File

@@ -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