playing with AI import

This commit is contained in:
vabene1111
2025-01-20 09:40:22 +01:00
parent a56c7c29a6
commit e0b414d8e9
10 changed files with 234 additions and 1974 deletions

View File

@@ -27,6 +27,12 @@
</template>
</v-text-field>
<v-file-input v-model="image" :label="$t('Image')" @click="uploadAndConvertImage()">
<template #append>
<v-btn>AI Import</v-btn>
</template>
</v-file-input>
<!-- <v-textarea :placeholder="$t('paste_json')"></v-textarea> -->
<v-alert variant="tonal" v-if="importResponse.duplicates && importResponse.duplicates.length > 0">
@@ -220,13 +226,17 @@ import {useDisplay} from "vuetify";
const {mobile} = useDisplay()
const router = useRouter()
const {updateRecipeImage, fileApiLoading} = useFileApi()
const {updateRecipeImage, convertImageToRecipe, fileApiLoading} = useFileApi()
const stepper = ref("1")
const dialog = ref(false)
const loading = ref(false)
const importUrl = ref("")
const image = ref<null|File>(null)
const importResponse = ref({} as RecipeFromSourceResponse)
const keywordSelect = ref<null | SourceImportKeyword>(null)
const editingIngredient = ref({} as SourceImportIngredient)
@@ -246,6 +256,14 @@ function loadRecipeFromUrl() {
})
}
function uploadAndConvertImage(){
if(image.value != null){
convertImageToRecipe(image.value).then(r => {
importResponse.value = r
})
}
}
/**
* create recipe in database
*/