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

@@ -12,66 +12,43 @@
<model-edit-dialog model="MealPlan" v-model="dialog" :item="defaultItem" :activator="activator"></model-edit-dialog>
</v-btn>
<v-divider></v-divider>
<template v-if="false">
<v-divider></v-divider>
<v-row>
<v-col>
<vue-draggable v-model="items1" group="test" handle=".drag-handle">
<v-row class="mt-5">
<v-col>
<v-text-field density="compact"></v-text-field>
<v-card v-for="i in items1" class="mt-1">
<v-card-text>
<v-icon icon="$dragHandle" class="drag-handle"></v-icon>
{{ i.name }}
</v-card-text>
</v-card>
</v-col>
<v-col>
<model-select model="Food" density="compact"></model-select>
</vue-draggable>
</v-col>
<v-col>
<vue-draggable v-model="items2" group="test" handle=".drag-handle" empty-insert-threshold="25">
<v-card v-for="i in items2" class="mt-1">
<v-card-text>
<v-icon icon="$dragHandle" class="drag-handle"></v-icon>
{{ i.name }}
</v-card-text>
</v-card>
</vue-draggable>
</v-col>
</v-row>
</v-col>
</v-row>
<v-row class="mt-5">
<v-col>
<v-text-field density="comfortable"></v-text-field>
<v-row class="mt-5">
<v-col>
<v-text-field density="compact"></v-text-field>
</v-col>
<v-col>
</v-col>
<v-col>
<model-select model="Food" density="compact"></model-select>
<model-select model="Food" density="comfortable"></model-select>
</v-col>
</v-row>
<v-row class="mt-5">
<v-col>
</v-col>
</v-row>
<v-row class="mt-5">
<v-col>
<model-select model="Food"></model-select>
<v-text-field></v-text-field>
</v-col>
<v-col>
<v-text-field density="comfortable"></v-text-field>
<model-select model="Food"></model-select>
</v-col>
</v-row>
</v-col>
<v-col>
<model-select model="Food" density="comfortable"></model-select>
</v-col>
</v-row>
<v-row class="mt-5">
<v-col>
<model-select model="Food"></model-select>
<v-text-field></v-text-field>
</v-col>
<v-col>
<model-select model="Food"></model-select>
</v-col>
</v-row>
</template>
</template>
@@ -85,8 +62,11 @@ import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue";
import {DateTime} from "luxon";
import ModelSelect from "@/components/inputs/ModelSelect.vue";
import {VueDraggable} from "vue-draggable-plus";
import {useFileApi} from "@/composables/useFileApi";
const image = ref(File)
const {convertImageToRecipe, fileApiLoading} = useFileApi()
const image = ref<null|File>(null)
const response = ref('')
const dialog = ref(false)
@@ -96,55 +76,11 @@ const defaultItem = ref({
fromDate: DateTime.now().plus({day: 2}).toJSDate()
} as MealPlan)
const items2 = ref([])
const items1 = ref([
{
"name": "Jean",
"id": "2"
},
{
"name": "Johanna-2",
"id": "3-2"
},
{
"name": "Joao-2",
"id": "1-2"
},
{
"name": "Juan",
"id": "4"
},
{
"name": "Joao",
"id": "1"
},
{
"name": "Jean-2",
"id": "2-2"
},
{
"name": "Johanna",
"id": "3"
},
{
"name": "Juan-2",
"id": "4-2"
}
])
function imageToRecipe() {
const api = new ApiApi()
const reader = new FileReader()
reader.readAsDataURL(image.value)
api.apiImageToRecipeCreate({image: image.value}).then(r => {
console.log(r)
response.value = r
}).catch(err => {
console.log(err)
response.value = err
})
if(image.value != null){
convertImageToRecipe(image.value)
}
}