Skip to content

Commit 95f0166

Browse files
authored
sandbox version (#6497)
* sandbox version * add sandbox log * update lock * fix * fix: sandbox * doc * add console * i18n
1 parent 9284890 commit 95f0166

File tree

15 files changed

+144
-3657
lines changed

15 files changed

+144
-3657
lines changed

document/content/docs/introduction/guide/dashboard/workflow/sandbox-v2.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async function main({data1, data2}){
3434
}
3535
```
3636

37-
**Python** — 在 main 函数参数中按变量名接收:
37+
**Python** — 在 main 函数参数中按变量名接收, 节点里输入的变量名一定要与`main`中的变量名一致,顺序可以任意
3838

3939
```python
4040
def main(data1, data2):

document/content/docs/self-host/upgrading/4-14/4148.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ description: 'FastGPT V4.14.8 更新说明'
77
## 🚀 新增内容
88

99
1. Next.js 版本升级到 15。
10+
2. 重构代码沙盒。
1011

1112
## ⚙️ 优化
1213

document/data/doc-last-modified.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"document/content/docs/introduction/guide/dashboard/workflow/reply.en.mdx": "2026-02-26T22:14:30+08:00",
8181
"document/content/docs/introduction/guide/dashboard/workflow/reply.mdx": "2025-07-23T21:35:03+08:00",
8282
"document/content/docs/introduction/guide/dashboard/workflow/sandbox-v2.en.mdx": "2026-02-28T12:36:59+08:00",
83-
"document/content/docs/introduction/guide/dashboard/workflow/sandbox-v2.mdx": "2026-02-28T12:36:59+08:00",
83+
"document/content/docs/introduction/guide/dashboard/workflow/sandbox-v2.mdx": "2026-03-03T23:31:51+08:00",
8484
"document/content/docs/introduction/guide/dashboard/workflow/sandbox.en.mdx": "2026-02-26T22:14:30+08:00",
8585
"document/content/docs/introduction/guide/dashboard/workflow/sandbox.mdx": "2026-02-28T12:36:59+08:00",
8686
"document/content/docs/introduction/guide/dashboard/workflow/text_editor.en.mdx": "2026-02-26T22:14:30+08:00",
@@ -232,7 +232,7 @@
232232
"document/content/docs/self-host/upgrading/4-14/4147.en.mdx": "2026-03-03T17:39:47+08:00",
233233
"document/content/docs/self-host/upgrading/4-14/4147.mdx": "2026-03-03T17:39:47+08:00",
234234
"document/content/docs/self-host/upgrading/4-14/4148.en.mdx": "2026-03-03T17:39:47+08:00",
235-
"document/content/docs/self-host/upgrading/4-14/4148.mdx": "2026-03-03T17:39:47+08:00",
235+
"document/content/docs/self-host/upgrading/4-14/4148.mdx": "2026-03-03T22:26:25+08:00",
236236
"document/content/docs/self-host/upgrading/outdated/40.en.mdx": "2026-03-03T17:39:47+08:00",
237237
"document/content/docs/self-host/upgrading/outdated/40.mdx": "2026-03-03T17:39:47+08:00",
238238
"document/content/docs/self-host/upgrading/outdated/41.en.mdx": "2026-03-03T17:39:47+08:00",

packages/service/common/logger/categories.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export const LogCategories = {
4444
INTERACTIVE: ['workflow', 'interactive'],
4545
OPTIMIZE_CODE: ['workflow', 'optimize-code'],
4646
STATUS: ['workflow', 'status'],
47-
TOOLS: ['workflow', 'tools']
47+
TOOLS: ['workflow', 'tools'],
48+
CODE_SANDBOX: ['workflow', 'code-sandbox']
4849
}),
4950
APP: Object.assign(['app'], {
5051
EVALUATION: ['app', 'evaluation'],

packages/service/thirdProvider/codeSandbox/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { SandboxCodeTypeEnum } from '@fastgpt/global/core/workflow/template/system/sandbox/constants';
22
import type { AxiosInstance } from 'axios';
33
import axios from 'axios';
4+
import { getLogger, LogCategories } from '../../common/logger';
5+
const logger = getLogger(LogCategories.MODULE.WORKFLOW.CODE_SANDBOX);
46

57
export type SanndboxPackagesResponse = {
68
js: string[];
@@ -28,6 +30,7 @@ export class CodeSandbox {
2830
(response) => {
2931
const data = response.data;
3032
if (!data.success) {
33+
logger.warn('Request code sandbox failed', { data });
3134
return Promise.reject(new Error(data.message || 'Request code sandbox failed'));
3235
}
3336
return response.data;

packages/web/i18n/en/workflow.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"code_allow_packages": "Available dependencies",
3434
"code_allow_packages_func": "Available packages: {{modules}}\nGlobal functions: {{globals}}",
3535
"code_execution": "Code Sandbox",
36-
"code_sandbox_intro": "Execute a piece of script code, usually used for complex data processing.",
36+
"code_sandbox_intro": "Executing a script code in the sandbox can be used to perform complex data processing, but the syntax and available dependencies will be limited.",
3737
"collection_metadata_filter": "Collection Metadata Filter",
3838
"complete_extraction_result": "Complete Extraction Result",
3939
"complete_extraction_result_description": "A JSON string, e.g., {\"name\":\"YY\",\"Time\":\"2023/7/2 18:00\"}",

packages/web/i18n/zh-CN/workflow.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"code_allow_packages": "可用依赖",
3434
"code_allow_packages_func": "可用依赖: {{modules}}\n全局函数: {{globals}}",
3535
"code_execution": "代码运行",
36-
"code_sandbox_intro": "执行一段脚本代码,通常用于进行复杂的数据处理",
36+
"code_sandbox_intro": "在沙盒里执行一段脚本代码,可用于进行复杂的数据处理,语法和可用依赖会受到限制",
3737
"collection_metadata_filter": "集合元数据过滤",
3838
"complete_extraction_result": "完整提取结果",
3939
"complete_extraction_result_description": "一个 JSON 字符串,例如:{\"name:\":\"YY\",\"Time\":\"2023/7/2 18:00\"}",

packages/web/i18n/zh-Hant/workflow.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"code_allow_packages": "可用依賴",
3434
"code_allow_packages_func": "可用依賴: {{modules}}\n全域函數: {{globals}}",
3535
"code_execution": "程式碼執行",
36-
"code_sandbox_intro": "執行一段腳本程式碼,通常用於進行複雜的資料處理",
36+
"code_sandbox_intro": "在沙盒裡執行一段腳本程式碼,可用於進行複雜的資料處理,語法和可用依賴會受到限制",
3737
"collection_metadata_filter": "資料集詮釋資料篩選器",
3838
"complete_extraction_result": "完整擷取結果",
3939
"complete_extraction_result_description": "一個 JSON 字串,例如:{\"name\":\"YY\",\"Time\":\"2023/7/2 18:00\"}",

0 commit comments

Comments
 (0)