fix(nc-gui): show create base with ai modal based on query params

This commit is contained in:
Ramesh Mane
2025-08-20 08:16:46 +00:00
parent bc52085e7e
commit 0a30b153fd
2 changed files with 19 additions and 2 deletions

View File

@@ -5,6 +5,11 @@ interface Props {
dialogShow: boolean
aiMode: boolean | null
workspaceId?: string
isCreateNewActionMenu?: boolean
initialValue?: {
basePrompt: string
baseName: string
}
}
const props = withDefaults(defineProps<Props>(), {})
@@ -30,6 +35,8 @@ const { $e } = useNuxtApp()
const { clone } = useUndoRedo()
const { isWorkspaceLoading } = storeToRefs(useWorkspace())
const { aiIntegrationAvailable, aiError, aiLoading, createSchema, predictSchema } = useNocoAi()
const callFunction = ref<string | null>(null)
@@ -94,7 +101,7 @@ const defaultAiFormState = {
const oldAiFormState = ref<typeof defaultAiFormState | null>(null)
const aiFormState = ref(defaultAiFormState)
const aiFormState = ref({ ...defaultAiFormState, prompt: props.initialValue?.basePrompt ?? '' })
const isOldPromptChanged = computed(() => {
return (
@@ -331,6 +338,16 @@ onMounted(() => {
aiPromptInputRef.value?.focus()
}, 5)
if (props.initialValue?.basePrompt) {
until(() => !isWorkspaceLoading.value)
.toBeTruthy()
.then(() => {
if (!aiIntegrationAvailable.value) return
onPredictSchema()
})
}
until(() => leftPaneContentRef.value)
.toBeTruthy()
.then(() => {