foliko 1.0.27 → 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.
|
@@ -64,7 +64,11 @@
|
|
|
64
64
|
"Bash(node -c src/core/plugin-base.js && node -c src/core/plugin-manager.js 2>&1)",
|
|
65
65
|
"Bash(node -c plugins/telegram-plugin.js && node -c plugins/weixin-plugin.js 2>&1)",
|
|
66
66
|
"Bash(node -c src/core/plugin-manager.js 2>&1)",
|
|
67
|
-
"Bash(node -c src/core/plugin-manager.js && node -c src/core/plugin-base.js && node -c plugins/default-plugins.js && node -c plugins/telegram-plugin.js && node -c plugins/weixin-plugin.js 2>&1)"
|
|
67
|
+
"Bash(node -c src/core/plugin-manager.js && node -c src/core/plugin-base.js && node -c plugins/default-plugins.js && node -c plugins/telegram-plugin.js && node -c plugins/weixin-plugin.js 2>&1)",
|
|
68
|
+
"Bash(node -e \"require\\('dotenv'\\).config\\(\\); console.log\\('PROVIDER:', process.env.FOLIKO_PROVIDER\\); console.log\\('MODEL:', process.env.FOLIKO_MODEL\\); console.log\\('KEY:', process.env.DEEPSEEK_API_KEY ? 'set' : 'not set'\\)\" 2>&1)",
|
|
69
|
+
"Bash(node cli/src/index.js chat 2>&1 | head -30)",
|
|
70
|
+
"Bash(node -e 'const { DEFAULT_PROVIDERS } = require\\(\"./src/core/provider\"\\); console.log\\(DEFAULT_PROVIDERS\\);')",
|
|
71
|
+
"Bash(node -e \"const dotenv = require\\('dotenv'\\); const result = dotenv.config\\(\\); console.log\\('Result:', result\\); console.log\\('PROVIDER after dotenv:', process.env.FOLIKO_PROVIDER\\);\" 2>&1)"
|
|
68
72
|
]
|
|
69
73
|
}
|
|
70
74
|
}
|
package/cli/src/commands/chat.js
CHANGED
package/package.json
CHANGED
package/plugins/ai-plugin.js
CHANGED
|
@@ -244,7 +244,6 @@ async function bootstrapDefaults(framework, config = {}) {
|
|
|
244
244
|
]
|
|
245
245
|
|
|
246
246
|
console.log('[Bootstrap] Loading default plugins...')
|
|
247
|
-
|
|
248
247
|
// AI 插件(如果已禁用则跳过)
|
|
249
248
|
if (!shouldLoad('ai') || !(aiConfig.provider || aiConfig.model || aiConfig.apiKey)) {
|
|
250
249
|
// 跳过或已禁用
|
package/plugins/weixin-plugin.js
CHANGED
|
@@ -24,7 +24,7 @@ module.exports = function(Plugin) {
|
|
|
24
24
|
this.config = {
|
|
25
25
|
forceLogin: config.forceLogin || process.env.WEIXIN_FORCE_LOGIN === 'true',
|
|
26
26
|
qrcodeTerminal: config.qrcodeTerminal !== false && process.env.WEIXIN_QRCODE_TERMINAL !== 'false',
|
|
27
|
-
systemPrompt: config.systemPrompt || '你是一个有帮助的AI
|
|
27
|
+
systemPrompt: config.systemPrompt || '你是一个有帮助的AI助手。回复内容不要使用markdown格式文本',
|
|
28
28
|
allowedUsers: config.allowedUsers || []
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -32,14 +32,20 @@ class PluginManager {
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* 保存插件状态到文件
|
|
35
|
+
* 注意:AI 插件配置不保存(从环境变量和命令行获取)
|
|
35
36
|
*/
|
|
36
37
|
_saveState() {
|
|
37
38
|
try {
|
|
38
39
|
const state = {}
|
|
39
40
|
for (const [name, entry] of this._plugins) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
// AI 配置不保存,每次从环境变量和命令行获取
|
|
42
|
+
if (name === 'ai') {
|
|
43
|
+
state[name] = { enabled: entry.enabled }
|
|
44
|
+
} else {
|
|
45
|
+
state[name] = {
|
|
46
|
+
enabled: entry.enabled,
|
|
47
|
+
config: entry.instance?.config || {}
|
|
48
|
+
}
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
fs.writeFileSync(this._getStateFile(), JSON.stringify(state, null, 2))
|
|
@@ -85,8 +91,8 @@ class PluginManager {
|
|
|
85
91
|
const savedEnabled = savedState[pluginInstance.name]?.enabled
|
|
86
92
|
const savedConfig = savedState[pluginInstance.name]?.config
|
|
87
93
|
|
|
88
|
-
//
|
|
89
|
-
if (savedConfig && pluginInstance.config) {
|
|
94
|
+
// 恢复保存的配置到插件实例(AI 插件不恢复配置,从环境变量获取)
|
|
95
|
+
if (savedConfig && pluginInstance.config && pluginInstance.name !== 'ai') {
|
|
90
96
|
pluginInstance.config = { ...pluginInstance.config, ...savedConfig }
|
|
91
97
|
}
|
|
92
98
|
|
package/src/core/provider.js
CHANGED
|
@@ -44,7 +44,7 @@ const DEFAULT_PROVIDERS = {
|
|
|
44
44
|
function createAI(config) {
|
|
45
45
|
const { provider, model, apiKey, baseURL } = config
|
|
46
46
|
const providerName = (provider || 'deepseek').toLowerCase()
|
|
47
|
-
|
|
47
|
+
console.log(config)
|
|
48
48
|
// 检查是否是预定义提供商
|
|
49
49
|
if (DEFAULT_PROVIDERS[providerName]) {
|
|
50
50
|
const providerConfig = DEFAULT_PROVIDERS[providerName]
|