deepfish-ai 2.0.8 → 2.0.11
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.
- package/README.md +6 -4
- package/dist/generate-tool.md +120 -0
- package/dist/index.js +433 -227
- package/dist/serve/pm2-server.js +176 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -161,8 +161,10 @@ ai "我刚问了一个什么问题"
|
|
|
161
161
|
|
|
162
162
|
| 命令 | 说明 |
|
|
163
163
|
| ----------------------- | -------------------------------------------------- |
|
|
164
|
+
| `ai tools ls` | 列出所有工具 |
|
|
164
165
|
| `ai tools dir` | 查看全局工具目录 |
|
|
165
166
|
| `ai tools add <name>` | 添加当前目录下的本地工具目录,可选择本地或全局生效 |
|
|
167
|
+
| `ai tools del <index>` | 按索引删除工具 |
|
|
166
168
|
| `ai tools generate xxx` | 通过 AI 生成工具 |
|
|
167
169
|
|
|
168
170
|
### 会话管理
|
|
@@ -176,10 +178,10 @@ ai "我刚问了一个什么问题"
|
|
|
176
178
|
|
|
177
179
|
| 命令 | 说明 |
|
|
178
180
|
| --------------------- | ------------ |
|
|
179
|
-
| `ai
|
|
180
|
-
| `ai
|
|
181
|
-
| `ai
|
|
182
|
-
| `ai
|
|
181
|
+
| `ai tasks ls` | 列出所有任务 |
|
|
182
|
+
| `ai tasks add <task>` | 添加任务 |
|
|
183
|
+
| `ai tasks del <index>` | 删除指定任务 |
|
|
184
|
+
| `ai tasks clear` | 清除所有任务 |
|
|
183
185
|
|
|
184
186
|
### MCP 管理
|
|
185
187
|
|
package/dist/generate-tool.md
CHANGED
|
@@ -87,3 +87,123 @@ module.exports = { functions, descriptions };
|
|
|
87
87
|
3. 编写 `index.js`,导出 `functions` 和 `descriptions`
|
|
88
88
|
4. 对于需要Agent参与的复杂任务,可以直接使用 `this.createSubAgent(prompt: string)` 创建子 Agent 执行任务,并将任务说明作为 `prompt` 传入
|
|
89
89
|
5. 需要引入第三方模块时,需要将该tool创建成NodeJs项目,在tool中引入模块
|
|
90
|
+
|
|
91
|
+
## 生成说明文档
|
|
92
|
+
|
|
93
|
+
工具创建完成后,必须在 `deepfish-tool-{功能名}/` 目录下同时创建一个 `README.md` 说明文档,内容需包含以下三部分:
|
|
94
|
+
|
|
95
|
+
### 功能介绍
|
|
96
|
+
|
|
97
|
+
用清晰的语言描述该工具的用途、适用场景和核心能力。
|
|
98
|
+
|
|
99
|
+
### 工具清单
|
|
100
|
+
|
|
101
|
+
列出该工具提供的所有函数,格式如下:
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
| 函数名 | 描述 |
|
|
105
|
+
|--------|------|
|
|
106
|
+
| `functionName` | 函数功能说明 |
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 快速开始
|
|
110
|
+
|
|
111
|
+
包含以下三个小节:
|
|
112
|
+
|
|
113
|
+
#### 安装 Deepfish
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm install -g deepfish-ai
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### 添加工具
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
ai tools add deepfish-tool-{功能名}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### 使用示例
|
|
126
|
+
|
|
127
|
+
提供至少一个使用Deepfish CLI工具调用Tools的示例。
|
|
128
|
+
|
|
129
|
+
### README.md 模板
|
|
130
|
+
|
|
131
|
+
```markdown
|
|
132
|
+
# {工具名称}
|
|
133
|
+
|
|
134
|
+
## 功能介绍
|
|
135
|
+
|
|
136
|
+
{工具的功能描述、适用场景和核心能力}
|
|
137
|
+
|
|
138
|
+
## 工具清单
|
|
139
|
+
|
|
140
|
+
| 函数名 | 描述 |
|
|
141
|
+
|--------|------|
|
|
142
|
+
| `functionName` | 函数功能说明 |
|
|
143
|
+
|
|
144
|
+
## 快速开始
|
|
145
|
+
|
|
146
|
+
### 安装 Deepfish
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npm install -g deepfish-ai
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 添加工具
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
ai tools add deepfish-tool-{功能名}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 使用示例
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
ai {使用该功能的描述}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### README.md 示例(查询天气工具)
|
|
165
|
+
|
|
166
|
+
以下是一个完整的 README.md 示例,假设创建了一个查询天气的工具 `deepfish-tool-weather`:
|
|
167
|
+
|
|
168
|
+
```markdown
|
|
169
|
+
# 天气查询工具
|
|
170
|
+
|
|
171
|
+
## 功能介绍
|
|
172
|
+
|
|
173
|
+
查询指定城市的实时天气信息,包括温度、湿度、风速、天气状况等。支持通过城市名称或经纬度查询,适用于日常天气查询、出行规划等场景。
|
|
174
|
+
|
|
175
|
+
## 工具清单
|
|
176
|
+
|
|
177
|
+
| 函数名 | 描述 |
|
|
178
|
+
|--------|------|
|
|
179
|
+
| `getWeather` | 根据城市名称查询实时天气 |
|
|
180
|
+
| `getWeatherByCoords` | 根据经纬度查询实时天气 |
|
|
181
|
+
|
|
182
|
+
## 快速开始
|
|
183
|
+
|
|
184
|
+
### 安装 Deepfish
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npm install -g deepfish-ai
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 添加工具
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
ai tools add deepfish-tool-weather
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 使用示例
|
|
197
|
+
|
|
198
|
+
添加完成后,在 Deepfish 对话中直接使用自然语言调用:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
ai "北京今天天气怎么样"
|
|
202
|
+
ai "查询东京的天气"
|
|
203
|
+
ai "纬度39.9、经度116.4的天气如何"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
AI 会自动识别你的意图并调用对应的工具函数返回天气信息。
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
|