deepfish-ai 1.0.28 → 2.0.2
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 +126 -368
- package/dist/index.js +23320 -0
- package/dist/serve/client/assets/index-DUHYC91l.js +1 -0
- package/dist/serve/client/assets/index-zcrdNLZs.css +1 -0
- package/dist/serve/client/index.html +14 -0
- package/dist/serve/pm2-server.js +21015 -0
- package/dist/serve/server/entry-server.mjs +224 -0
- package/package.json +50 -70
- package/LICENSE +0 -21
- package/README_CN.md +0 -460
- package/src/AgentRobot/AgentRobotFactory/MainAgentRobot.js +0 -88
- package/src/AgentRobot/AgentRobotFactory/SubAgentRobot.js +0 -45
- package/src/AgentRobot/AgentRobotFactory/SubSkillAgentRobot.js +0 -45
- package/src/AgentRobot/AgentRobotFactory/index.js +0 -48
- package/src/AgentRobot/BaseAgentRobot/Brain.js +0 -210
- package/src/AgentRobot/BaseAgentRobot/BrainEvent.js +0 -17
- package/src/AgentRobot/BaseAgentRobot/Hand.js +0 -119
- package/src/AgentRobot/BaseAgentRobot/Heart.js +0 -0
- package/src/AgentRobot/BaseAgentRobot/Logger.js +0 -114
- package/src/AgentRobot/BaseAgentRobot/ScreenPrinter.js +0 -49
- package/src/AgentRobot/BaseAgentRobot/index.js +0 -266
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/AliBailian.js +0 -997
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/doc-transform.js +0 -204
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/docx.js +0 -1286
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/img.js +0 -765
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/pdf.js +0 -736
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/pptx.js +0 -567
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/video.js +0 -36
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/xlsx.js +0 -611
- package/src/AgentRobot/BaseAgentRobot/tools/BaseTools.js +0 -13
- package/src/AgentRobot/BaseAgentRobot/tools/CreateAgentTools.js +0 -158
- package/src/AgentRobot/BaseAgentRobot/tools/FileTools.js +0 -768
- package/src/AgentRobot/BaseAgentRobot/tools/GenerateTools.js +0 -441
- package/src/AgentRobot/BaseAgentRobot/tools/InquirerTools.js +0 -244
- package/src/AgentRobot/BaseAgentRobot/tools/SystemTools.js +0 -263
- package/src/AgentRobot/BaseAgentRobot/tools/TaskTools.js +0 -211
- package/src/AgentRobot/BaseAgentRobot/tools/TestTools.js +0 -100
- package/src/AgentRobot/BaseAgentRobot/tools/UserTool.js +0 -87
- package/src/AgentRobot/BaseAgentRobot/tools/WebTools.js +0 -257
- package/src/AgentRobot/BaseAgentRobot/utils/AIRequest.js +0 -297
- package/src/AgentRobot/BaseAgentRobot/utils/AIToolManager.js +0 -131
- package/src/AgentRobot/BaseAgentRobot/utils/AgentTree.js +0 -66
- package/src/AgentRobot/BaseAgentRobot/utils/AttachmentToolScanner.js +0 -235
- package/src/AgentRobot/BaseAgentRobot/utils/MessageCompresser.js +0 -236
- package/src/AgentRobot/BaseAgentRobot/utils/aiConsole.js +0 -74
- package/src/AgentRobot/BaseAgentRobot/utils/aiInquirer.js +0 -78
- package/src/AgentRobot/BaseAgentRobot/utils/analyzeReturn.test.js +0 -104
- package/src/AgentRobot/BaseAgentRobot/utils/copilot.js +0 -117
- package/src/AgentRobot/BaseAgentRobot/utils/node-root.js +0 -138
- package/src/AgentRobot/BaseAgentRobot/utils/normal.js +0 -399
- package/src/cli/ConfigManager.js +0 -283
- package/src/cli/DefaultConfig.js +0 -98
- package/src/cli/GlobalVariable.js +0 -8
- package/src/cli/MemoryManager.js +0 -53
- package/src/cli/SkillConfigManager.js +0 -343
- package/src/cli/SkillParser.js +0 -58
- package/src/cli/ai-auth.js +0 -231
- package/src/cli/ai-config.js +0 -225
- package/src/cli/ai-memory.js +0 -22
- package/src/cli/ai-skill.js +0 -65
- package/src/cli/index.js +0 -77
- package/src/index.js +0 -54
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center" style="display:flex;align-items: center;justify-content: center;">
|
|
2
|
-
<img src="
|
|
2
|
+
<img src="https://github.com/qq306863030/deepfish-ai/blob/master/images/title-img.png" alt="DeepFish" width="300" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
---
|
|
@@ -24,80 +24,68 @@
|
|
|
24
24
|
/>
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
|
-
<img src="
|
|
27
|
+
<img src="https://github.com/qq306863030/deepfish-ai/blob/master/images/banner.png" alt="banner" style="width:100%;text-align:center;" />
|
|
28
28
|
|
|
29
|
+
- [English](README_EN.md) | [中文](README.md)
|
|
29
30
|
|
|
31
|
+
## 目录
|
|
30
32
|
|
|
31
|
-
- [
|
|
33
|
+
- [目录](#目录)
|
|
34
|
+
- [1. 介绍](#1-介绍)
|
|
35
|
+
- [2. 安装](#2-安装)
|
|
36
|
+
- [前置要求](#前置要求)
|
|
37
|
+
- [通过npm安装](#通过npm安装)
|
|
38
|
+
- [从源码安装](#从源码安装)
|
|
39
|
+
- [3. 快速使用](#3-快速使用)
|
|
40
|
+
- [4. 命令说明](#4-命令说明)
|
|
41
|
+
- [基础对话](#基础对话)
|
|
42
|
+
- [配置管理](#配置管理)
|
|
43
|
+
- [模型管理](#模型管理)
|
|
44
|
+
- [Skill 管理](#skill-管理)
|
|
45
|
+
- [工具管理](#工具管理)
|
|
46
|
+
- [会话管理](#会话管理)
|
|
47
|
+
- [任务管理](#任务管理)
|
|
48
|
+
- [MCP 管理](#mcp-管理)
|
|
49
|
+
- [服务管理](#服务管理)
|
|
50
|
+
- [缓存管理(AI自我学习的缓存)](#缓存管理ai自我学习的缓存)
|
|
51
|
+
- [5. MCP 扩展配置](#5-mcp-扩展配置)
|
|
52
|
+
- [配置示例](#配置示例)
|
|
53
|
+
- [6. 贡献](#6-贡献)
|
|
54
|
+
- [7. 许可证](#7-许可证)
|
|
55
|
+
- [8. 支持](#8-支持)
|
|
32
56
|
|
|
33
|
-
##
|
|
57
|
+
## 1. 介绍
|
|
34
58
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- [2. Installation](#2-installation)
|
|
38
|
-
- [Prerequisites](#prerequisites)
|
|
39
|
-
- [Installation via npm](#installation-via-npm)
|
|
40
|
-
- [Installation from Source](#installation-from-source)
|
|
41
|
-
- [3. Quick Start](#3-quick-start)
|
|
42
|
-
- [4. Configuration](#4-configuration)
|
|
43
|
-
- [Initial Setup](#initial-setup)
|
|
44
|
-
- [Configuration Commands](#configuration-commands)
|
|
45
|
-
- [Configuration File Structure](#configuration-file-structure)
|
|
46
|
-
- [Directory Structure](#directory-structure)
|
|
47
|
-
- [5. Usage](#5-usage)
|
|
48
|
-
- [Interactive Mode](#interactive-mode)
|
|
49
|
-
- [Direct Command Mode](#direct-command-mode)
|
|
50
|
-
- [Usage Examples](#usage-examples)
|
|
51
|
-
- [6. Extension Development](#6-extension-development)
|
|
52
|
-
- [Creating an Extension](#creating-an-extension)
|
|
53
|
-
- [Registering Extensions](#registering-extensions)
|
|
54
|
-
- [7. Recommendations](#7-recommendations)
|
|
55
|
-
- [AI Service Selection](#ai-service-selection)
|
|
56
|
-
- [8. Usage Notes](#8-usage-notes)
|
|
57
|
-
- [Using Relative Paths](#using-relative-paths)
|
|
58
|
-
- [Conversation History](#conversation-history)
|
|
59
|
-
- [9. Troubleshooting](#9-troubleshooting)
|
|
60
|
-
- [Configuration Issues](#configuration-issues)
|
|
61
|
-
- [AI Service Connection](#ai-service-connection)
|
|
62
|
-
- [Extension Not Loading](#extension-not-loading)
|
|
63
|
-
- [10. Contributing](#10-contributing)
|
|
64
|
-
- [11. License](#11-license)
|
|
65
|
-
- [12. Support](#12-support)
|
|
59
|
+
一款高效便捷的AI驱动命令行工具,致力于打破自然语言与操作系统指令、文件操作指令之间的壁垒,让非专业开发者也能通过简单的自然语言描述,快速生成可直接执行的操作指令,大幅提升终端操作效率。
|
|
60
|
+
核心特性:
|
|
66
61
|
|
|
62
|
+
- 多模型兼容:无缝支持DeepSeek、Ollama,以及所有遵循OpenAI API规范的AI模型,可根据需求灵活切换,适配不同场景下的指令生成需求。
|
|
67
63
|
|
|
64
|
+
- 自然语言转指令:精准解析自然语言需求,自动转换为对应的操作系统命令(如Linux、Windows、macOS终端指令)和文件操作指令(如创建、删除、修改文件/目录),无需手动编写复杂命令。
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
- **Skill 扩展**:Skill 是 AI 的工作流知识包,通过 Markdown 文件定义特定领域的操作流程和最佳实践。安装 Skill 后,AI 能自动遵循其中的规范来执行任务,例如代码审查流程、文档生成模板等。支持兼容 OpenClaw 的 Skill 生态,可通过 `ai skills` 命令进行安装、启用与管理。
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
Core Features:
|
|
68
|
+
- **Tool 扩展**:Tool 是 AI 可调用的自定义函数工具,通过 TypeScript 文件定义。你可以编写 Tool 来扩展 AI 的能力边界,例如调用第三方 API、操作数据库、处理特定文件格式等。支持通过 `ai tools generate` 命令让 AI 自动生成 Tool,降低开发门槛。
|
|
73
69
|
|
|
74
|
-
-
|
|
70
|
+
- **MCP 扩展**:MCP(Model Context Protocol)是一种标准化的模型上下文协议,允许 AI 连接外部工具和数据源。通过配置 MCP Server,AI 可以获得浏览器自动化、数据库查询、文件系统访问等能力。DeepFish 内置 MCP 支持,只需简单配置即可接入各类 MCP 服务。
|
|
75
71
|
|
|
76
|
-
-
|
|
72
|
+
- 高度可扩展:支持通过扩展机制拓展功能边界,除基础的终端、文件操作外,可轻松实现翻译、小说创作、文件格式转换、数据处理等复杂任务,满足多样化使用需求。
|
|
77
73
|
|
|
78
|
-
- Natural Language to Instructions: Precisely parses natural language requirements and automatically converts them into corresponding operating system commands (such as Linux, Windows, and macOS terminal commands) and file operation instructions (such as creating, deleting, and modifying files/directories), eliminating the need to manually write complex commands.
|
|
79
74
|
|
|
80
|
-
|
|
75
|
+
## 2. 安装
|
|
81
76
|
|
|
82
|
-
|
|
77
|
+
### 前置要求
|
|
83
78
|
|
|
84
|
-
|
|
79
|
+
- Node.js(v22.14.0或更高版本)
|
|
80
|
+
- npm或yarn
|
|
85
81
|
|
|
86
|
-
|
|
87
|
-
## 2. Installation
|
|
88
|
-
|
|
89
|
-
### Prerequisites
|
|
90
|
-
|
|
91
|
-
- Node.js (v22.14.0 or higher)
|
|
92
|
-
- npm or yarn
|
|
93
|
-
|
|
94
|
-
### Installation via npm
|
|
82
|
+
### 通过npm安装
|
|
95
83
|
|
|
96
84
|
```bash
|
|
97
85
|
npm install -g deepfish-ai
|
|
98
86
|
```
|
|
99
87
|
|
|
100
|
-
###
|
|
88
|
+
### 从源码安装
|
|
101
89
|
|
|
102
90
|
```bash
|
|
103
91
|
git clone https://github.com/qq306863030/deepfish-ai.git
|
|
@@ -106,359 +94,129 @@ npm install
|
|
|
106
94
|
npm link
|
|
107
95
|
```
|
|
108
96
|
|
|
109
|
-
## 3.
|
|
97
|
+
## 3. 快速使用
|
|
110
98
|
|
|
111
99
|
```bash
|
|
112
|
-
ai
|
|
113
|
-
ai config use
|
|
114
|
-
ai
|
|
100
|
+
ai models add # 输入名称, 输入你的模型配置
|
|
101
|
+
ai config use 你输入的名称
|
|
102
|
+
ai ”帮我在当前目录写一篇关于未来科技的文章,用markdown格式输出“
|
|
115
103
|
```
|
|
116
104
|
|
|
117
|
-
## 4.
|
|
118
|
-
|
|
119
|
-
### Initial Setup
|
|
105
|
+
## 4. 命令说明
|
|
120
106
|
|
|
121
|
-
|
|
107
|
+
### 基础对话
|
|
122
108
|
|
|
123
109
|
```bash
|
|
124
|
-
ai
|
|
110
|
+
ai "你的问题或指令"
|
|
125
111
|
```
|
|
126
112
|
|
|
127
|
-
|
|
113
|
+
直接输入自然语言,AI 将自动解析并执行对应操作。
|
|
128
114
|
|
|
129
|
-
|
|
130
|
-
- **API Base URL**: Default URL provided for each service
|
|
131
|
-
- **Model Name**: Choose the AI model to use
|
|
132
|
-
- **API Key**: Required for DeepSeek and OpenAI
|
|
133
|
-
- **Temperature**: Controls response randomness (0-2)
|
|
134
|
-
- **Max Tokens**: Maximum response length
|
|
135
|
-
- **Streaming Output**: Enable/disable streaming response
|
|
115
|
+
### 配置管理
|
|
136
116
|
|
|
137
|
-
|
|
117
|
+
| 命令 | 说明 |
|
|
118
|
+
|------|------|
|
|
119
|
+
| `ai config edit` | 编辑配置文件 |
|
|
120
|
+
| `ai config view` | 查看当前配置 |
|
|
121
|
+
| `ai config reset` | 重置配置 |
|
|
122
|
+
| `ai config dir` | 查看配置目录 |
|
|
138
123
|
|
|
139
|
-
|
|
140
|
-
# Configuration commands
|
|
141
|
-
ai config add # Add a new AI configuration
|
|
142
|
-
ai config ls # List all AI configurations
|
|
143
|
-
ai config use <name> # Set the specified AI configuration as the current one
|
|
144
|
-
ai config del <name> # Delete the specified AI configuration
|
|
145
|
-
ai config view [name] # View details of the specified AI configuration
|
|
146
|
-
ai config edit # Edit the configuration file manually
|
|
147
|
-
ai config dir # Open the configuration file directory
|
|
148
|
-
ai config reset # Reset configuration
|
|
149
|
-
|
|
150
|
-
# Skill commands
|
|
151
|
-
ai skill ls # List all registered skills
|
|
152
|
-
ai skill add <name> # Add a local skill directory or zip file from the current directory
|
|
153
|
-
ai skill del <name|index> # Remove a skill by name or index, exp: ai skill del 1
|
|
154
|
-
ai skill install <url> # Install a skill from ClawHub,exp: ai skill install https://clawhub.ai/TheSethRose/agent-browser
|
|
155
|
-
ai skill enable <name|index> # Enable a skill by name or index, exp: ai skill enable 1
|
|
156
|
-
ai skill disable <name|index> # Disable a skill by name or index, exp: ai skill disable 1
|
|
157
|
-
ai skill dir # Open the skill directory
|
|
158
|
-
|
|
159
|
-
# Memory commands
|
|
160
|
-
ai memory clear # Clear the history messages for the current directory
|
|
161
|
-
ai memory dir # Open the memory directory
|
|
162
|
-
```
|
|
124
|
+
### 模型管理
|
|
163
125
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
ai: [
|
|
171
|
-
{
|
|
172
|
-
name: "default", // AI configuration name
|
|
173
|
-
type: "deepseek", // AI service type: "ollama", "deepseek", or "openai"
|
|
174
|
-
baseUrl: "https://api.deepseek.com", // API base URL
|
|
175
|
-
model: "deepseek-reasoner", // AI model name
|
|
176
|
-
apiKey: "", // API key (required for DeepSeek and OpenAI)
|
|
177
|
-
temperature: 0.7, // Response randomness (0-2)
|
|
178
|
-
maxTokens: 8, // Maximum response length (KB)
|
|
179
|
-
maxContextLength: 64, // Maximum context length (KB)
|
|
180
|
-
stream: true, // Enable/disable streaming output
|
|
181
|
-
}
|
|
182
|
-
],
|
|
183
|
-
currentAi: "default", // Name of the currently active AI configuration
|
|
184
|
-
maxIterations: -1, // Maximum iterations for AI to complete the workflow, -1 for unlimited
|
|
185
|
-
maxMemoryExpireTime: 30, // Maximum session expiration time in days, -1 for unlimited, 0 to disable recording
|
|
186
|
-
maxLogExpireTime: 3, // Log expiration time in days, -1 for unlimited, 0 to disable recording
|
|
187
|
-
maxBlockFileSize: 20, // Maximum block file size in KB; files exceeding this size need to be processed in blocks
|
|
188
|
-
isThinkPrint: true, // Whether to print the thinking process
|
|
189
|
-
encoding: "auto", // Command line encoding format, can be set to utf-8, gbk, etc., or auto/empty for auto-detection
|
|
190
|
-
EMBEDDING_API: "", // Embedding API endpoint URL
|
|
191
|
-
EMBEDDING_API_KEY: "", // Embedding API key
|
|
192
|
-
};
|
|
193
|
-
```
|
|
126
|
+
| 命令 | 说明 |
|
|
127
|
+
|------|------|
|
|
128
|
+
| `ai models add` | 添加新模型 |
|
|
129
|
+
| `ai models ls` | 列出所有模型 |
|
|
130
|
+
| `ai models use <name>` | 切换使用的模型 |
|
|
131
|
+
| `ai models del <name>` | 删除指定模型 |
|
|
194
132
|
|
|
195
|
-
###
|
|
133
|
+
### Skill 管理
|
|
196
134
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
ai
|
|
201
|
-
|
|
135
|
+
| 命令 | 说明 |
|
|
136
|
+
|------|------|
|
|
137
|
+
| `ai skills ls` | 列出所有 Skill |
|
|
138
|
+
| `ai skills add <name>` | 添加 Skill |
|
|
139
|
+
| `ai skills del <index>` | 删除指定 Skill |
|
|
140
|
+
| `ai skills enable <name\|index>` | 启用 Skill |
|
|
141
|
+
| `ai skills disable <name\|index>` | 禁用 Skill |
|
|
142
|
+
| `ai skills dir` | 查看 Skill 目录 |
|
|
143
|
+
| `ai skills generate xxx` | 通过 AI 生成 Skill |
|
|
202
144
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
- Windows: `C:/Users/<username>/.deepfish-ai`
|
|
206
|
-
- macOS/Linux: `~/.deepfish-ai`
|
|
207
|
-
|
|
208
|
-
Based on the structure in DevPlan, the directory layout is:
|
|
209
|
-
|
|
210
|
-
```text
|
|
211
|
-
.deepfish-ai/
|
|
212
|
-
├─ config.js # Global configuration
|
|
213
|
-
├─ user-info/
|
|
214
|
-
│ └─ user.md # User profile data
|
|
215
|
-
├─ clawSkills/
|
|
216
|
-
│ ├─ clawSkills.json # OpenClaw skill index
|
|
217
|
-
│ └─ <skill>/
|
|
218
|
-
│ └─ SKILL.md # Single skill definition
|
|
219
|
-
└─ memery/
|
|
220
|
-
├─ agentRecord.json # Workspace to main-agent mapping
|
|
221
|
-
└─ <main-agent-id>/
|
|
222
|
-
├─ memery.json # Main agent memory
|
|
223
|
-
├─ memery-<sub-agent-id>.json # Sub-agent memory
|
|
224
|
-
├─ agentTree.json # Agent hierarchy
|
|
225
|
-
├─ bakup/
|
|
226
|
-
│ └─ <timestamp>/
|
|
227
|
-
│ ├─ record.json # Backup operation record
|
|
228
|
-
│ └─ <uuid>.* # Backup files
|
|
229
|
-
└─ logs/
|
|
230
|
-
└─ log-{YYYY-MM-DD HH}.txt # Hourly rolling logs
|
|
231
|
-
```
|
|
145
|
+
### 工具管理
|
|
232
146
|
|
|
233
|
-
|
|
147
|
+
| 命令 | 说明 |
|
|
148
|
+
|------|------|
|
|
149
|
+
| `ai tools dir` | 查看工具目录 |
|
|
150
|
+
| `ai tools generate xxx` | 通过 AI 生成工具 |
|
|
234
151
|
|
|
235
|
-
###
|
|
152
|
+
### 会话管理
|
|
236
153
|
|
|
237
|
-
|
|
154
|
+
| 命令 | 说明 |
|
|
155
|
+
|------|------|
|
|
156
|
+
| `ai session clear` | 清除会话历史 |
|
|
157
|
+
| `ai session dir` | 查看会话目录 |
|
|
238
158
|
|
|
239
|
-
|
|
240
|
-
ai
|
|
241
|
-
```
|
|
159
|
+
### 任务管理
|
|
242
160
|
|
|
243
|
-
|
|
161
|
+
| 命令 | 说明 |
|
|
162
|
+
|------|------|
|
|
163
|
+
| `ai task ls` | 列出所有任务 |
|
|
164
|
+
| `ai task add <task>` | 添加任务 |
|
|
165
|
+
| `ai task del <index>` | 删除指定任务 |
|
|
166
|
+
| `ai task clear` | 清除所有任务 |
|
|
244
167
|
|
|
245
|
-
|
|
246
|
-
ai -i or ai -interactive
|
|
247
|
-
```
|
|
168
|
+
### MCP 管理
|
|
248
169
|
|
|
249
|
-
|
|
170
|
+
| 命令 | 说明 |
|
|
171
|
+
|------|------|
|
|
172
|
+
| `ai mcp edit` | 编辑 MCP 配置 |
|
|
250
173
|
|
|
251
|
-
|
|
174
|
+
### 服务管理
|
|
252
175
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
176
|
+
| 命令 | 说明 |
|
|
177
|
+
|------|------|
|
|
178
|
+
| `ai serve` | 启动服务 |
|
|
179
|
+
| `ai serve start` | 启动服务 |
|
|
180
|
+
| `ai serve stop` | 停止服务 |
|
|
181
|
+
| `ai serve restart` | 重启服务 |
|
|
256
182
|
|
|
257
|
-
###
|
|
183
|
+
### 缓存管理(AI自我学习的缓存)
|
|
258
184
|
|
|
259
|
-
|
|
185
|
+
| 命令 | 说明 |
|
|
186
|
+
|------|------|
|
|
187
|
+
| `ai cache ls` | 列出缓存 |
|
|
188
|
+
| `ai cache edit <index\|id>` | 编辑缓存项 |
|
|
189
|
+
| `ai cache del <index\|id>` | 删除缓存项 |
|
|
260
190
|
|
|
261
|
-
|
|
262
|
-
ai "Create 10 text documents, each with 100 random characters"
|
|
263
|
-
ai "Clear the current directory"
|
|
264
|
-
```
|
|
191
|
+
## 5. MCP 扩展配置
|
|
265
192
|
|
|
266
|
-
|
|
193
|
+
MCP(Model Context Protocol)允许 AI 连接外部工具和服务。通过 `ai mcp edit` 命令编辑 MCP 配置文件,添加你需要的 MCP Server。
|
|
267
194
|
|
|
268
|
-
|
|
269
|
-
ai "Create a simple Express server with a /hello endpoint"
|
|
270
|
-
ai "Create a browser-based airplane shooting game"
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
**System Commands:**
|
|
274
|
-
|
|
275
|
-
```bash
|
|
276
|
-
ai "List all files in the current directory with their sizes"
|
|
277
|
-
ai "Check disk usage for the current directory"
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
**Extension Tool Generation:**
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
ai "Create a weather.js extension tool for querying weather"
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
**Skill Management:**
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
ai skill install https://clawhub.ai/TheSethRose/agent-browser
|
|
290
|
-
ai skill install https://clawhub.ai/steipete/weather
|
|
291
|
-
ai skill ls
|
|
292
|
-
ai skill enable 1
|
|
293
|
-
ai skill disable 0
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
**OpenClaw Skill Generation:**
|
|
297
|
-
|
|
298
|
-
```bash
|
|
299
|
-
ai "Create a weather query skill"
|
|
300
|
-
ai skill add weather-query
|
|
301
|
-
ai skill enable weather-query
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
**Media Processing:**
|
|
305
|
-
|
|
306
|
-
```bash
|
|
307
|
-
ai "I have ffmpeg5 installed on my system, help me convert all MP4 files in the directory to AVI format"
|
|
308
|
-
```
|
|
195
|
+
### 配置示例
|
|
309
196
|
|
|
310
|
-
|
|
197
|
+
以下示例配置了 Chrome DevTools MCP Server,使 AI 能够操控浏览器进行自动化操作:
|
|
311
198
|
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
```bash
|
|
319
|
-
ai "Create a task list: 1.xxxx; 2.xxxx; ..."
|
|
320
|
-
ai "Execute task list" # Start execution
|
|
321
|
-
|
|
322
|
-
ai "I want to implement an extension tool for long-form novel writing that supports large-scale writing, maintains contextual logic coherence, and avoids AI context explosion issues. This extension tool may be a bit complex to implement. You need to carefully read the extension tool generation rules first, then create a task list"
|
|
323
|
-
ai "Execute task list" # Start execution
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
## 6. Extension Development
|
|
327
|
-
|
|
328
|
-
Extensions allow you to add custom functions that AI can use in its workflows. For complex processes, you can develop them yourself or try generating extensions using this program, then register the extension with the program and use the command line to complete tasks.
|
|
329
|
-
|
|
330
|
-
### Creating an Extension
|
|
331
|
-
|
|
332
|
-
1. Extensions should export an object containing `descriptions` (an array of tool descriptions) and `functions` (an object of functions).
|
|
333
|
-
2. Tip: You can generate extensions via AI, e.g., `ai "Create a weather.js extension tool for querying weather"`
|
|
334
|
-
3. View [example extensions](https://github.com/qq306863030/deepfish-extensions).
|
|
335
|
-
|
|
336
|
-
```javascript
|
|
337
|
-
// Example extension: Weather Extension
|
|
338
|
-
const axios = require('axios');
|
|
339
|
-
|
|
340
|
-
const descriptions = [
|
|
341
|
-
{
|
|
342
|
-
type: 'function',
|
|
343
|
-
function: {
|
|
344
|
-
name: 'getWeather',
|
|
345
|
-
description: 'Get current weather information for a city',
|
|
346
|
-
parameters: {
|
|
347
|
-
type: 'object',
|
|
348
|
-
properties: {
|
|
349
|
-
city: { type: 'string' }
|
|
350
|
-
},
|
|
351
|
-
required: ['city']
|
|
352
|
-
}
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"mcpServers": {
|
|
202
|
+
"chrome-devtools": {
|
|
203
|
+
"command": "npx",
|
|
204
|
+
"args": ["-y", "chrome-devtools-mcp@latest"]
|
|
353
205
|
}
|
|
354
206
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const functions = {
|
|
358
|
-
async getWeather(city) {
|
|
359
|
-
// Implement weather API call
|
|
360
|
-
const response = await axios.get(`https://api.weatherapi.com/v1/current.json?key=YOUR_KEY&q=${city}`);
|
|
361
|
-
return `${city} weather: ${response.data.current.temp_c}°C, ${response.data.current.condition.text}`;
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
module.exports = {
|
|
366
|
-
descriptions,
|
|
367
|
-
functions
|
|
368
|
-
};
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
### Registering Extensions
|
|
372
|
-
|
|
373
|
-
**Method 1: Manual Configuration**
|
|
374
|
-
|
|
375
|
-
1. ai config edit
|
|
376
|
-
2. Add it to your configuration:
|
|
377
|
-
|
|
378
|
-
```javascript
|
|
379
|
-
export default {
|
|
380
|
-
// ... other configurations
|
|
381
|
-
extensions: [
|
|
382
|
-
'/path/to/weather-extension.js'
|
|
383
|
-
],
|
|
384
|
-
};
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
**Method 2: Automatic Scanning**
|
|
388
|
-
|
|
389
|
-
Rules for automatic scanning of extension modules upon program startup:
|
|
390
|
-
|
|
391
|
-
1. Scanning locations:
|
|
392
|
-
- the DeepFish installation directory (where `deepfish-ai` is located)
|
|
393
|
-
- `node_modules` under the current working directory
|
|
394
|
-
- the current working directory itself
|
|
395
|
-
|
|
396
|
-
2. Scanned files:
|
|
397
|
-
- scoped packages under `@deepfish-ai/*` in the locations above
|
|
398
|
-
- packages starting with `deepfish-` in the locations above (excluding `deepfish-ai` itself)
|
|
399
|
-
- top-level `.js` / `.mjs` files in the current working directory are scanned additionally; files containing `module.exports`, `descriptions`, and `functions` are treated as auto-loadable extensions
|
|
400
|
-
|
|
401
|
-
## 7. Recommendations
|
|
402
|
-
|
|
403
|
-
### AI Service Selection
|
|
404
|
-
|
|
405
|
-
**Recommendation: Use online AI services (DeepSeek/OpenAI) for best results**
|
|
406
|
-
|
|
407
|
-
While local AI services (like Ollama) offer privacy and offline capabilities, they may have the following limitations:
|
|
408
|
-
|
|
409
|
-
- **Response Accuracy**: Local models may not be as rigorous and precise as online models
|
|
410
|
-
- **Code Quality**: Generated code may require more manual review and correction
|
|
411
|
-
- **Complex Task Handling**: May encounter difficulties with multi-step or complex operations
|
|
412
|
-
- **Language Understanding**: Online services provide better language models
|
|
413
|
-
|
|
414
|
-
For production environments or complex tasks, we recommend using DeepSeek, OpenAI services, or cloud services within Ollama for more reliable and accurate results.
|
|
415
|
-
|
|
416
|
-
## 8. Usage Notes
|
|
417
|
-
|
|
418
|
-
### Using Relative Paths
|
|
419
|
-
|
|
420
|
-
AI always uses paths relative to the current working directory.
|
|
421
|
-
|
|
422
|
-
### Conversation History
|
|
423
|
-
|
|
424
|
-
Conversation history is created on a per-directory basis — each execution directory corresponds to its own Agent context. This means that conversations started in different directories are independent of each other.
|
|
425
|
-
|
|
426
|
-
> **⚠️ Important Note:** AI context is directory-based — each directory corresponds to one context. **Please do not open two command-line dialogs in the same directory**, as this may cause context conflicts and unexpected behavior.
|
|
427
|
-
|
|
428
|
-
Conversation history will be automatically cleared after a configurable period (controlled by the `maxMemoryExpireTime` field in the configuration file, default is 30 days). You can also manage it manually:
|
|
429
|
-
|
|
430
|
-
- `ai memory dir` — Open the memory directory to view stored conversation contexts
|
|
431
|
-
- `ai memory clear` — Manually clear the conversation history for the current directory
|
|
432
|
-
|
|
433
|
-
## 9. Troubleshooting
|
|
434
|
-
|
|
435
|
-
### Configuration Issues
|
|
436
|
-
|
|
437
|
-
If you encounter configuration errors, try resetting:
|
|
438
|
-
|
|
439
|
-
```bash
|
|
440
|
-
ai config reset
|
|
207
|
+
}
|
|
441
208
|
```
|
|
442
209
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
- **Ollama**: Ensure Ollama is running locally on port 11434
|
|
446
|
-
- **DeepSeek/MiniMax/Qwen/OpenAI**: Verify your API key is correct and you have sufficient quota
|
|
447
|
-
|
|
448
|
-
### Extension Not Loading
|
|
449
|
-
|
|
450
|
-
- Check the file path in the configuration
|
|
451
|
-
- Ensure the file exports the correct object
|
|
452
|
-
- Verify the file has no syntax errors
|
|
210
|
+
配置完成后,AI 将自动加载 MCP Server 提供的工具,你可以在对话中直接让 AI 使用这些能力。
|
|
453
211
|
|
|
454
|
-
##
|
|
212
|
+
## 6. 贡献
|
|
455
213
|
|
|
456
|
-
|
|
214
|
+
欢迎贡献!请随时提交Pull Request。
|
|
457
215
|
|
|
458
|
-
##
|
|
216
|
+
## 7. 许可证
|
|
459
217
|
|
|
460
|
-
|
|
218
|
+
本项目采用MIT许可证 - 详见[LICENSE](LICENSE)文件。
|
|
461
219
|
|
|
462
|
-
##
|
|
220
|
+
## 8. 支持
|
|
463
221
|
|
|
464
|
-
|
|
222
|
+
如有问题和疑问,请在GitHub仓库上提交issue。
|