Skip to content

Commit 98f8d8c

Browse files
authored
plugin & form input variables (#5979)
* plugin & form input variables * fix
1 parent e157a09 commit 98f8d8c

File tree

23 files changed

+1032
-682
lines changed

23 files changed

+1032
-682
lines changed
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
---
2-
title: 'V4.14.3(进行中)'
3-
description: 'FastGPT V4.14.2 更新说明'
2+
title: 'V4.14.3'
3+
description: 'FastGPT V4.14.3 更新说明'
44
---
55

66

77
## 🚀 新增内容
88

9-
1. 全局变量支持文件上传
10-
2. 知识库文件迁移至 S3(全部使用文件的地方均已迁移)
11-
3. 系统插件,插件市场中会提示是否有新版本,并提供更新按键。
12-
4. 工作流运行 QPM 限制。
9+
1. 知识库文件迁移至 S3(全部使用文件的地方均已迁移)。
10+
2. 全局变量支持文件上传。
11+
3. 表单输入节点支持密码、开关、时间点、时间范围、文件上传、对话模型选择。
12+
4. 插件输入支持多选、时间点、时间范围、内部变量。
13+
5. 系统插件,插件市场中会提示是否有新版本,并提供更新按键。
14+
6. 工作流运行 QPM 限制。
1315

1416
## ⚙️ 优化
1517

1618
1. 工作流工具,文件上传输入 UX 优化。
1719

1820
## 🐛 修复
1921

22+
1. 工作流调试预览窗口,重新渲染导致输入丢失。
23+
2024

2125
## 插件

document/data/doc-last-modified.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"document/content/docs/upgrading/4-14/4140.mdx": "2025-11-06T15:43:00+08:00",
118118
"document/content/docs/upgrading/4-14/4141.mdx": "2025-11-19T10:15:27+08:00",
119119
"document/content/docs/upgrading/4-14/4142.mdx": "2025-11-18T19:27:14+08:00",
120-
"document/content/docs/upgrading/4-14/4143.mdx": "2025-11-21T18:05:13+08:00",
120+
"document/content/docs/upgrading/4-14/4143.mdx": "2025-11-21T18:32:25+08:00",
121121
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
122122
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
123123
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",

packages/global/core/workflow/node/constant.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const FlowNodeInputMap: Record<
4949
icon: 'core/workflow/inputType/option'
5050
},
5151
[FlowNodeInputTypeEnum.multipleSelect]: {
52-
icon: 'core/workflow/inputType/option'
52+
icon: 'core/workflow/inputType/multipleSelect'
5353
},
5454
[FlowNodeInputTypeEnum.switch]: {
5555
icon: 'core/workflow/inputType/switch'
@@ -79,7 +79,7 @@ export const FlowNodeInputMap: Record<
7979
icon: 'core/workflow/inputType/selectDataset'
8080
},
8181
[FlowNodeInputTypeEnum.hidden]: {
82-
icon: 'core/workflow/inputType/select'
82+
icon: 'core/workflow/inputType/internal'
8383
},
8484
[FlowNodeInputTypeEnum.customVariable]: {
8585
icon: 'core/workflow/inputType/customVariable'

packages/global/core/workflow/runtime/type.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export type DispatchNodeResponseType = {
248248
loopOutputValue?: any;
249249

250250
// form input
251-
formInputResult?: string;
251+
formInputResult?: Record<string, any>;
252252

253253
// tool params
254254
toolParamsResult?: Record<string, any>;

packages/global/core/workflow/template/system/interactive/type.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ export type UserInputFormItemType = {
7171

7272
// input & textarea
7373
maxLength?: number;
74+
75+
// password
76+
minLength?: number;
77+
7478
// numberInput
7579
max?: number;
7680
min?: number;

packages/service/core/chat/saveChat.ts

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import { getAppChatConfig, getGuideModule } from '@fastgpt/global/core/workflow/
1111
import { type AppChatConfigType, type VariableItemType } from '@fastgpt/global/core/app/type';
1212
import { mergeChatResponseData } from '@fastgpt/global/core/chat/utils';
1313
import { pushChatLog } from './pushChatLog';
14-
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
14+
import {
15+
FlowNodeTypeEnum,
16+
FlowNodeInputTypeEnum
17+
} from '@fastgpt/global/core/workflow/node/constant';
1518
import { extractDeepestInteractive } from '@fastgpt/global/core/workflow/runtime/utils';
1619
import { MongoAppChatLog } from '../app/logs/chatLogsSchema';
1720
import { writePrimary } from '../../common/mongo/utils';
@@ -20,6 +23,8 @@ import { chatValue2RuntimePrompt } from '@fastgpt/global/core/chat/adapt';
2023
import type { ClientSession } from '../../common/mongo';
2124
import { removeS3TTL } from '../../common/s3/utils';
2225
import { VariableInputEnum } from '@fastgpt/global/core/workflow/constants';
26+
import { encryptSecretValue, anyValueDecrypt } from '../../common/secret/utils';
27+
import type { SecretValueType } from '@fastgpt/global/common/secret/type';
2328

2429
type Props = {
2530
chatId: string;
@@ -444,12 +449,30 @@ export const updateInteractiveChat = async (props: Props) => {
444449
) {
445450
finalInteractive.params.inputForm = finalInteractive.params.inputForm.map((item) => {
446451
const itemValue = parsedUserInteractiveVal[item.label];
447-
return itemValue !== undefined
448-
? {
452+
if (itemValue === undefined) return item;
453+
454+
// 如果是密码类型,加密后存储
455+
if (item.type === FlowNodeInputTypeEnum.password) {
456+
const decryptedVal = anyValueDecrypt(itemValue);
457+
if (typeof decryptedVal === 'string') {
458+
return {
449459
...item,
450-
value: itemValue
451-
}
452-
: item;
460+
value: encryptSecretValue({
461+
value: decryptedVal,
462+
secret: ''
463+
} as SecretValueType)
464+
};
465+
}
466+
return {
467+
...item,
468+
value: itemValue
469+
};
470+
}
471+
472+
return {
473+
...item,
474+
value: itemValue
475+
};
453476
});
454477
finalInteractive.params.submitted = true;
455478
} else if (finalInteractive.type === 'paymentPause') {

packages/service/core/workflow/dispatch/interactive/formInput.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import type {
88
} from '@fastgpt/global/core/workflow/runtime/type';
99
import type { UserInputFormItemType } from '@fastgpt/global/core/workflow/template/system/interactive/type';
1010
import { addLog } from '../../../../common/system/log';
11+
import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
12+
import { anyValueDecrypt } from '../../../../common/secret/utils';
1113

1214
type Props = ModuleDispatchProps<{
1315
[NodeInputKeyEnum.description]: string;
@@ -47,7 +49,7 @@ export const dispatchFormInput = async (props: Props): Promise<FormInputResponse
4749
node.isEntry = false;
4850

4951
const { text } = chatValue2RuntimePrompt(query);
50-
const userInputVal = (() => {
52+
const rawUserInputVal = (() => {
5153
try {
5254
return JSON.parse(text);
5355
} catch (error) {
@@ -56,6 +58,21 @@ export const dispatchFormInput = async (props: Props): Promise<FormInputResponse
5658
}
5759
})();
5860

61+
const userInputVal = Object.entries(rawUserInputVal).reduce(
62+
(acc, [key, value]) => {
63+
const inputConfig = userInputForms.find((form) => form.key === key);
64+
65+
if (inputConfig?.type === FlowNodeInputTypeEnum.password) {
66+
acc[key] = anyValueDecrypt(value);
67+
} else {
68+
acc[key] = value;
69+
}
70+
71+
return acc;
72+
},
73+
{} as Record<string, any>
74+
);
75+
5976
return {
6077
data: {
6178
...userInputVal,

0 commit comments

Comments
 (0)