chore: preps (#9994)

* chore: preps

Signed-off-by: mertmit <mertmit99@gmail.com>

* test: fix unit

Signed-off-by: mertmit <mertmit99@gmail.com>

---------

Signed-off-by: mertmit <mertmit99@gmail.com>
This commit is contained in:
Mert E.
2024-12-09 11:15:36 +03:00
committed by GitHub
parent f4d27c01dd
commit 818d9344e9
72 changed files with 1636 additions and 278 deletions

View File

@@ -28,6 +28,8 @@ const { workspaceId, baseType } = toRefs(props)
const { navigateToProject } = useGlobal()
const { $e } = useNuxtApp()
const { clone } = useUndoRedo()
const { aiIntegrationAvailable, aiError, aiLoading, createSchema, predictSchema } = useNocoAi()
@@ -145,6 +147,21 @@ const onPredictSchema = async () => {
let currentMessageIndex = 0
let currentCharIndex = 0
let prompt = `${aiFormState.value.prompt}`
// Append optional information if provided
if (aiFormState.value.organization?.trim()) {
prompt += ` | Organization: ${aiFormState.value.organization}`
}
if (aiFormState.value.industry?.trim()) {
prompt += ` | Industry: ${aiFormState.value.industry}`
}
if (aiFormState.value.audience?.trim()) {
prompt += ` | Audience: ${aiFormState.value.audience}`
}
$e('a:base:ai:generate', prompt)
try {
const displayCharByChar = () => {
const currentMessage = loadingMessages[currentMessageIndex]
@@ -169,19 +186,6 @@ const onPredictSchema = async () => {
// Set interval to display characters one by one
timerId = setInterval(displayCharByChar, 40) // Adjust the speed as needed (100ms)
let prompt = `${aiFormState.value.prompt}`
// Append optional information if provided
if (aiFormState.value.organization?.trim()) {
prompt += ` | Organization: ${aiFormState.value.organization}`
}
if (aiFormState.value.industry?.trim()) {
prompt += ` | Industry: ${aiFormState.value.industry}`
}
if (aiFormState.value.audience?.trim()) {
prompt += ` | Audience: ${aiFormState.value.audience}`
}
const res = await predictSchema(prompt)
if (!res?.tables) {
@@ -465,7 +469,6 @@ onMounted(() => {
</div>
<div v-if="aiIntegrationAvailable" class="flex items-center gap-3">
<NcButton
v-e="['a:base:ai:generate']"
size="small"
:type="aiStep !== AI_STEP.MODIFY || isOldPromptChanged ? 'primary' : 'secondary'"
theme="ai"