deepfish-ai 1.0.26 → 1.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepfish-ai",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
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",
@@ -16,6 +16,7 @@ class MainAgentRobot extends BaseAgentRobot {
16
16
 
17
17
  // 初始化文件
18
18
  _initFiles(opt) {
19
+ this.logId = Date.now()
19
20
  this.workspace = opt.workspace || process.cwd() // 工作空间,目录
20
21
  this.basespace = opt.basespace || path.join(os.homedir(), '.deepfish-ai') // 记忆空间,目录
21
22
  this.userspace = path.join(this.basespace, 'user-info') // 用户空间,目录
@@ -9,6 +9,7 @@ class Logger {
9
9
  this.maxLogExpireTime = agentRobot.config.maxLogExpireTime
10
10
  this.memorySpace = agentRobot.memorySpace
11
11
  this.logTimeMap = new Map()
12
+ this.logId = agentRobot.logId || agentRobot.root.logId
12
13
  }
13
14
  clearAllLogs() {
14
15
  const fileNames = fs.readdirSync(this.memorySpace)
@@ -55,11 +56,16 @@ class Logger {
55
56
  }
56
57
  const logFile = path.join(
57
58
  this.logDirPath,
58
- `log-${dayjs().format('YYYY-MM-DD HH')}.txt`,
59
+ `log-${this.logId}-${dayjs().format('YYYY-MM-DD HH')}.txt`,
60
+ )
61
+ const logFile2 = path.join(
62
+ this.logDirPath,
63
+ `log-messeage-${this.logId}.txt`,
59
64
  )
60
65
  try {
61
66
  let logEntry = `[${new Date().toISOString()}][${message.role}] ${message.content}\n`
62
67
  fs.appendFileSync(logFile, logEntry)
68
+ fs.appendFileSync(logFile2, logEntry)
63
69
  return true
64
70
  } catch (error) {
65
71
  console.error('Failed to log message:', error.message)
@@ -72,7 +78,7 @@ class Logger {
72
78
  }
73
79
  const logFile = path.join(
74
80
  this.logDirPath,
75
- `log-${dayjs().format('YYYY-MM-DD HH')}.txt`,
81
+ `log-${this.logId}-${dayjs().format('YYYY-MM-DD HH')}.txt`,
76
82
  )
77
83
  try {
78
84
  let logEntry = `[${new Date().toISOString()}][***COMPRESS START***]
@@ -92,7 +98,7 @@ class Logger {
92
98
  }
93
99
  const logFile = path.join(
94
100
  this.logDirPath,
95
- `log-${dayjs().format('YYYY-MM-DD HH')}.txt`,
101
+ `log-${this.logId}-${dayjs().format('YYYY-MM-DD HH')}.txt`,
96
102
  )
97
103
  try {
98
104
  let logEntry = `[${new Date().toISOString()}][###############] ${message}\n`
@@ -65,6 +65,7 @@ class BaseAgentRobot {
65
65
  ) {
66
66
  this.opt = opt
67
67
  this.config = opt
68
+ this.aiConfig = opt.aiConfig || {}
68
69
  this.id = opt.id || Date.now().toString()
69
70
  this.name = opt.name || 'AgentRobot'
70
71
  this.screenPrinter = new ScreenPrinter() // 屏幕打印机