foliko 1.0.44 → 1.0.46
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 +5 -5
- package/package.json +1 -1
- package/plugins/web-plugin.js +10 -8
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
|
|
@@ -24,12 +25,11 @@ RUN npm install -g foliko
|
|
|
24
25
|
|
|
25
26
|
# 暴露端口
|
|
26
27
|
# 8088: Web 服务端口
|
|
27
|
-
EXPOSE
|
|
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/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,14 @@ 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
|
+
message: `Server started on ${serverUrl}`,
|
|
164
165
|
port: this._port,
|
|
165
|
-
host: this._host
|
|
166
|
+
host: this._host,
|
|
167
|
+
url: serverUrl
|
|
166
168
|
}
|
|
167
169
|
} catch (err) {
|
|
168
170
|
this._server = null
|
|
@@ -406,7 +408,7 @@ class WebPlugin extends Plugin {
|
|
|
406
408
|
}
|
|
407
409
|
|
|
408
410
|
_listRoutes() {
|
|
409
|
-
const baseUrl = this._getUrl(
|
|
411
|
+
const baseUrl = this._getUrl()
|
|
410
412
|
|
|
411
413
|
return {
|
|
412
414
|
success: true,
|
|
@@ -477,7 +479,7 @@ class WebPlugin extends Plugin {
|
|
|
477
479
|
return query
|
|
478
480
|
}
|
|
479
481
|
|
|
480
|
-
_getUrl(path) {
|
|
482
|
+
_getUrl(path='') {
|
|
481
483
|
if (this._baseUrl) {
|
|
482
484
|
return `${this._baseUrl}${path}`
|
|
483
485
|
}
|