foliko 1.0.44 → 1.0.47
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 +1 -1
- package/Dockerfile +6 -6
- package/docker-compose.yml +2 -2
- package/package.json +1 -1
- package/plugins/web-plugin.js +12 -9
package/.env.example
CHANGED
package/Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# ========== Foliko - 插件化 Agent 框架 ==========
|
|
2
2
|
# 基于 Node.js 20 LTS
|
|
3
3
|
|
|
4
|
-
FROM node:
|
|
4
|
+
FROM node:25-slim
|
|
5
5
|
|
|
6
6
|
# 安装 Python 和构建工具(部分 npm 包需要编译)
|
|
7
7
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
@@ -14,7 +14,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
14
14
|
&& ln -sf /usr/bin/python3 /usr/bin/python
|
|
15
15
|
|
|
16
16
|
# 安装 uv(快速的 Python 包管理器)
|
|
17
|
-
RUN
|
|
17
|
+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
18
|
+
ENV PATH="/root/.local/bin:$PATH"
|
|
18
19
|
|
|
19
20
|
# 设置工作目录
|
|
20
21
|
WORKDIR /app
|
|
@@ -23,13 +24,12 @@ WORKDIR /app
|
|
|
23
24
|
RUN npm install -g foliko
|
|
24
25
|
|
|
25
26
|
# 暴露端口
|
|
26
|
-
#
|
|
27
|
-
EXPOSE
|
|
27
|
+
# 3000: Web 服务端口
|
|
28
|
+
EXPOSE 3000
|
|
28
29
|
|
|
29
30
|
# 环境变量(可以在 docker-compose 或运行时覆盖)
|
|
30
31
|
ENV NODE_ENV=production
|
|
31
|
-
|
|
32
|
-
ENV WEB_HOST=127.0.0.1
|
|
32
|
+
|
|
33
33
|
|
|
34
34
|
# 默认命令:运行聊天界面
|
|
35
35
|
CMD ["foliko", "chat"]
|
package/docker-compose.yml
CHANGED
|
@@ -7,7 +7,7 @@ services:
|
|
|
7
7
|
container_name: foliko-agent
|
|
8
8
|
restart: unless-stopped
|
|
9
9
|
ports:
|
|
10
|
-
- "
|
|
10
|
+
- "3000:3000"
|
|
11
11
|
environment:
|
|
12
12
|
# AI 配置
|
|
13
13
|
- FOLIKO_PROVIDER=${FOLIKO_PROVIDER:-minimax}
|
|
@@ -15,7 +15,7 @@ services:
|
|
|
15
15
|
- FOLIKO_BASE_URL=${FOLIKO_BASE_URL:-}
|
|
16
16
|
- FOLIKO_API_KEY=${FOLIKO_API_KEY:-}
|
|
17
17
|
# Web 服务配置
|
|
18
|
-
- WEB_PORT=
|
|
18
|
+
- WEB_PORT=3000
|
|
19
19
|
- WEB_HOST=0.0.0.0
|
|
20
20
|
- WEB_BASE_URL=${WEB_BASE_URL:-}
|
|
21
21
|
# Telegram 配置(可选)
|
package/package.json
CHANGED
package/plugins/web-plugin.js
CHANGED
|
@@ -19,9 +19,9 @@ class WebPlugin extends Plugin {
|
|
|
19
19
|
this.priority = 50
|
|
20
20
|
|
|
21
21
|
// 服务器配置
|
|
22
|
-
this._port =
|
|
23
|
-
this._host =
|
|
24
|
-
this._baseUrl =
|
|
22
|
+
this._port = process.env.WEB_PORT || 3000
|
|
23
|
+
this._host = process.env.WEB_HOST || '127.0.0.1'
|
|
24
|
+
this._baseUrl = process.env.WEB_BASE_URL || null // 公网可访问的域名
|
|
25
25
|
|
|
26
26
|
// 运行时状态
|
|
27
27
|
this._server = null
|
|
@@ -157,12 +157,15 @@ class WebPlugin extends Plugin {
|
|
|
157
157
|
port: this._port,
|
|
158
158
|
hostname: this._host
|
|
159
159
|
})
|
|
160
|
-
|
|
160
|
+
const serverUrl = this._getUrl()
|
|
161
|
+
console.log(`[Web] Server started on ${serverUrl}`)
|
|
161
162
|
return {
|
|
162
163
|
success: true,
|
|
163
|
-
message: `Server started on
|
|
164
|
-
port: this._port,
|
|
165
|
-
host: this._host
|
|
164
|
+
message: `Server started on ${serverUrl}`,
|
|
165
|
+
// port: this._port,
|
|
166
|
+
// host: this._host,
|
|
167
|
+
host: serverUrl,
|
|
168
|
+
url:serverUrl,
|
|
166
169
|
}
|
|
167
170
|
} catch (err) {
|
|
168
171
|
this._server = null
|
|
@@ -406,7 +409,7 @@ class WebPlugin extends Plugin {
|
|
|
406
409
|
}
|
|
407
410
|
|
|
408
411
|
_listRoutes() {
|
|
409
|
-
const baseUrl = this._getUrl(
|
|
412
|
+
const baseUrl = this._getUrl()
|
|
410
413
|
|
|
411
414
|
return {
|
|
412
415
|
success: true,
|
|
@@ -477,7 +480,7 @@ class WebPlugin extends Plugin {
|
|
|
477
480
|
return query
|
|
478
481
|
}
|
|
479
482
|
|
|
480
|
-
_getUrl(path) {
|
|
483
|
+
_getUrl(path='') {
|
|
481
484
|
if (this._baseUrl) {
|
|
482
485
|
return `${this._baseUrl}${path}`
|
|
483
486
|
}
|