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: 开启文件上传开关时设置默认值 #1656

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

shaohuzhang1
Copy link
Contributor

fix: 图片理解节点可以作为结束节点 --bug=1049088 --user=刘瑞斌 【应用编排】图片理解模型应该可以作为结束节点 https://www.tapd.cn/57709429/s/1612298
fix: 开启文件上传开关时设置默认值 --bug=1049087 --user=刘瑞斌 【应用编排】开启文件上传后,全局变量列表没有自动生成文件变量 https://www.tapd.cn/57709429/s/1612303

--bug=1049088 --user=刘瑞斌 【应用编排】图片理解模型应该可以作为结束节点 https://www.tapd.cn/57709429/s/1612298
--bug=1049087 --user=刘瑞斌 【应用编排】开启文件上传后,全局变量列表没有自动生成文件变量 https://www.tapd.cn/57709429/s/1612303
Copy link

f2c-ci-robot bot commented Nov 19, 2024

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

f2c-ci-robot bot commented Nov 19, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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)
}

Choose a reason for hiding this comment

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

该段代码中的一个主要问题在于 v-model 绑定的形式为错误的。在Vue中,您需要使用双向绑定来实现值与视图之间的动态更新(.data().computed),而不是简单的“==” 连接符。

例如,您可以修改您的代码部分如下:

  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');
} 

此修改后的版本现在可以正确地显示两个值,并且它们之间是双向绑定而不是简单比较。

@@ -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.

该段文字内容没有明显的错误或问题,但是有几点可以提到改进的地方:首先,根据上下文,在变量__setattr__(keyword, kwargs.get(keyword))之前应该加一句缩进,使语法正确;其次,最后一行类定义中的class Flow:前也应该有一个冒号“:”以确保代码结构清晰易读。其他方面已经很理想了。

@@ -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.

这个代码似乎没有不规范或问题。它是一个用于实例化工作流程对象的类,其中包含了类型数组 end_nodes 和一个构造函数。

然而,在实际应用中可能有以下建议:

  1. 如果 "ImageUnderstandNode" 是一个新的概念,则创建该类型的子节点可能是不必要的。
  2. 建议使用 ES6 类的方式(避免 TypeScript 扩展)和导入导出机制简化代码结构以使逻辑更加清晰,并易于扩展修改。
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 的可枚举模式,请确保在引入时保持兼容性。

@liuruibin liuruibin merged commit 547b2bd into main Nov 19, 2024
4 of 5 checks passed
@liuruibin liuruibin deleted the pr@main@fix_file_upload branch November 19, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants