mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
visiual AI import improvements
This commit is contained in:
@@ -1869,8 +1869,12 @@ class ImageToRecipeView(APIView):
|
|||||||
|
|
||||||
scrape = scrape_html(html=data, org_url='https://urlnotfound.none', supported_only=False)
|
scrape = scrape_html(html=data, org_url='https://urlnotfound.none', supported_only=False)
|
||||||
if scrape:
|
if scrape:
|
||||||
|
recipe = helper.get_from_scraper(scrape, request)
|
||||||
|
obj, created = Keyword.objects.get_or_create(name='✨ AI', space=request.space)
|
||||||
|
recipe['keywords'].append({'label': obj.name, 'name': obj.name, 'id': obj.id, 'import_keyword': True})
|
||||||
|
|
||||||
response = {}
|
response = {}
|
||||||
response['recipe'] = helper.get_from_scraper(scrape, request)
|
response['recipe'] = recipe
|
||||||
response['images'] = []
|
response['images'] = []
|
||||||
response['duplicates'] = []
|
response['duplicates'] = []
|
||||||
return Response(RecipeFromSourceResponseSerializer(context={'request': request}).to_representation(response), status=status.HTTP_200_OK)
|
return Response(RecipeFromSourceResponseSerializer(context={'request': request}).to_representation(response), status=status.HTTP_200_OK)
|
||||||
|
|||||||
@@ -118,7 +118,13 @@
|
|||||||
<v-text-field :label="$t('Website') + ' (https://...)'" v-model="importUrl" v-if="importType == 'url'" :loading="loading" autofocus
|
<v-text-field :label="$t('Website') + ' (https://...)'" v-model="importUrl" v-if="importType == 'url'" :loading="loading" autofocus
|
||||||
@keydown.enter="loadRecipeFromUrl({url: importUrl})"></v-text-field>
|
@keydown.enter="loadRecipeFromUrl({url: importUrl})"></v-text-field>
|
||||||
|
|
||||||
<v-file-input v-model="image" :label="$t('Image')" v-if="importType == 'ai'" :loading="loading"></v-file-input>
|
<v-file-upload v-model="image" v-if="importType == 'ai'" :loading="loading" clearable>
|
||||||
|
<template #icon>
|
||||||
|
<v-icon icon="fa-solid fa-file-pdf"></v-icon>
|
||||||
|
{{$t('or')}}
|
||||||
|
<v-icon icon="fa-solid fa-file-image"></v-icon>
|
||||||
|
</template>
|
||||||
|
</v-file-upload>
|
||||||
|
|
||||||
<v-textarea v-model="sourceImportText" label="JSON/HTML" :loading="loading" v-if="importType == 'source'" :hint="$t('SourceImportHelp')"
|
<v-textarea v-model="sourceImportText" label="JSON/HTML" :loading="loading" v-if="importType == 'source'" :hint="$t('SourceImportHelp')"
|
||||||
persistent-hint autofocus @keydown.enter="loadRecipeFromUrl({data: sourceImportText})"></v-textarea>
|
persistent-hint autofocus @keydown.enter="loadRecipeFromUrl({data: sourceImportText})"></v-textarea>
|
||||||
@@ -365,11 +371,11 @@
|
|||||||
<v-stepper-window-item value="file">
|
<v-stepper-window-item value="file">
|
||||||
<v-file-upload v-model="appImportFiles" multiple></v-file-upload>
|
<v-file-upload v-model="appImportFiles" multiple></v-file-upload>
|
||||||
|
|
||||||
<v-card variant="outlined" elevation="1" density="compact" :title="$t('Duplicate')" :subtitle="$t('import_duplicates')" class="mt-2">
|
<v-alert variant="outlined" elevation="1" density="compact" :title="$t('Duplicate')" :text="$t('import_duplicates')" class="mt-2">
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<v-checkbox v-model="appImportDuplicates"></v-checkbox>
|
<v-checkbox v-model="appImportDuplicates"></v-checkbox>
|
||||||
</template>
|
</template>
|
||||||
</v-card>
|
</v-alert>
|
||||||
|
|
||||||
<v-stepper-actions>
|
<v-stepper-actions>
|
||||||
<template #prev>
|
<template #prev>
|
||||||
@@ -546,6 +552,9 @@ function loadRecipeFromUrl(recipeFromSourceRequest: RecipeFromSource) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* upload file to conversion endpoint
|
||||||
|
*/
|
||||||
function uploadAndConvertImage() {
|
function uploadAndConvertImage() {
|
||||||
if (image.value != null) {
|
if (image.value != null) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|||||||
Reference in New Issue
Block a user