Skip to content

Commit 102b0e9

Browse files
committed
fix: When an AI conversation node uses the default model, the button for generating system prompts will not be automatically activated.
1 parent 2628706 commit 102b0e9

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

‎ui/src/workflow/nodes/ai-chat-node/index.vue‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838
style="width: 85px"
3939
@change="chat_data.model_id_reference = []"
4040
>
41-
<el-option :label="$t('dynamicsForm.ModelConstructor.defaultModel')" value="default" />
41+
<el-option
42+
:label="$t('dynamicsForm.ModelConstructor.defaultModel')"
43+
value="default"
44+
/>
4245
<el-option :label="$t('workflow.variable.Referencing')" value="reference" />
4346
<el-option :label="$t('common.custom')" value="custom" />
4447
</el-select>
@@ -101,7 +104,11 @@
101104
type="primary"
102105
link
103106
@click="openGeneratePromptDialog(chat_data.model_id)"
104-
:disabled="chat_data.model_id_type === 'reference' || !chat_data.model_id"
107+
:disabled="
108+
chat_data.model_id_type === 'reference' ||
109+
(!chat_data.model_id && chat_data.model_id_type === 'custom')||
110+
(chat_data.model_id_type==='default'&& !defaultModelId)
111+
"
105112
>
106113
<AppIcon iconName="app-generate-star"></AppIcon>
107114
</el-button>
@@ -638,7 +645,9 @@ import { fileTooltip } from '@/workflow/common/data.ts'
638645
const workflowMode = (inject('workflowMode') as WorkflowMode) || WorkflowMode.Application
639646
const getResourceDetail = inject('getResourceDetail') as any
640647
const route = useRoute()
641-
648+
const defaultModelId = computed(() => {
649+
return getResourceDetail?.()?.value?.default_model_setting?.['LLM']?.model_id || ''
650+
})
642651
const {
643652
params: { id },
644653
} = route as any
@@ -784,9 +793,12 @@ const openAIParamSettingDialog = (modelId: string) => {
784793
785794
const GeneratePromptDialogRef = ref<InstanceType<typeof GeneratePromptDialog>>()
786795
const openGeneratePromptDialog = (modelId: string) => {
787-
if (modelId) {
796+
if (modelId && chat_data.value.model_id_type === 'custom') {
788797
GeneratePromptDialogRef.value?.open(modelId, id)
789798
}
799+
if (chat_data.value.model_id_type === 'default'&&defaultModelId.value) {
800+
GeneratePromptDialogRef.value?.open(defaultModelId.value, id)
801+
}
790802
}
791803
const replace = (v: any) => {
792804
set(props.nodeModel.properties.node_data, 'system', v)

0 commit comments

Comments
 (0)