foliko 1.0.76 → 1.0.77

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/.env.example CHANGED
@@ -1,4 +1,6 @@
1
- # ========== AI Configuration ==========
1
+ # ========== AI Configuration ==========
2
+ # 最大输出 tokens(影响 AI 回复长度)
3
+ MAX_OUTPUT_TOKENS=8192
2
4
  # AI Provider: minimax, deepseek, openai, anthropic 等
3
5
  FOLIKO_PROVIDER=minimax
4
6
 
@@ -94,7 +94,7 @@ async function chatCommand(args) {
94
94
  baseURL: options.baseURL,
95
95
  apiKey: options.apiKey,
96
96
  providerOptions: {
97
- maxOutputTokens: 8192,
97
+ maxOutputTokens: parseInt(process.env.MAX_OUTPUT_TOKENS) || 8192,
98
98
  },
99
99
  },
100
100
  });
package/package.json CHANGED
@@ -1,81 +1,81 @@
1
- {
2
- "name": "foliko",
3
- "version": "1.0.76",
4
- "description": "简约的插件化 Agent 框架",
5
- "main": "src/index.js",
6
- "type": "commonjs",
7
- "bin": {
8
- "foliko": "./cli/bin/foliko.js"
9
- },
10
- "scripts": {
11
- "start": "node examples/basic.js",
12
- "chat": "node cli/bin/foliko.js chat",
13
- "dev": "node --watch examples/basic.js",
14
- "lint": "echo \"No linter configured\"",
15
- "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,yaml,yml,md,css,html}\"",
16
- "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,yaml,yml,md,css,html}\"",
17
- "prepare": "husky"
18
- },
19
- "lint-staged": {
20
- "*.{js,jsx,ts,tsx}": [
21
- "prettier --write"
22
- ],
23
- "*.{json,yaml,yml}": [
24
- "prettier --write"
25
- ],
26
- "*.{md,mdx}": [
27
- "prettier --write"
28
- ],
29
- "*.{css,scss,less}": [
30
- "prettier --write"
31
- ],
32
- "*.{html,svg}": [
33
- "prettier --write"
34
- ]
35
- },
36
- "engines": {
37
- "node": ">=18.0.0"
38
- },
39
- "keywords": [
40
- "agent",
41
- "ai",
42
- "framework",
43
- "plugin",
44
- "claude",
45
- "openai",
46
- "anthropic"
47
- ],
48
- "author": "",
49
- "license": "MIT",
50
- "dependencies": {
51
- "@ai-sdk/anthropic": "^3.0.58",
52
- "@ai-sdk/mcp": "^1.0.25",
53
- "@ai-sdk/openai": "^3.0.41",
54
- "@ai-sdk/openai-compatible": "^2.0.35",
55
- "@anthropic-ai/sdk": "^0.39.0",
56
- "@chnak/weixin-bot": "^1.2.1",
57
- "@hono/node-server": "^1.19.11",
58
- "@larksuiteoapi/node-sdk": "^1.59.0",
59
- "@modelcontextprotocol/sdk": "^1.27.1",
60
- "ai": "^6.0.116",
61
- "dotenv": "^17.3.1",
62
- "hono": "^4.12.9",
63
- "imap-mkl": "^1.0.2",
64
- "mailparser": "^3.7.2",
65
- "marked": "^11.2.0",
66
- "marked-terminal": "6",
67
- "node-cron": "^4.2.1",
68
- "node-telegram-bot-api": "^0.67.0",
69
- "nodemailer": "^6.10.0",
70
- "qrcode-terminal": "^0.12.0",
71
- "remove-markdown": "^0.6.3",
72
- "tiktoken": "^1.0.22",
73
- "vm2": "^3.10.5",
74
- "zod": "^3.24.0"
75
- },
76
- "devDependencies": {
77
- "husky": "^9.1.7",
78
- "lint-staged": "^16.4.0",
79
- "prettier": "^3.8.1"
80
- }
81
- }
1
+ {
2
+ "name": "foliko",
3
+ "version": "1.0.77",
4
+ "description": "简约的插件化 Agent 框架",
5
+ "main": "src/index.js",
6
+ "type": "commonjs",
7
+ "bin": {
8
+ "foliko": "./cli/bin/foliko.js"
9
+ },
10
+ "scripts": {
11
+ "start": "node examples/basic.js",
12
+ "chat": "node cli/bin/foliko.js chat",
13
+ "dev": "node --watch examples/basic.js",
14
+ "lint": "echo \"No linter configured\"",
15
+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,yaml,yml,md,css,html}\"",
16
+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,yaml,yml,md,css,html}\"",
17
+ "prepare": "husky"
18
+ },
19
+ "lint-staged": {
20
+ "*.{js,jsx,ts,tsx}": [
21
+ "prettier --write"
22
+ ],
23
+ "*.{json,yaml,yml}": [
24
+ "prettier --write"
25
+ ],
26
+ "*.{md,mdx}": [
27
+ "prettier --write"
28
+ ],
29
+ "*.{css,scss,less}": [
30
+ "prettier --write"
31
+ ],
32
+ "*.{html,svg}": [
33
+ "prettier --write"
34
+ ]
35
+ },
36
+ "engines": {
37
+ "node": ">=18.0.0"
38
+ },
39
+ "keywords": [
40
+ "agent",
41
+ "ai",
42
+ "framework",
43
+ "plugin",
44
+ "claude",
45
+ "openai",
46
+ "anthropic"
47
+ ],
48
+ "author": "",
49
+ "license": "MIT",
50
+ "dependencies": {
51
+ "@ai-sdk/anthropic": "^3.0.58",
52
+ "@ai-sdk/mcp": "^1.0.25",
53
+ "@ai-sdk/openai": "^3.0.41",
54
+ "@ai-sdk/openai-compatible": "^2.0.35",
55
+ "@anthropic-ai/sdk": "^0.39.0",
56
+ "@chnak/weixin-bot": "^1.2.1",
57
+ "@hono/node-server": "^1.19.11",
58
+ "@larksuiteoapi/node-sdk": "^1.59.0",
59
+ "@modelcontextprotocol/sdk": "^1.27.1",
60
+ "ai": "^6.0.116",
61
+ "dotenv": "^17.3.1",
62
+ "hono": "^4.12.9",
63
+ "imap-mkl": "^1.0.2",
64
+ "mailparser": "^3.7.2",
65
+ "marked": "^11.2.0",
66
+ "marked-terminal": "6",
67
+ "node-cron": "^4.2.1",
68
+ "node-telegram-bot-api": "^0.67.0",
69
+ "nodemailer": "^6.10.0",
70
+ "qrcode-terminal": "^0.12.0",
71
+ "remove-markdown": "^0.6.3",
72
+ "tiktoken": "^1.0.22",
73
+ "vm2": "^3.10.5",
74
+ "zod": "^3.24.0"
75
+ },
76
+ "devDependencies": {
77
+ "husky": "^9.1.7",
78
+ "lint-staged": "^16.4.0",
79
+ "prettier": "^3.8.1"
80
+ }
81
+ }
@@ -23,7 +23,7 @@ class AIPlugin extends Plugin {
23
23
  apiKey: config.apiKey,
24
24
  baseURL: config.baseURL,
25
25
  maxSteps: config.maxSteps || 20,
26
- maxOutputTokens:config.maxOutputTokens||8192
26
+ maxOutputTokens:config.maxOutputTokens||parseInt(process.env.MAX_OUTPUT_TOKENS)||8192
27
27
  }
28
28
 
29
29
  this._aiClient = null
package/src/core/agent.js CHANGED
@@ -30,7 +30,7 @@ class Agent extends EventEmitter {
30
30
  this.baseURL = config.baseURL;
31
31
  this.provider = config.provider || 'deepseek';
32
32
  this.providerOptions = config.providerOptions || {};
33
- this.providerOptions.maxOutputTokens = 8192;
33
+ this.providerOptions.maxOutputTokens = parseInt(process.env.MAX_OUTPUT_TOKENS) || 8192;
34
34
  this.providerOptions.temperature = 0.3; // 降低 temperature 减少生成错误 JSON 的概率
35
35
  // 原始 system prompt
36
36
  this._originalPrompt =