deepfish-ai 1.0.29 → 2.0.3

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.
Files changed (65) hide show
  1. package/README.md +195 -344
  2. package/dist/generate-skill.md +104 -0
  3. package/dist/generate-tool.md +88 -0
  4. package/dist/index.js +26831 -0
  5. package/dist/serve/client/assets/index-DUHYC91l.js +1 -0
  6. package/dist/serve/client/assets/index-zcrdNLZs.css +1 -0
  7. package/dist/serve/client/index.html +14 -0
  8. package/dist/serve/pm2-server.js +24405 -0
  9. package/dist/serve/server/entry-server.mjs +224 -0
  10. package/dist/view-learn-cache.md +65 -0
  11. package/package.json +77 -83
  12. package/LICENSE +0 -21
  13. package/README_CN.md +0 -460
  14. package/src/AgentRobot/AgentRobotFactory/MainAgentRobot.js +0 -88
  15. package/src/AgentRobot/AgentRobotFactory/SubAgentRobot.js +0 -45
  16. package/src/AgentRobot/AgentRobotFactory/SubSkillAgentRobot.js +0 -45
  17. package/src/AgentRobot/AgentRobotFactory/index.js +0 -48
  18. package/src/AgentRobot/BaseAgentRobot/Brain.js +0 -210
  19. package/src/AgentRobot/BaseAgentRobot/BrainEvent.js +0 -17
  20. package/src/AgentRobot/BaseAgentRobot/Hand.js +0 -119
  21. package/src/AgentRobot/BaseAgentRobot/Heart.js +0 -0
  22. package/src/AgentRobot/BaseAgentRobot/Logger.js +0 -114
  23. package/src/AgentRobot/BaseAgentRobot/ScreenPrinter.js +0 -49
  24. package/src/AgentRobot/BaseAgentRobot/index.js +0 -266
  25. package/src/AgentRobot/BaseAgentRobot/lazy-tools/AliBailian.js +0 -997
  26. package/src/AgentRobot/BaseAgentRobot/lazy-tools/doc-transform.js +0 -204
  27. package/src/AgentRobot/BaseAgentRobot/lazy-tools/docx.js +0 -1286
  28. package/src/AgentRobot/BaseAgentRobot/lazy-tools/img.js +0 -765
  29. package/src/AgentRobot/BaseAgentRobot/lazy-tools/pdf.js +0 -736
  30. package/src/AgentRobot/BaseAgentRobot/lazy-tools/pptx.js +0 -567
  31. package/src/AgentRobot/BaseAgentRobot/lazy-tools/video.js +0 -36
  32. package/src/AgentRobot/BaseAgentRobot/lazy-tools/xlsx.js +0 -611
  33. package/src/AgentRobot/BaseAgentRobot/tools/BaseTools.js +0 -13
  34. package/src/AgentRobot/BaseAgentRobot/tools/CreateAgentTools.js +0 -158
  35. package/src/AgentRobot/BaseAgentRobot/tools/FileTools.js +0 -768
  36. package/src/AgentRobot/BaseAgentRobot/tools/GenerateTools.js +0 -441
  37. package/src/AgentRobot/BaseAgentRobot/tools/InquirerTools.js +0 -244
  38. package/src/AgentRobot/BaseAgentRobot/tools/SystemTools.js +0 -424
  39. package/src/AgentRobot/BaseAgentRobot/tools/TaskTools.js +0 -211
  40. package/src/AgentRobot/BaseAgentRobot/tools/TestTools.js +0 -100
  41. package/src/AgentRobot/BaseAgentRobot/tools/UserTool.js +0 -87
  42. package/src/AgentRobot/BaseAgentRobot/tools/WebTools.js +0 -257
  43. package/src/AgentRobot/BaseAgentRobot/utils/AIRequest.js +0 -297
  44. package/src/AgentRobot/BaseAgentRobot/utils/AIToolManager.js +0 -131
  45. package/src/AgentRobot/BaseAgentRobot/utils/AgentTree.js +0 -66
  46. package/src/AgentRobot/BaseAgentRobot/utils/AttachmentToolScanner.js +0 -235
  47. package/src/AgentRobot/BaseAgentRobot/utils/MessageCompresser.js +0 -236
  48. package/src/AgentRobot/BaseAgentRobot/utils/aiConsole.js +0 -74
  49. package/src/AgentRobot/BaseAgentRobot/utils/aiInquirer.js +0 -78
  50. package/src/AgentRobot/BaseAgentRobot/utils/analyzeReturn.test.js +0 -104
  51. package/src/AgentRobot/BaseAgentRobot/utils/copilot.js +0 -117
  52. package/src/AgentRobot/BaseAgentRobot/utils/node-root.js +0 -138
  53. package/src/AgentRobot/BaseAgentRobot/utils/normal.js +0 -399
  54. package/src/cli/ConfigManager.js +0 -283
  55. package/src/cli/DefaultConfig.js +0 -98
  56. package/src/cli/GlobalVariable.js +0 -8
  57. package/src/cli/MemoryManager.js +0 -53
  58. package/src/cli/SkillConfigManager.js +0 -354
  59. package/src/cli/SkillParser.js +0 -58
  60. package/src/cli/ai-auth.js +0 -231
  61. package/src/cli/ai-config.js +0 -225
  62. package/src/cli/ai-memory.js +0 -22
  63. package/src/cli/ai-skill.js +0 -65
  64. package/src/cli/index.js +0 -77
  65. 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="./images/title-img.png" alt="DeepFish" width="300" />
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,73 @@
24
24
  />
