mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 10:13:32 -04:00 
			
		
		
		
	feat: Migrate to Nuxt 3 framework (#5184)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
		| @@ -1,25 +1,34 @@ | ||||
| <template> | ||||
|   <v-container class="pa-0"> | ||||
|     <v-container> | ||||
|       <BaseCardSectionTitle :title="$tc('admin.debug-openai-services')"> | ||||
|       <BaseCardSectionTitle :title="$t('admin.debug-openai-services')"> | ||||
|         {{ $t('admin.debug-openai-services-description') }} | ||||
|         <br /> | ||||
|         <DocLink class="mt-2" link="/documentation/getting-started/installation/open-ai" /> | ||||
|         <br> | ||||
|         <DocLink | ||||
|           class="mt-2" | ||||
|           link="/documentation/getting-started/installation/open-ai" | ||||
|         /> | ||||
|       </BaseCardSectionTitle> | ||||
|     </v-container> | ||||
|     <v-form ref="uploadForm" @submit.prevent="testOpenAI"> | ||||
|     <v-form | ||||
|       ref="uploadForm" | ||||
|       @submit.prevent="testOpenAI" | ||||
|     > | ||||
|       <div> | ||||
|         <v-card-text> | ||||
|           <v-container class="pa-0"> | ||||
|             <v-row> | ||||
|               <v-col cols="auto" align-self="center"> | ||||
|               <v-col | ||||
|                 cols="auto" | ||||
|                 align-self="center" | ||||
|               > | ||||
|                 <AppButtonUpload | ||||
|                   v-if="!uploadedImage" | ||||
|                   class="ml-auto" | ||||
|                   url="none" | ||||
|                   file-name="image" | ||||
|                   accept="image/*" | ||||
|                   :text="$i18n.tc('recipe.upload-image')" | ||||
|                   :text="$t('recipe.upload-image')" | ||||
|                   :text-btn="false" | ||||
|                   :post="false" | ||||
|                   @uploaded="uploadImage" | ||||
| @@ -29,13 +38,18 @@ | ||||
|                   color="error" | ||||
|                   @click="clearImage" | ||||
|                 > | ||||
|                   <v-icon left>{{ $globals.icons.close }}</v-icon> | ||||
|                   {{ $i18n.tc("recipe.remove-image") }} | ||||
|                   <v-icon start> | ||||
|                     {{ $globals.icons.close }} | ||||
|                   </v-icon> | ||||
|                   {{ $t("recipe.remove-image") }} | ||||
|                 </v-btn> | ||||
|               </v-col> | ||||
|               <v-spacer /> | ||||
|             </v-row> | ||||
|             <v-row v-if="uploadedImage && uploadedImagePreviewUrl" style="max-width: 25%;"> | ||||
|             <v-row | ||||
|               v-if="uploadedImage && uploadedImagePreviewUrl" | ||||
|               style="max-width: 25%;" | ||||
|             > | ||||
|               <v-spacer /> | ||||
|               <v-col cols="12"> | ||||
|                 <v-img :src="uploadedImagePreviewUrl" /> | ||||
| @@ -47,7 +61,7 @@ | ||||
|         <v-card-actions> | ||||
|           <BaseButton | ||||
|             type="submit" | ||||
|             :text="$i18n.tc('admin.run-test')" | ||||
|             :text="$t('admin.run-test')" | ||||
|             :icon="$globals.icons.check" | ||||
|             :loading="loading" | ||||
|             class="ml-auto" | ||||
| @@ -55,8 +69,14 @@ | ||||
|         </v-card-actions> | ||||
|       </div> | ||||
|     </v-form> | ||||
|     <v-divider v-if="response" class="mt-4" /> | ||||
|     <v-container v-if="response" class="ma-0 pa-0"> | ||||
|     <v-divider | ||||
|       v-if="response" | ||||
|       class="mt-4" | ||||
|     /> | ||||
|     <v-container | ||||
|       v-if="response" | ||||
|       class="ma-0 pa-0" | ||||
|     > | ||||
|       <v-card-title> {{ $t('admin.test-results') }} </v-card-title> | ||||
|       <v-card-text> {{ response }} </v-card-text> | ||||
|     </v-container> | ||||
| @@ -64,15 +84,23 @@ | ||||
| </template> | ||||
|  | ||||
| <script lang="ts"> | ||||
| import { defineComponent, ref } from "@nuxtjs/composition-api"; | ||||
| import { useAdminApi } from "~/composables/api"; | ||||
| import { alert } from "~/composables/use-toast"; | ||||
| import { VForm } from "~/types/vuetify"; | ||||
|  | ||||
| export default defineComponent({ | ||||
|   layout: "admin", | ||||
| export default defineNuxtComponent({ | ||||
|   setup() { | ||||
|     definePageMeta({ | ||||
|       layout: "admin", | ||||
|     }); | ||||
|  | ||||
|     const api = useAdminApi(); | ||||
|     const i18n = useI18n(); | ||||
|  | ||||
|     // Set page title | ||||
|     useSeoMeta({ | ||||
|       title: i18n.t("admin.debug-openai-services"), | ||||
|     }); | ||||
|  | ||||
|     const loading = ref(false); | ||||
|     const response = ref(""); | ||||
|  | ||||
| @@ -102,7 +130,8 @@ export default defineComponent({ | ||||
|  | ||||
|       if (!data) { | ||||
|         alert.error("Unable to test OpenAI services"); | ||||
|       } else { | ||||
|       } | ||||
|       else { | ||||
|         response.value = data.response || (data.success ? "Test Successful" : "Test Failed"); | ||||
|       } | ||||
|     } | ||||
| @@ -118,10 +147,5 @@ export default defineComponent({ | ||||
|       testOpenAI, | ||||
|     }; | ||||
|   }, | ||||
|   head() { | ||||
|     return { | ||||
|       title: this.$t("admin.debug-openai-services"), | ||||
|     }; | ||||
|   }, | ||||
| }); | ||||
| </script> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user