-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Variable aggregation #4212
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
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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <template> | ||
| <el-avatar shape="square" style="background: #7F3BF5"> | ||
| <img src="@/assets/workflow/icon_aggregation.svg" style="width: 100%" alt="" /> | ||
| </el-avatar> | ||
| </template> | ||
| <script setup lang="ts"></script> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import VariableAggregationNodeVue from './index.vue' | ||
| import { AppNode, AppNodeModel } from '@/workflow/common/app-node' | ||
|
|
||
| class VariableAggregationNode extends AppNode { | ||
| constructor(props: any) { | ||
| super(props, VariableAggregationNodeVue) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| export default { | ||
| type: 'variable-aggregation-node', | ||
| model: AppNodeModel, | ||
| view: VariableAggregationNode, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <template> | ||
| <div> | ||
| <span>变量聚合</span> | ||
| </div> | ||
| </template> | ||
| <script setup lang="ts"> | ||
| import { set, groupBy, cloneDeep } from 'lodash' | ||
| import NodeCascader from '@/workflow/common/NodeCascader.vue' | ||
| import NodeContainer from '@/workflow/common/NodeContainer.vue' | ||
| import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue' | ||
| import type { FormInstance } from 'element-plus' | ||
| import { ref, computed, onMounted, inject } from 'vue' | ||
| import { isLastNode } from '@/workflow/common/data' | ||
| import { t } from '@/locales' | ||
| import { useRoute } from 'vue-router' | ||
| import { randomId } from '@/utils/common' | ||
| import { loadSharedApi } from '@/utils/dynamics-api/shared-api' | ||
| </script> | ||
| <style lang="scss" scoped></style> | ||
|
Contributor
Author
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. The provided Vue component template has a few issues and improvements that can be made:
Here's the corrected and optimized version of the code snippet: <template>
<div>
<span>变量聚合</span>
</div>
</template>
<script setup lang="ts">
import { set, groupBy, cloneDeep } from 'lodash'
import NodeContainer from '@/workflow/common/NodeContainer.vue'
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
import type { FormInstance } from 'element-plus'
import { ref, computed, onMounted, inject } from 'vue'
import { isLastNode } from '@/workflow/common/data'
import { t } from '@/locales'
import { useRoute } from 'vue-router'
// Import dynamic API only if needed
const sharedApi = await loadSharedApi()
onMounted(() => {
// Initialize anything here on mount
})
</script>
<style lang="scss" scoped></style>Key changes:
Make sure to address these issues based on your specific requirements and environment. |
||
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.
The provided code snippet appears to be defining a set of workflow nodes for an application workflow, specifically within a TypeScript or JavaScript project. Here's a review with suggestions:
Irregularities
Duplicate Labels: The
labelfield has been duplicated in two places under different configurations.Missing Export Statements: There might be missing export statements for the new
variableAggregationNode. If you intend to use it across the project, make sure all necessary exports are included.Incorrect Syntax: Ensure there are no syntax errors that could affect how these nodes are used elsewhere in your application.
Potential Issues
Data Consistency: Ensure consistency in data types and formats between the nodes and their properties (e.g., ensuring the default configuration is properly defined).
Internationalization Compatibility: Double-check if the translations (
t(...)calls) work correctly across your localization settings.Scalability: If more nodes of this type will be added in the future, consider organizing them into separate files or using modules instead of having everything nested directly under a single object.
Optimization Suggestions
Modular Code: Organize related nodes together or break down complex ones into smaller components if they become unwieldy.
Validation Logic: Implement validations on some properties where appropriate to ensure valid workflows are constructed based on user input/output rules.
Performance Testing: Consider testing performance and responsiveness especially during runtime manipulations of the workflow nodes.
Given the context, here’s a slightly improved version of the last section for clarity and completeness but without altering the core structure:
Ensure all required imports and configurations are complete for each function and property being referenced.