Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 开启文件上传开关时设置默认值 #1655

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/application/flow/workflow_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, _id: str, _type: str, x: int, y: int, properties: dict, **kwa
self.__setattr__(keyword, kwargs.get(keyword))


end_nodes = ['ai-chat-node', 'reply-node', 'function-node', 'function-lib-node', 'application-node']
end_nodes = ['ai-chat-node', 'reply-node', 'function-node', 'function-lib-node', 'application-node', 'image-understand-node']


class Flow:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code difference from the given information:

class Flow:
   ...

Expand Down
1 change: 1 addition & 0 deletions ui/src/workflow/common/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const end_nodes: Array<string> = [
WorkflowType.Reply,
WorkflowType.FunctionLib,
WorkflowType.FunctionLibCustom,
WorkflowType.ImageUnderstandNode,
WorkflowType.Application
]
export class WorkFlowInstance {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码中缺少一个分号来结束一行,在 export 块中,需要确保每行都有适当的缩进,并正确使用单引号。

以下是修正后的代码:

const end_nodes: Array<string> = [ // 将这里的 {} 改为 [[]]

    WorkflowType.Reply,
    WorkflowType.FunctionLib,
    WorkflowType_functionLibCustom,
    WorkflowType_ImageUnderstandNode,

    WorkflowType.Application
];

这段修改应该没有不合规或潜在问题;如果还存在问题,请告知。

Expand Down
11 changes: 10 additions & 1 deletion ui/src/workflow/nodes/base-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,17 @@ const refreshTTSForm = (data: any) => {
form_data.value.tts_model_params_setting = data
}

const default_upload_setting = {
maxFiles: 3,
fileLimit: 50,
document: true,
image: false,
audio: false,
video: false
}

const openFileUploadSettingDialog = () => {
FileUploadSettingDialogRef.value?.open(form_data.value.file_upload_setting)
FileUploadSettingDialogRef.value?.open(form_data.value.file_upload_setting || default_upload_setting)
}

const refreshFileUploadForm = (data: any) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码中的问题是:在更新文件上传设置对话框时,原始数据和默认值被覆盖。

解决方案:
需要将form_data.value.file_upload_setting变量重命名,并使用默认值初始化它。这应为:

const defaultUploadSettings = {
  maximumFileSize: new BigInteger(50*1024),
};
...

此外,在FileUploadSettingDialogRef.value.open()函数中传递参数时,请确保正确引用正确的对象(即上标)。例如:

如果要打开一个名为upload_dialog_settings的表单,应当这样写:

FileUploadSettingDialogRef.value?.open(upload_dialog);

这是更安全的方式,特别是在处理用户输入或配置项的地方。
其他地方可能需要注意的是,fileLimit应该是新的数字而不是字符串'50'

Expand Down
Loading