deepfish-ai 1.0.24 → 1.0.26
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 +48 -9
- package/README_CN.md +48 -9
- package/package.json +3 -2
- package/src/AgentRobot/BaseAgentRobot/Brain.js +1 -0
- package/src/AgentRobot/BaseAgentRobot/index.js +12 -1
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/docx.js +27 -0
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/embedding.js +211 -515
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/img.js +27 -0
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/pptx.js +27 -0
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/video.js +36 -0
- package/src/AgentRobot/BaseAgentRobot/lazy-tools/xlsx.js +24 -0
- package/src/AgentRobot/BaseAgentRobot/tools/CreateAgentTools.js +1 -0
- package/src/AgentRobot/BaseAgentRobot/tools/FileTools.js +114 -22
- package/src/AgentRobot/BaseAgentRobot/tools/GenerateTools.js +6 -8
- package/src/AgentRobot/BaseAgentRobot/tools/SystemTools.js +22 -0
- package/src/AgentRobot/BaseAgentRobot/utils/AIToolManager.js +1 -0
- package/src/cli/DefaultConfig.js +0 -2
- package/src/cli/index.js +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
- [Initial Setup](#initial-setup)
|
|
44
44
|
- [Configuration Commands](#configuration-commands)
|
|
45
45
|
- [Configuration File Structure](#configuration-file-structure)
|
|
46
|
+
- [Directory Structure](#directory-structure)
|
|
46
47
|
- [5. Usage](#5-usage)
|
|
47
48
|
- [Interactive Mode](#interactive-mode)
|
|
48
49
|
- [Direct Command Mode](#direct-command-mode)
|
|
@@ -125,7 +126,7 @@ ai config add
|
|
|
125
126
|
|
|
126
127
|
This will prompt you to configure the following:
|
|
127
128
|
|
|
128
|
-
- **AI Service Type**: Choose DeepSeek, Ollama, or OpenAI
|
|
129
|
+
- **AI Service Type**: Choose DeepSeek, MiniMax, Qwen, Ollama, or OpenAI
|
|
129
130
|
- **API Base URL**: Default URL provided for each service
|
|
130
131
|
- **Model Name**: Choose the AI model to use
|
|
131
132
|
- **API Key**: Required for DeepSeek and OpenAI
|
|
@@ -156,8 +157,8 @@ ai skill disable <name|index> # Disable a skill by name or index, exp: ai skill
|
|
|
156
157
|
ai skill dir # Open the skill directory
|
|
157
158
|
|
|
158
159
|
# Memory commands
|
|
159
|
-
ai
|
|
160
|
-
ai
|
|
160
|
+
ai memory clear # Clear the history messages for the current directory
|
|
161
|
+
ai memory dir # Open the memory directory
|
|
161
162
|
```
|
|
162
163
|
|
|
163
164
|
### Configuration File Structure
|
|
@@ -181,16 +182,54 @@ export default {
|
|
|
181
182
|
],
|
|
182
183
|
currentAi: "default", // Name of the currently active AI configuration
|
|
183
184
|
maxIterations: -1, // Maximum iterations for AI to complete the workflow, -1 for unlimited
|
|
184
|
-
maxMessagesLength: 150000, // Maximum compression length, -1 for unlimited
|
|
185
|
-
maxMessagesCount: 100, // Maximum compression count, -1 for unlimited
|
|
186
185
|
maxMemoryExpireTime: 30, // Maximum session expiration time in days, -1 for unlimited, 0 to disable recording
|
|
187
186
|
maxLogExpireTime: 3, // Log expiration time in days, -1 for unlimited, 0 to disable recording
|
|
188
187
|
maxBlockFileSize: 20, // Maximum block file size in KB; files exceeding this size need to be processed in blocks
|
|
189
|
-
|
|
188
|
+
isThinkPrint: true, // Whether to print the thinking process
|
|
190
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
|
|
191
192
|
};
|
|
192
193
|
```
|
|
193
194
|
|
|
195
|
+
### Directory Structure
|
|
196
|
+
|
|
197
|
+
DeepFish uses `.deepfish-ai` as the default working directory. You can open it directly with:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
ai config dir
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Default paths:
|
|
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
|
+
```
|
|
232
|
+
|
|
194
233
|
## 5. Usage
|
|
195
234
|
|
|
196
235
|
### Interactive Mode
|
|
@@ -388,8 +427,8 @@ Conversation history is created on a per-directory basis — each execution dire
|
|
|
388
427
|
|
|
389
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:
|
|
390
429
|
|
|
391
|
-
- `ai
|
|
392
|
-
- `ai
|
|
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
|
|
393
432
|
|
|
394
433
|
## 9. Troubleshooting
|
|
395
434
|
|
|
@@ -404,7 +443,7 @@ ai config reset
|
|
|
404
443
|
### AI Service Connection
|
|
405
444
|
|
|
406
445
|
- **Ollama**: Ensure Ollama is running locally on port 11434
|
|
407
|
-
- **DeepSeek/OpenAI**: Verify your API key is correct and you have sufficient quota
|
|
446
|
+
- **DeepSeek/MiniMax/Qwen/OpenAI**: Verify your API key is correct and you have sufficient quota
|
|
408
447
|
|
|
409
448
|
### Extension Not Loading
|
|
410
449
|
|
package/README_CN.md
CHANGED
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
- [初始设置](#初始设置)
|
|
45
45
|
- [配置命令](#配置命令)
|
|
46
46
|
- [配置文件结构](#配置文件结构)
|
|
47
|
+
- [目录结构说明](#目录结构说明)
|
|
47
48
|
- [5. 使用方法](#5-使用方法)
|
|
48
49
|
- [交互模式](#交互模式)
|
|
49
50
|
- [直接命令模式](#直接命令模式)
|
|
@@ -123,7 +124,7 @@ ai config add
|
|
|
123
124
|
|
|
124
125
|
这将提示你配置以下内容:
|
|
125
126
|
|
|
126
|
-
- **AI服务类型**:选择DeepSeek、Ollama或OpenAI
|
|
127
|
+
- **AI服务类型**:选择DeepSeek、MiniMax、Qwen、Ollama或OpenAI
|
|
127
128
|
- **API基础URL**:为每个服务提供默认URL
|
|
128
129
|
- **模型名称**:选择要使用的AI模型
|
|
129
130
|
- **API密钥**:DeepSeek和OpenAI需要
|
|
@@ -154,8 +155,8 @@ ai skill disable <name|index> # 通过名称或索引禁用 skill, exp: ai skill
|
|
|
154
155
|
ai skill dir # 打开 skill 目录
|
|
155
156
|
|
|
156
157
|
# 记忆命令
|
|
157
|
-
ai
|
|
158
|
-
ai
|
|
158
|
+
ai memory clear # 清除当前目录的对话历史
|
|
159
|
+
ai memory dir # 打开记忆目录
|
|
159
160
|
```
|
|
160
161
|
|
|
161
162
|
### 配置文件结构
|
|
@@ -179,16 +180,54 @@ export default {
|
|
|
179
180
|
],
|
|
180
181
|
currentAi: "default", // 当前活动的AI配置名称
|
|
181
182
|
maxIterations: -1, // ai完成工作流的最大迭代次数,-1表示无限制
|
|
182
|
-
maxMessagesLength: 150000, // 最大压缩长度,-1表示无限制
|
|
183
|
-
maxMessagesCount: 100, // 最大压缩数量,-1表示无限制
|
|
184
183
|
maxMemoryExpireTime: 30, // 整个会话的最大过期时间,单位天,-1表示无限制,0表示不记录
|
|
185
184
|
maxLogExpireTime: 3, // 日志过期时间,单位天,-1表示无限制,0表示不记录
|
|
186
185
|
maxBlockFileSize: 20, // 最大分块文件大小,单位KB;超过该大小的文件需要分块处理
|
|
187
|
-
|
|
186
|
+
isThinkPrint: true, // 是否打印思考过程
|
|
188
187
|
encoding: "auto", // 命令行编码格式,可设置为utf-8、gbk等,也可以设置成auto或空值自动判断
|
|
188
|
+
EMBEDDING_API: "", // 向量化接口地址
|
|
189
|
+
EMBEDDING_API_KEY: "", // 向量化接口密钥
|
|
189
190
|
};
|
|
190
191
|
```
|
|
191
192
|
|
|
193
|
+
### 目录结构说明
|
|
194
|
+
|
|
195
|
+
DeepFish 默认工作目录为 `.deepfish-ai`,可通过以下命令直接打开:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
ai config dir
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
默认路径:
|
|
202
|
+
|
|
203
|
+
- Windows: `C:/Users/<用户名>/.deepfish-ai`
|
|
204
|
+
- macOS/Linux: `~/.deepfish-ai`
|
|
205
|
+
|
|
206
|
+
参考 DevPlan 的目录结构示例如下:
|
|
207
|
+
|
|
208
|
+
```text
|
|
209
|
+
.deepfish-ai/
|
|
210
|
+
├─ config.js # 全局配置
|
|
211
|
+
├─ user-info/
|
|
212
|
+
│ └─ user.md # 用户信息
|
|
213
|
+
├─ clawSkills/
|
|
214
|
+
│ ├─ clawSkills.json # OpenClaw 技能索引
|
|
215
|
+
│ └─ <skill>/
|
|
216
|
+
│ └─ SKILL.md # 单个技能说明
|
|
217
|
+
└─ memery/
|
|
218
|
+
├─ agentRecord.json # 工作目录与主 agent 映射
|
|
219
|
+
└─ <主agent编号>/
|
|
220
|
+
├─ memery.json # 主 agent 记忆
|
|
221
|
+
├─ memery-<子agent编号>.json # 子 agent 记忆
|
|
222
|
+
├─ agentTree.json # agent 组织结构
|
|
223
|
+
├─ bakup/
|
|
224
|
+
│ └─ <时间戳>/
|
|
225
|
+
│ ├─ record.json # 备份记录
|
|
226
|
+
│ └─ <uuid>.* # 备份文件
|
|
227
|
+
└─ logs/
|
|
228
|
+
└─ log-{YYYY-MM-DD HH}.txt # 按小时滚动日志
|
|
229
|
+
```
|
|
230
|
+
|
|
192
231
|
## 5. 使用方法
|
|
193
232
|
|
|
194
233
|
### 交互模式
|
|
@@ -384,8 +423,8 @@ AI始终使用相对于当前工作目录的相对路径。
|
|
|
384
423
|
|
|
385
424
|
对话历史会在一定时间内自动清除(通过配置文件中的 `maxMemoryExpireTime` 字段控制,默认为 30 天)。您也可以手动管理对话历史:
|
|
386
425
|
|
|
387
|
-
- `ai
|
|
388
|
-
- `ai
|
|
426
|
+
- `ai memory dir` — 打开记忆目录,查看已存储的对话上下文
|
|
427
|
+
- `ai memory clear` — 清除当前目录的对话历史
|
|
389
428
|
|
|
390
429
|
## 9. 故障排除
|
|
391
430
|
|
|
@@ -400,7 +439,7 @@ ai config reset
|
|
|
400
439
|
### AI服务连接
|
|
401
440
|
|
|
402
441
|
- **Ollama**:确保Ollama在本地11434端口上运行
|
|
403
|
-
- **DeepSeek/OpenAI**:验证您的API密钥是否正确,并且您有足够的额度
|
|
442
|
+
- **DeepSeek/MiniMax/Qwen/OpenAI**:验证您的API密钥是否正确,并且您有足够的额度
|
|
404
443
|
|
|
405
444
|
### 扩展未加载
|
|
406
445
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepfish-ai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
4
4
|
"description": "This is an AI-driven command-line tool built on Node.js, equipped with AI agent and workflow capabilities. It is compatible with a wide range of AI models, can convert natural language into cross-system terminal and file operation commands, and features high extensibility. It supports complex tasks such as translation, content creation, and format conversion, while allowing custom extensions to be automatically generated via AI.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"ai": "src/cli/index.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
|
+
"build": "package-offline.bat"
|
|
12
13
|
},
|
|
13
14
|
"keywords": [
|
|
14
15
|
"ai",
|
|
@@ -5,6 +5,7 @@ const BrainEvent = require('./BrainEvent.js')
|
|
|
5
5
|
const ScreenPrinter = require('./ScreenPrinter.js')
|
|
6
6
|
const { HandEvent, Hand } = require('./Hand.js')
|
|
7
7
|
const AIToolManager = require('./utils/AIToolManager.js')
|
|
8
|
+
const dayjs = require('dayjs')
|
|
8
9
|
|
|
9
10
|
class BaseAgentRobot {
|
|
10
11
|
id = '' // Agentid
|
|
@@ -187,6 +188,7 @@ class BaseAgentRobot {
|
|
|
187
188
|
当前工作目录:${workspace}
|
|
188
189
|
操作系统类型:${osType}
|
|
189
190
|
语言类型: 与用户输入语言一致
|
|
191
|
+
会话开始时间: ${dayjs().format('YYYY-MM-DD HH')}
|
|
190
192
|
|
|
191
193
|
### 工具使用
|
|
192
194
|
执行任务前,应仔细阅读工具描述以及可以使用的Skills的描述内容,优先使用匹配到的工具或技能,避免自己发挥。
|
|
@@ -207,7 +209,7 @@ class BaseAgentRobot {
|
|
|
207
209
|
|
|
208
210
|
### 用户信息
|
|
209
211
|
#### 用户信息记录规则
|
|
210
|
-
|
|
212
|
+
当对话中出现用户信息时,如个人基础信息(如姓名、昵称、年龄、职业、兴趣、性格特征等)、AI的基础信息(如昵称、性格特征等)、操作习惯、代码习惯、阅读习惯、用户常用目录等,必须使用用户信息读写函数进行记录。
|
|
211
213
|
|
|
212
214
|
#### 当前用户信息
|
|
213
215
|
----user info start----
|
|
@@ -216,6 +218,15 @@ ${this.toolManager.functions.readUserInfo()}
|
|
|
216
218
|
`
|
|
217
219
|
}
|
|
218
220
|
|
|
221
|
+
// 更新系统提示词中的会话开始时间
|
|
222
|
+
updateSessionTime() {
|
|
223
|
+
const newTime = dayjs().format('YYYY-MM-DD HH')
|
|
224
|
+
this.systemPrompt = this.systemPrompt.replace(
|
|
225
|
+
/会话开始时间: \d{4}-\d{2}-\d{2} \d{2}/,
|
|
226
|
+
`会话开始时间: ${newTime}`,
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
|
|
219
230
|
async executeTask(goal) {
|
|
220
231
|
const taskId = `task-${Date.now()}`
|
|
221
232
|
this.logger.logExecTime(taskId, 'execute task goal')
|
|
@@ -876,7 +876,33 @@ async function patchDocxText(filePath, replacements) {
|
|
|
876
876
|
|
|
877
877
|
// ─── 工具描述 ─────────────────────────────────────────────────────────────────
|
|
878
878
|
|
|
879
|
+
|
|
880
|
+
// ─── 使用说明 ─────────────────────────────────────────────────────────────────
|
|
881
|
+
|
|
882
|
+
function docxReadme() {
|
|
883
|
+
return `【DOCX 工具使用说明】
|
|
884
|
+
1. 优先使用本工具内置函数完成任务(读取、创建、搜索、替换、模板填充、格式转换、合并等)。
|
|
885
|
+
2. 如果内置函数无法满足需求(如复杂排版保真、特殊宏处理、跨格式高级转换),再尝试使用 LibreOffice 命令行。
|
|
886
|
+
3. 在调用 LibreOffice 前,先检测系统是否已安装 LibreOffice:
|
|
887
|
+
- 已安装:直接使用 LibreOffice 命令行继续处理。
|
|
888
|
+
- 未安装:询问用户是否允许安装。
|
|
889
|
+
4. 若用户同意安装:引导完成安装后继续执行原任务。
|
|
890
|
+
5. 若用户拒绝安装:明确告知当前能力限制,并终止该操作。
|
|
891
|
+
|
|
892
|
+
建议:
|
|
893
|
+
- 常规文档处理优先使用内置函数,速度更快且依赖更少。
|
|
894
|
+
- 仅在确实需要高保真格式转换或复杂排版时才启用 LibreOffice 路径。`
|
|
895
|
+
}
|
|
896
|
+
|
|
879
897
|
const descriptions = [
|
|
898
|
+
{
|
|
899
|
+
type: 'function',
|
|
900
|
+
function: {
|
|
901
|
+
name: 'docxReadme',
|
|
902
|
+
description: '获取 DOCX 工具集的使用说明, 调用函数前必须先查看本说明。',
|
|
903
|
+
parameters: {},
|
|
904
|
+
}
|
|
905
|
+
},
|
|
880
906
|
{
|
|
881
907
|
type: 'function',
|
|
882
908
|
function: {
|
|
@@ -1224,6 +1250,7 @@ const descriptions = [
|
|
|
1224
1250
|
// ─── 导出 ──────────────────────────────────────────────────────────────────────
|
|
1225
1251
|
|
|
1226
1252
|
const functions = {
|
|
1253
|
+
docxReadme,
|
|
1227
1254
|
readDocxText,
|
|
1228
1255
|
readDocxHtml,
|
|
1229
1256
|
getDocxInfo,
|