-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: 开启文件上传开关时设置默认值 #1656
fix: 开启文件上传开关时设置默认值 #1656
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ const end_nodes: Array<string> = [ | |
WorkflowType.Reply, | ||
WorkflowType.FunctionLib, | ||
WorkflowType.FunctionLibCustom, | ||
WorkflowType.ImageUnderstandNode, | ||
WorkflowType.Application | ||
] | ||
export class WorkFlowInstance { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个代码似乎没有不规范或问题。它是一个用于实例化工作流程对象的类,其中包含了类型数组 然而,在实际应用中可能有以下建议:
export class WorkFlowInstance {
private readonly nodesByState: Record<
NodeInstanceState | StateTransition,
(node: WorkflowNode) => Promise<any>
>;
constructor(endNodes?: string[], initialState?: any) {
// 初始化状态映射表,以便根据节点的状态调用其相应的任务处理方法
this.nodesByState = new Map([[
undefined,
node =>
new Promise((resolve, reject) => {
node.handleRequest(
{ contextId: 'some', data: { someDataKey: 'someVal' } },
resolve,
reject
);
})
]]);
if (initialState) {
this.setState(initialState);
}
}
getInitialState(): unknown[] {
return [];
}
setState(state?: unknown[]): void {}
} 这是基于您提供的原始文本做出的部分修改,但请注意,如果您打算将此文件转换为 ES6 的可枚举模式,请确保在引入时保持兼容性。 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,7 @@ | |
<Setting /> | ||
</el-icon> | ||
</el-button> | ||
<el-switch size="small" v-model="form_data.file_upload_enable"/> | ||
<el-switch size="small" v-model="form_data.file_upload_enable" @change="switchFileUpload"/> | ||
</div> | ||
</div> | ||
</template> | ||
|
@@ -382,6 +382,22 @@ const refreshTTSForm = (data: any) => { | |
form_data.value.tts_model_params_setting = data | ||
} | ||
|
||
|
||
const switchFileUpload = () => { | ||
const default_upload_setting = { | ||
maxFiles: 3, | ||
fileLimit: 50, | ||
document: true, | ||
image: false, | ||
audio: false, | ||
video: false | ||
} | ||
|
||
if (form_data.value.file_upload_enable) { | ||
form_data.value.file_upload_setting = form_data.value.file_upload_setting || default_upload_setting | ||
props.nodeModel.graphModel.eventCenter.emit('refreshFileUploadConfig') | ||
} | ||
} | ||
const openFileUploadSettingDialog = () => { | ||
FileUploadSettingDialogRef.value?.open(form_data.value.file_upload_setting) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 该段代码中的一个主要问题在于 例如,您可以修改您的代码部分如下: form_data.value.tts_model_params_setting = data; 和 if (form_data.value.file_upload_enable) {
form_data.value.file_upload_settings = ... // 或者直接将数据赋给 value 属性以进行计算
props.nodeModel.graphModel.eventCenter.emit('refreshFileUploadConfig');
} 此修改后的版本现在可以正确地显示两个值,并且它们之间是双向绑定而不是简单比较。 |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
该段文字内容没有明显的错误或问题,但是有几点可以提到改进的地方:首先,根据上下文,在变量
__setattr__(keyword, kwargs.get(keyword))
之前应该加一句缩进,使语法正确;其次,最后一行类定义中的class Flow:
前也应该有一个冒号“:”以确保代码结构清晰易读。其他方面已经很理想了。