mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-28 02:35:37 +00:00
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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user