-
Notifications
You must be signed in to change notification settings - Fork 2.6k
pref: Remove return content button #4431
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 |
|---|---|---|
|
|
@@ -16,9 +16,7 @@ | |
| prop="model_id" | ||
| :rules="{ | ||
| required: true, | ||
| message: $t( | ||
| 'views.workflow.nodes.imageUnderstandNode.model.requiredMessage', | ||
| ), | ||
| message: $t('views.workflow.nodes.imageUnderstandNode.model.requiredMessage'), | ||
| trigger: 'change', | ||
| }" | ||
| > | ||
|
|
@@ -46,9 +44,7 @@ | |
| @wheel="wheel" | ||
| :teleported="false" | ||
| v-model="form_data.model_id" | ||
| :placeholder=" | ||
| $t('views.workflow.nodes.imageUnderstandNode.model.requiredMessage') | ||
| " | ||
| :placeholder="$t('views.workflow.nodes.imageUnderstandNode.model.requiredMessage')" | ||
| :options="modelOptions" | ||
| showFooter | ||
| :model-type="'IMAGE'" | ||
|
|
@@ -143,9 +139,7 @@ | |
| :rules="{ | ||
| type: 'array', | ||
| required: true, | ||
| message: $t( | ||
| 'views.workflow.nodes.imageUnderstandNode.image.requiredMessage', | ||
| ), | ||
| message: $t('views.workflow.nodes.imageUnderstandNode.image.requiredMessage'), | ||
| trigger: 'change', | ||
| }" | ||
| > | ||
|
|
@@ -157,22 +151,19 @@ | |
| ref="nodeCascaderRef" | ||
| :nodeModel="nodeModel" | ||
| class="w-full" | ||
| :placeholder=" | ||
| $t('views.workflow.nodes.imageUnderstandNode.image.requiredMessage') | ||
| " | ||
| :placeholder="$t('views.workflow.nodes.imageUnderstandNode.image.requiredMessage')" | ||
| v-model="form_data.image_list" | ||
| /> | ||
| </el-form-item> | ||
| <el-form-item | ||
| :label="$t('views.workflow.nodes.aiChatNode.returnContent.label')" | ||
| @click.prevent | ||
| v-if="[WorkflowMode.Application, WorkflowMode.ApplicationLoop].includes(workflowMode)" | ||
| > | ||
| <template #label> | ||
| <div class="flex align-center"> | ||
| <div class="mr-4"> | ||
| <span>{{ | ||
| $t('views.workflow.nodes.aiChatNode.returnContent.label') | ||
| }}</span> | ||
| <span>{{ $t('views.workflow.nodes.aiChatNode.returnContent.label') }}</span> | ||
| </div> | ||
| <el-tooltip effect="dark" placement="right" popper-class="max-w-200"> | ||
| <template #content> | ||
|
|
@@ -202,7 +193,8 @@ import { t } from '@/locales' | |
| import { useRoute } from 'vue-router' | ||
| import { loadSharedApi } from '@/utils/dynamics-api/shared-api' | ||
| import GeneratePromptDialog from '@/views/application/component/GeneratePromptDialog.vue' | ||
|
|
||
| import { WorkflowMode } from '@/enums/application' | ||
| const workflowMode = (inject('workflowMode') as WorkflowMode) || WorkflowMode.Application | ||
| const getResourceDetail = inject('getResourceDetail') as any | ||
| const route = useRoute() | ||
|
|
||
|
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 code you provided is largely syntactically correct and does not contain any major problems. However, there are a few areas where improvements could be made:
Overall, these checks should help ensure robustness and maintainability of the code. Make sure to review each section again after implementing the suggested changes to confirm everything works as expected with your specific use cases. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,14 +19,8 @@ | |
| size="small" | ||
| style="width: 85px" | ||
| > | ||
| <el-option | ||
| :label="$t('views.workflow.variable.Referencing')" | ||
| value="referencing" | ||
| /> | ||
| <el-option | ||
| :label="$t('common.custom')" | ||
| value="content" | ||
| /> | ||
| <el-option :label="$t('views.workflow.variable.Referencing')" value="referencing" /> | ||
| <el-option :label="$t('common.custom')" value="content" /> | ||
| </el-select> | ||
| </div> | ||
| </template> | ||
|
|
@@ -44,22 +38,19 @@ | |
| ref="nodeCascaderRef" | ||
| :nodeModel="nodeModel" | ||
| class="w-full" | ||
| :placeholder=" | ||
| $t('views.workflow.nodes.searchKnowledgeNode.searchQuestion.placeholder') | ||
| " | ||
| :placeholder="$t('views.workflow.nodes.searchKnowledgeNode.searchQuestion.placeholder')" | ||
| v-model="form_data.fields" | ||
| /> | ||
| </el-form-item> | ||
| <el-form-item | ||
| v-if="[WorkflowMode.Application, WorkflowMode.ApplicationLoop].includes(workflowMode)" | ||
| :label="$t('views.workflow.nodes.aiChatNode.returnContent.label')" | ||
| @click.prevent | ||
| > | ||
| <template #label> | ||
| <div class="flex align-center"> | ||
| <div class="mr-4"> | ||
| <span>{{ | ||
| $t('views.workflow.nodes.aiChatNode.returnContent.label') | ||
| }}</span> | ||
| <span>{{ $t('views.workflow.nodes.aiChatNode.returnContent.label') }}</span> | ||
| </div> | ||
| <el-tooltip effect="dark" placement="right" popper-class="max-w-200"> | ||
| <template #content> | ||
|
|
@@ -79,9 +70,10 @@ | |
| import { set } from 'lodash' | ||
| import NodeContainer from '@/workflow/common/NodeContainer.vue' | ||
| import NodeCascader from '@/workflow/common/NodeCascader.vue' | ||
| import { ref, computed, onMounted } from 'vue' | ||
| import { ref, computed, onMounted, inject } from 'vue' | ||
| import { isLastNode } from '@/workflow/common/data' | ||
|
|
||
| import { WorkflowMode } from '@/enums/application' | ||
| const workflowMode = (inject('workflowMode') as WorkflowMode) || WorkflowMode.Application | ||
| const props = defineProps<{ nodeModel: any }>() | ||
|
|
||
| const wheel = (e: any) => { | ||
|
|
@@ -111,7 +103,7 @@ const form_data = computed({ | |
| }, | ||
| set: (value) => { | ||
| set(props.nodeModel.properties, 'node_data', value) | ||
| } | ||
| }, | ||
| }) | ||
|
|
||
| function submitDialog(val: string) { | ||
|
|
@@ -123,7 +115,7 @@ const nodeCascaderRef = ref() | |
| const validate = () => { | ||
| return Promise.all([ | ||
| nodeCascaderRef.value ? nodeCascaderRef.value.validate() : Promise.resolve(''), | ||
| replyNodeFormRef.value?.validate() | ||
| replyNodeFormRef.value?.validate(), | ||
| ]).catch((err: any) => { | ||
| return Promise.reject({ node: props.nodeModel, errMessage: err }) | ||
| }) | ||
|
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 code appears to be TypeScript with Vue.js components, likely part of an application that handles workflows. While I can't perform specific linting or analysis on this codebase without additional context (like imports, module dependencies), here are general notes and suggestions for improving it:
Here's a simplified version of some of these improvements: // File: src/components/form/FormElement.tsx
<template>
<!-- Form element content -->
</template>
<script lang="ts">
import { computed, defineComponent, reactive } from "vue";
export default defineComponent({
name: 'FormElement',
setup() {
const formData = reactive({});
const handleValidate = async (): Promise<string | null> => {
try {
await nodeCascaderRef.value?.validate();
// Additional validation for replyNodeFormRef if needed
return '';
} catch (err: any) {
console.error(err);
return err.message;
}
};
const onSubmit = async (val: string): Promise<void> => {
if (await handleValidate()) {
// Proceed with submission
submitDialog(val);
}
};
return {
formData,
handleSubmit: handleSubmit,
};
},
});
</script>Make sure to adjust the names and structure according to your actual component hierarchy and requirements. For more detailed analysis and optimizations, consider running static code analysis tooling with appropriate configurations. |
||
|
|
||
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.
There are no obvious irregularities or potential issues with the provided code. However, there are a couple of minor optimizations and suggestions that could be made:
Optimizations/Suggestions
Remove Duplicated Message Translation:
The message
requiredMessageappears twice in different places. Consider removing one instance to avoid redundancy.Reduce Duplication in Placeholder Texts:
Similar placeholder texts appear multiple times. You can extract these into variables for consistency.
Consistent Use of Vue Ref/Inject:
Ensure consistent usage of
refandinject. It's generally better practice to usereactive,computed, etc., based on context.Avoid Direct Usage of
String.prototype.includes()in Conditional Checks:While not directly related, you might consider using an enum-like approach with symbols or a mapping object instead of direct string checks.
Here's an improved version of the relevant part:
These changes make the code slightly more organized and maintainable while preserving its functionality.