25
25
  </div>
26
26
 
27
- <img src="./images/banner.png" alt="banner" style="width:100%;text-align:center;" />
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
- - [English](README.md) | [中文](README_CN.md)
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. Tool 与 Skill 扩展说明](#6-tool-与-skill-扩展说明)
54
+ - [当前目录扩展](#当前目录扩展)
55
+ - [全局扩展](#全局扩展)
56
+ - [7. 系统配置文件说明](#7-系统配置文件说明)
57
+ - [配置文件字段](#配置文件字段)
58
+ - [AI 模型配置字段](#ai-模型配置字段)
59
+ - [8. 贡献](#8-贡献)
60
+ - [9. 许可证](#9-许可证)
61
+ - [10. 支持](#10-支持)
32
62
 
33
- ## Table of Contents
63
+ ## 1. 介绍
34
64
 
35
- - [Table of Contents](#table-of-contents)
36
- - [1. Introduction](#1-introduction)
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)
65
+ 一款高效便捷的AI驱动命令行工具,致力于打破自然语言与操作系统指令、文件操作指令之间的壁垒,让非专业开发者也能通过简单的自然语言描述,快速生成可直接执行的操作指令,大幅提升终端操作效率。
66
+ 核心特性:
66
67
 
68
+ - 多模型兼容:无缝支持DeepSeek、Ollama,以及所有遵循OpenAI API规范的AI模型,可根据需求灵活切换,适配不同场景下的指令生成需求。
67
69
 
70
+ - 自然语言转指令:精准解析自然语言需求,自动转换为对应的操作系统命令(如Linux、Windows、macOS终端指令)和文件操作指令(如创建、删除、修改文件/目录),无需手动编写复杂命令。
68
71
 
69
- ## 1. Introduction
72
+ - **Skill 扩展**:Skill 是 AI 的工作流知识包,通过 Markdown 文件定义特定领域的操作流程和最佳实践。安装 Skill 后,AI 能自动遵循其中的规范来执行任务,例如代码审查流程、文档生成模板等。支持兼容 OpenClaw 的 Skill 生态,可通过 `ai skills` 命令进行安装、启用与管理。
70
73
 
71
- An efficient and convenient AI-driven command-line tool designed to break down the barrier between natural language and operating system commands or file operation instructions. It enables non-professional developers to quickly generate directly executable operation instructions through simple natural language descriptions, significantly improving terminal operation efficiency.
72
- Core Features:
74
+ - **Tool 扩展**:Tool AI 可调用的自定义函数工具,通过 TypeScript 文件定义。你可以编写 Tool 来扩展 AI 的能力边界,例如调用第三方 API、操作数据库、处理特定文件格式等。支持通过 `ai tools generate` 命令让 AI 自动生成 Tool,降低开发门槛。
73
75
 
74
- - Multi-model Compatibility: Seamlessly supports DeepSeek, Ollama, and all AI models that comply with the OpenAI API specification. It can be flexibly switched according to needs to adapt to instruction generation requirements in different scenarios.
76
+ - **MCP 扩展**:MCP(Model Context Protocol)是一种标准化的模型上下文协议,允许 AI 连接外部工具和数据源。通过配置 MCP Server,AI 可以获得浏览器自动化、数据库查询、文件系统访问等能力。DeepFish 内置 MCP 支持,只需简单配置即可接入各类 MCP 服务。
75
77
 
76
- - OpenClaw Skill Compatibility: Supports the OpenClaw Skill ecosystem. Skills can be installed, enabled, and managed through the existing Skill commands to quickly expand workflow capabilities.
78
+ - 高度可扩展:支持通过扩展机制拓展功能边界,除基础的终端、文件操作外,可轻松实现翻译、小说创作、文件格式转换、数据处理等复杂任务,满足多样化使用需求。
77
79
 
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.
80
+ ## 2. 安装
79
81
 
80
- - Highly Extensible: Supports expanding functional boundaries through an extension mechanism. In addition to basic terminal and file operations, it can easily implement complex tasks such as translation, novel writing, file format conversion, and data processing to meet diverse usage needs.
82
+ ### 前置要求
81
83
 
82
- - AI Automatic Extension Generation: There is no need to manually develop complex extension tools. Custom extensions can be directly generated through AI, reducing the threshold for extension development and making function expansion more efficient and flexible.[Extensions-Example](https://github.com/qq306863030/deepfish-extensions)
84
+ - Node.js(v22.14.0或更高版本)
85
+ - npm或yarn
83
86
 
84
- Suitable for various groups such as developers, operation and maintenance personnel, and daily terminal users. Whether it is quickly executing terminal operations, batch processing files, or realizing personalized needs through extensions, this tool can simplify the operation process, improve work efficiency, and empower every terminal operation with AI.
85
-
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
87
+ ### 通过npm安装
95
88
 
96
89
  ```bash
97
90
  npm install -g deepfish-ai
98
91
  ```
99
92
 
100
- ### Installation from Source
93
+ ### 从源码安装
101
94
 
102
95
  ```bash
103
96
  git clone https://github.com/qq306863030/deepfish-ai.git
@@ -106,359 +99,217 @@ npm install
106
99
  npm link
107
100
  ```
108
101
 
109
- ## 3. Quick Start
102
+ ## 3. 快速使用
110
103
 
111
104
  ```bash
112
- ai config add # Enter a name, then select deepseek, and enter your DeepSeek API key
113
- ai config use [the_name_you_entered]
114
- ai "Help me write an article about future technology in the current directory, output in markdown format"
105
+ ai models add # 输入名称, 输入你的模型配置
106
+ ai config use 你输入的名称
107
+ ai ”帮我在当前目录写一篇关于未来科技的文章,用markdown格式输出“
115
108
  ```
116
109
 
117
- ## 4. Configuration
110
+ ## 4. 命令说明
118
111
 
119
- ### Initial Setup
120
-
121
- Run the configuration wizard to set up your AI service:
112
+ ### 基础对话
122
113
 
123
114
  ```bash
124
- ai config add
115
+ ai "你的问题或指令"
125
116
  ```
126
117
 
127
- This will prompt you to configure the following:
128
-
129
- - **AI Service Type**: Choose DeepSeek, MiniMax, Qwen, Ollama, or OpenAI
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
118
+ 直接输入自然语言,AI 将自动解析并执行对应操作。
136
119
 
137
- ### Configuration Commands
138
-
139
- ```bash
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
- ```
120
+ ### 配置管理
163
121
 
164
- ### Configuration File Structure
165
-
166
- The configuration file (`~/.deepfish-ai/config.js`) has the following structure:
167
-
168
- ```javascript
169
- export default {
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
- ```
122
+ | 命令 | 说明 |
123
+ | ----------------- | ------------ |
124
+ | `ai config edit` | 编辑配置文件 |
125
+ | `ai config view` | 查看当前配置 |
126
+ | `ai config reset` | 重置配置 |
127
+ | `ai config dir` | 查看配置目录 |
194
128
 
195
- ### Directory Structure
129
+ ### 模型管理
196
130
 
197
- DeepFish uses `.deepfish-ai` as the default working directory. You can open it directly with:
131
+ | 命令 | 说明 |
132
+ | ---------------------- | -------------- |
133
+ | `ai models add` | 添加新模型 |
134
+ | `ai models ls` | 列出所有模型 |
135
+ | `ai models use <name>` | 切换使用的模型 |
136
+ | `ai models del <name>` | 删除指定模型 |
198
137
 
199
- ```bash
200
- ai config dir
201
- ```
138
+ ### Skill 管理
202
139
 
203
- Default paths:
140
+ | 命令 | 说明 |
141
+ | --------------------------------- | ------------------ |
142
+ | `ai skills ls` | 列出所有 Skill |
143
+ | `ai skills add <name>` | 添加 Skill |
144
+ | `ai skills del <index>` | 删除指定 Skill |
145
+ | `ai skills enable <name\|index>` | 启用 Skill |
146
+ | `ai skills disable <name\|index>` | 禁用 Skill |
147
+ | `ai skills dir` | 查看 Skill 目录 |
148
+ | `ai skills generate xxx` | 通过 AI 生成 Skill |
204
149
 
205
- - Windows: `C:/Users/<username>/.deepfish-ai`
206
- - macOS/Linux: `~/.deepfish-ai`
150
+ ### 工具管理
207
151
 
208
- Based on the structure in DevPlan, the directory layout is:
152
+ | 命令 | 说明 |
153
+ | ----------------------- | -------------------------------------------------- |
154
+ | `ai tools dir` | 查看全局工具目录 |
155
+ | `ai tools add <name>` | 添加当前目录下的本地工具目录,可选择本地或全局生效 |
156
+ | `ai tools generate xxx` | 通过 AI 生成工具 |
209
157
 
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
- ```
158
+ ### 会话管理
232
159
 
233
- ## 5. Usage
160
+ | 命令 | 说明 |
161
+ | ------------------ | ------------ |
162
+ | `ai session clear` | 清除会话历史 |
163
+ | `ai session dir` | 查看会话目录 |
234
164
 
235
- ### Interactive Mode
165
+ ### 任务管理
236
166
 
237
- Start an interactive session (multi-turn dialogue):
167
+ | 命令 | 说明 |
168
+ | --------------------- | ------------ |
169
+ | `ai task ls` | 列出所有任务 |
170
+ | `ai task add <task>` | 添加任务 |
171
+ | `ai task del <index>` | 删除指定任务 |
172
+ | `ai task clear` | 清除所有任务 |
238
173
 
239
- ```bash
240
- ai
241
- ```
174
+ ### MCP 管理
242
175
 
243
- Or explicitly specify:
176
+ | 命令 | 说明 |
177
+ | ------------- | ------------- |
178
+ | `ai mcp edit` | 编辑 MCP 配置 |
244
179
 
245
- ```bash
246
- ai -i or ai -interactive
247
- ```
180
+ ### 服务管理
248
181
 
249
- ### Direct Command Mode
182
+ | 命令 | 说明 |
183
+ | ------------------ | -------- |
184
+ | `ai serve` | 启动服务 |
185
+ | `ai serve start` | 启动服务 |
186
+ | `ai serve stop` | 停止服务 |
187
+ | `ai serve restart` | 重启服务 |
250
188
 
251
- Execute a single command:
189
+ ### 缓存管理(AI自我学习的缓存)
252
190
 
253
- ```bash
254
- ai "Create a file named hello.txt with the content 'Hello World'"
255
- ```
191
+ | 命令 | 说明 |
192
+ | --------------------------- | ---------- |
193
+ | `ai cache ls` | 列出缓存 |
194
+ | `ai cache edit <index\|id>` | 编辑缓存项 |
195
+ | `ai cache del <index\|id>` | 删除缓存项 |
256
196
 
257
- ### Usage Examples
197
+ ## 5. MCP 扩展配置
258
198
 
259
- **File Operations:**
199
+ MCP(Model Context Protocol)允许 AI 连接外部工具和服务。通过 `ai mcp edit` 命令编辑 MCP 配置文件,添加你需要的 MCP Server。
260
200
 
261
- ```bash
262
- ai "Create 10 text documents, each with 100 random characters"
263
- ai "Clear the current directory"
264
- ```
201
+ ### 配置示例
265
202
 
266
- **Code Generation:**
203
+ 以下示例配置了 Chrome DevTools MCP Server,使 AI 能够操控浏览器进行自动化操作:
267
204
 
268
- ```bash
269
- ai "Create a simple Express server with a /hello endpoint"
270
- ai "Create a browser-based airplane shooting game"
205
+ ```json
206
+ {
207
+ "mcpServers": {
208
+ "chrome-devtools": {
209
+ "command": "npx",
210
+ "args": ["-y", "chrome-devtools-mcp@latest"]
211
+ }
212
+ }
213
+ }
271
214
  ```
272
215
 
273
- **System Commands:**
216
+ 配置完成后,AI 将自动加载 MCP Server 提供的工具,你可以在对话中直接让 AI 使用这些能力。
274
217
 
275
- ```bash
276
- ai "List all files in the current directory with their sizes"
277
- ai "Check disk usage for the current directory"
278
- ```
218
+ ## 6. Tool 与 Skill 扩展说明
279
219
 
280
- **Extension Tool Generation:**
220
+ DeepFish 支持通过 Tool 和 Skill 扩展 AI 的能力。扩展文件可以放在当前工作目录的 `.deepfish-ai` 目录中,也可以放在全局配置目录中。
281
221
 
282
- ```bash
283
- ai "Create a weather.js extension tool for querying weather"
284
- ```
222
+ - **Tool 扩展**:用于定义 AI 可直接调用的自定义函数工具,适合封装 API 调用、数据库操作、文件处理等能力。
223
+ - **Skill 扩展**:用于定义 AI 的工作流知识包,适合沉淀某类任务的执行步骤、规范和最佳实践。
285
224
 
286
- **Skill Management:**
225
+ ### 当前目录扩展
287
226
 
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
- ```
227
+ 如果扩展只希望在当前目录下生效,请将扩展拷贝到当前目录的 `.deepfish-ai` 目录中:
295
228
 
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
229
+ ```text
230
+ 当前目录/
231
+ └── .deepfish-ai/
232
+ ├── tools/
233
+ │ └── your-tool/
234
+ └── skills/
235
+ └── your-skill/
302
236
  ```
303
237
 
304
- **Media Processing:**
238
+ - Tool 扩展放入 `当前目录/.deepfish-ai/tools/`。
239
+ - Skill 扩展放入 `当前目录/.deepfish-ai/skills/`。
240
+ - 这种方式只对当前目录有效,适合项目级扩展或仅在某个项目中使用的能力。
305
241
 
306
- ```bash
307
- ai "I have ffmpeg5 installed on my system, help me convert all MP4 files in the directory to AVI format"
308
- ```
242
+ ### 全局扩展
309
243
 
310
- **File Organization:**
244
+ 如果扩展希望在所有目录下生效,请将扩展拷贝到全局配置目录中的 `tools` 或 `skills` 目录。
311
245
 
312
- ```bash
313
- ai "Classify all files under the 'model' directory into the 'model2' directory by month, date format YYYY-MM"
314
- ```
315
-
316
- **Task List Execution:**
246
+ 可以通过以下命令打开全局配置目录:
317
247
 
318
248
  ```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
- }
353
- }
354
- }
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
- };
249
+ ai config dir
369
250
  ```
370
251
 
371
- ### Registering Extensions
372
-
373
- **Method 1: Manual Configuration**
252
+ 目录结构示例:
374
253
 
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
- };
254
+ ```text
255
+ 全局配置目录/
256
+ └── .deepfish-ai/
257
+ ├── tools/
258
+ │ └── your-tool/
259
+ └── skills/
260
+ └── your-skill/
385
261
  ```
386
262
 
387
- **Method 2: Automatic Scanning**
263
+ - Tool 扩展放入 `全局配置目录/.deepfish-ai/tools/`。
264
+ - Skill 扩展放入 `全局配置目录/.deepfish-ai/skills/`。
265
+ - 这种方式对全局有效,适合通用工具或长期复用的工作流能力。
388
266
 
389
- Rules for automatic scanning of extension modules upon program startup:
267
+ ## 7. 系统配置文件说明
390
268
 
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:
269
+ DeepFish 的系统配置文件位于用户目录下的 `.deepfish-ai/config.json5`,可通过以下命令打开或查看:
438
270
 
439
271
  ```bash
440
- ai config reset
272
+ ai config edit
273
+ ai config view
441
274
  ```
442
275
 
443
- ### AI Service Connection
276
+ ### 配置文件字段
277
+
278
+ | 字段 | 类型 | 默认值 | 说明 |
279
+ | --------------------- | --------- | -------- | ----------------------------------------------------------------------- |
280
+ | `aiList` | `array` | `[]` | AI 模型配置列表,可添加多个模型配置。 |
281
+ | `currentModel` | `string` | `''` | 当前正在使用的 AI 配置名称,对应 `aiList` 中某一项的 `name`。 |
282
+ | `maxIterations` | `number` | `-1` | AI 完成工作流的最大迭代次数,`-1` 表示不限制。 |
283
+ | `maxMemoryExpireTime` | `number` | `30` | 会话记忆最大保留时间,单位为天;`-1` 表示永久保留,`0` 表示不记录。 |
284
+ | `maxLogExpireTime` | `number` | `3` | 日志最大保留时间,单位为天;`-1` 表示永久保留,`0` 表示不记录。 |
285
+ | `maxBlockFileSize` | `number` | `50` | 最大分块文件大小,单位为 KB;超过该大小的文件会按块处理。 |
286
+ | `encoding` | `string` | `'auto'` | 命令行输出编码,可设置为 `utf-8`、`gbk` 等;`auto` 或空值表示自动判断。 |
287
+ | `maxSubAgentCount` | `number` | `2` | 最大并行子 Agent 数量,`-1` 表示不限制。 |
288
+ | `isPrintThinking` | `boolean` | `true` | 是否打印 AI 思考过程中的中间信息。 |
289
+ | `serve.port` | `number` | `8866` | DeepFish 本地服务端口。 |
444
290
 
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
291
+ ### AI 模型配置字段
447
292
 
448
- ### Extension Not Loading
293
+ `aiList` 中的每一项表示一个 AI 模型配置,常见字段如下:
449
294
 
450
- - Check the file path in the configuration
451
- - Ensure the file exports the correct object
452
- - Verify the file has no syntax errors
295
+ | 字段 | 类型 | 说明 |
296
+ | ------------------ | -------- | --------------------------------------------------------------- |
297
+ | `name` | `string` | 模型配置名称,用于 `ai models use <name>` 切换模型。 |
298
+ | `type` | `string` | 模型供应商类型,例如 `DeepSeek`、`Ollama`、`OpenAICompatible`。 |
299
+ | `baseUrl` | `string` | 模型 API 地址。 |
300
+ | `model` | `string` | 实际调用的模型名称。 |
301
+ | `apiKey` | `string` | 模型 API Key。 |
302
+ | `temperature` | `number` | 生成随机性参数,数值越高输出越发散,数值越低输出越稳定。 |
303
+ | `maxContextLength` | `number` | 模型最大上下文长度,单位为 tokens。 |
453
304
 
454
- ## 10. Contributing
305
+ ## 8. 贡献
455
306
 
456
- Contributions are welcome! Please feel free to submit a Pull Request.
307
+ 欢迎贡献!请随时提交Pull Request
457
308
 
458
- ## 11. License
309
+ ## 9. 许可证
459
310
 
460
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
311
+ 本项目采用MIT许可证 - 详见[LICENSE](LICENSE)文件。
461
312
 
462
- ## 12. Support
313
+ ## 10. 支持
463
314
 
464
- For issues and questions, please submit an issue on the GitHub repository.
315
+ 如有问题和疑问,请在GitHub仓库上提交issue