Jelajahi Sumber

feat: 文案提取

victor.zhou 4 bulan lalu
induk
melakukan
57f7e06707
4 mengubah file dengan 133 tambahan dan 55 penghapusan
  1. 48 1
      src/i18n/locales/en.json
  2. 48 1
      src/i18n/locales/zh.json
  3. 12 32
      src/views/Home.vue
  4. 25 21
      src/views/TableDesign.vue

+ 48 - 1
src/i18n/locales/en.json

@@ -32,7 +32,23 @@
         "clear": "Clear",
         "clearButton": "Clear",
         "scenePresets": "Scene Presets",
-        "tastePresets": "Taste Presets"
+        "tastePresets": "Taste Presets",
+        "scenes": {
+          "family": "Family Gathering",
+          "romantic": "Romantic Dinner",
+          "quick": "Quick Dish",
+          "party": "Party Appetizer",
+          "breakfast": "Nutritious Breakfast",
+          "lunch": "Work Lunch"
+        },
+        "tastes": {
+          "light": "Light Flavor",
+          "spicy": "Spicy & Satisfying",
+          "sweet": "Lightly Sweet",
+          "sour": "Tangy & Refreshing",
+          "savory": "Rich & Savory",
+          "crispy": "Crispy & Crunchy"
+        }
       }
     },
     "step3": {
@@ -792,5 +808,36 @@
   "ai": {
     "systemPrompt": "You are a professional chef. Please generate detailed recipes based on the ingredients and cuisine requirements provided by the user.",
     "responseFormat": "Please return the recipe in the following JSON format:\n{\n  \"name\": \"Dish Name\",\n  \"ingredients\": [\"Ingredient 1\", \"Ingredient 2\"],\n  \"steps\": [\n    {\n      \"step\": 1,\n      \"description\": \"Step description\",\n      \"time\": 5,\n      \"temperature\": \"Medium heat\"\n    }\n  ],\n  \"cookingTime\": 30,\n  \"difficulty\": \"medium\",\n  \"tips\": [\"Tip 1\", \"Tip 2\"]\n}"
+  },
+  "tableDesign": {
+    "tasteOptions": {
+      "spicy": "Spicy & Numbing",
+      "sweet": "Sweet",
+      "sour": "Sour / Tangy",
+      "salty": "Savory & Umami",
+      "light": "Light",
+      "rich": "Rich / Intense"
+    },
+    "cuisineStyles": {
+      "mixed": "Mixed Cuisines",
+      "chinese": "Chinese Focused",
+      "western": "Western Focused",
+      "japanese": "Japanese Focused"
+    },
+    "diningScenes": {
+      "family": "Family Gathering",
+      "friends": "Friends Get-Together",
+      "romantic": "Romantic Dinner",
+      "business": "Business Banquet",
+      "festival": "Holiday Celebration",
+      "casual": "Everyday Meal"
+    },
+    "nutritionOptions": {
+      "balanced": "Balanced Nutrition",
+      "protein": "High-Protein",
+      "vegetarian": "Vegetarian Focused",
+      "low_fat": "Low-Fat & Healthy",
+      "comfort": "Nourishing & Tonic"
+    }
   }
 }

+ 48 - 1
src/i18n/locales/zh.json

@@ -32,7 +32,23 @@
         "clear": "清除",
         "clearButton": "清除",
         "scenePresets": "场景预设",
-        "tastePresets": "口味预设"
+        "tastePresets": "口味预设",
+        "scenes": {
+          "family": "家庭聚餐",
+          "romantic": "浪漫晚餐",
+          "quick": "快手菜",
+          "party": "聚会小食",
+          "breakfast": "营养早餐",
+          "lunch": "工作午餐"
+        },
+        "tastes": {
+          "light": "清淡口味",
+          "spicy": "香辣过瘾",
+          "sweet": "微甜可口",
+          "sour": "酸爽开胃",
+          "savory": "鲜香浓郁",
+          "crispy": "酥脆爽口"
+        }
       }
     },
     "step3": {
@@ -792,5 +808,36 @@
   "ai": {
     "systemPrompt": "你是一位专业的厨师,请根据用户提供的食材和菜系要求,生成详细的菜谱。",
     "responseFormat": "请按照以下JSON格式返回菜谱:\n{\n  \"name\": \"菜品名称\",\n  \"ingredients\": [\"食材1\", \"食材2\"],\n  \"steps\": [\n    {\n      \"step\": 1,\n      \"description\": \"步骤描述\",\n      \"time\": 5,\n      \"temperature\": \"中火\"\n    }\n  ],\n  \"cookingTime\": 30,\n  \"difficulty\": \"medium\",\n  \"tips\": [\"技巧1\", \"技巧2\"]\n}"
+  },
+  "tableDesign": {
+    "tasteOptions": {
+      "spicy": "麻辣",
+      "sweet": "甜味",
+      "sour": "酸味",
+      "salty": "咸鲜",
+      "light": "清淡",
+      "rich": "浓郁"
+    },
+    "cuisineStyles": {
+      "mixed": "混合菜系",
+      "chinese": "中式为主",
+      "western": "西式为主",
+      "japanese": "日式为主"
+    },
+    "diningScenes": {
+      "family": "家庭聚餐",
+      "friends": "朋友聚会",
+      "romantic": "浪漫晚餐",
+      "business": "商务宴请",
+      "festival": "节日庆祝",
+      "casual": "日常用餐"
+    },
+    "nutritionOptions": {
+      "balanced": "营养均衡",
+      "protein": "高蛋白",
+      "vegetarian": "素食为主",
+      "low_fat": "低脂健康",
+      "comfort": "滋补养生"
+    }
   }
 }

+ 12 - 32
src/views/Home.vue

@@ -683,43 +683,23 @@ let loadingInterval: NodeJS.Timeout | null = null
 
 // 预设选项数据
 const scenePresets = [
-    { id: 'family', name: '家庭聚餐', prompt: '适合全家人一起享用的家常菜,老少皆宜,营养均衡' },
-    { id: 'romantic', name: '浪漫晚餐', prompt: '适合情侣约会的精致菜品,卖相精美,氛围浪漫' },
-    { id: 'quick', name: '快手菜', prompt: '制作简单快速的菜品,15分钟内完成,适合忙碌时光' },
-    { id: 'party', name: '聚会小食', prompt: '适合朋友聚会的下酒菜或小食,方便分享' },
-    { id: 'breakfast', name: '营养早餐', prompt: '健康营养的早餐搭配,提供一天的活力' },
-    { id: 'lunch', name: '工作午餐', prompt: '适合上班族的午餐,营养丰富且不油腻' }
+    { id: 'family', name: t('home.step2.customRequest.scenes.family'), prompt: '适合全家人一起享用的家常菜,老少皆宜,营养均衡' },
+    { id: 'romantic', name: t('home.step2.customRequest.scenes.romantic'), prompt: '适合情侣约会的精致菜品,卖相精美,氛围浪漫' },
+    { id: 'quick', name: t('home.step2.customRequest.scenes.quick'), prompt: '制作简单快速的菜品,15分钟内完成,适合忙碌时光' },
+    { id: 'party', name: t('home.step2.customRequest.scenes.party'), prompt: '适合朋友聚会的下酒菜或小食,方便分享' },
+    { id: 'breakfast', name: t('home.step2.customRequest.scenes.breakfast'), prompt: '健康营养的早餐搭配,提供一天的活力' },
+    { id: 'lunch', name: t('home.step2.customRequest.scenes.lunch'), prompt: '适合上班族的午餐,营养丰富且不油腻' }
 ]
 
 const tastePresets = [
-    { id: 'light', name: '清淡口味', prompt: '口味清淡,少油少盐,突出食材本味' },
-    { id: 'spicy', name: '香辣过瘾', prompt: '香辣刺激,层次丰富,适合喜欢辣味的人' },
-    { id: 'sweet', name: '微甜可口', prompt: '带有淡淡甜味,口感温和,老少皆宜' },
-    { id: 'sour', name: '酸爽开胃', prompt: '酸味突出,开胃解腻,适合夏天享用' },
-    { id: 'savory', name: '鲜香浓郁', prompt: '鲜味十足,香气浓郁,回味无穷' },
-    { id: 'crispy', name: '酥脆爽口', prompt: '口感酥脆,层次分明,嚼劲十足' }
+    { id: 'light', name: t('home.step2.customRequest.tastes.light'), prompt: '口味清淡,少油少盐,突出食材本味' },
+    { id: 'spicy', name: t('home.step2.customRequest.tastes.spicy'), prompt: '香辣刺激,层次丰富,适合喜欢辣味的人' },
+    { id: 'sweet', name: t('home.step2.customRequest.tastes.sweet'), prompt: '带有淡淡甜味,口感温和,老少皆宜' },
+    { id: 'sour', name: t('home.step2.customRequest.tastes.sour'), prompt: '酸味突出,开胃解腻,适合夏天享用' },
+    { id: 'savory', name: t('home.step2.customRequest.tastes.savory'), prompt: '鲜味十足,香气浓郁,回味无穷' },
+    { id: 'crispy', name: t('home.step2.customRequest.tastes.crispy'), prompt: '口感酥脆,层次分明,嚼劲十足' }
 ]
 
-// 健康偏好预设 - 暂时未使用
-// const healthPresets = [
-//     { id: 'lowfat', name: '低脂健康', prompt: '低脂肪制作,健康营养,适合减脂期间食用' },
-//     { id: 'highprotein', name: '高蛋白', prompt: '富含优质蛋白质,适合健身人群和成长期儿童' },
-//     { id: 'vegetarian', name: '素食主义', prompt: '纯素食制作,不含任何动物性食材,营养均衡' },
-//     { id: 'diabetic', name: '控糖友好', prompt: '低糖低GI,适合糖尿病患者或需要控制血糖的人群' },
-//     { id: 'elderly', name: '老人友好', prompt: '软烂易消化,营养丰富,适合老年人食用' },
-//     { id: 'children', name: '儿童喜爱', prompt: '造型可爱,营养全面,适合儿童的口味偏好' }
-// ]
-
-// 烹饪方式预设 - 暂时未使用
-// const cookingPresets = [
-//     { id: 'steam', name: '清蒸', prompt: '采用蒸制方法,保持食材原味和营养' },
-//     { id: 'stirfry', name: '爆炒', prompt: '大火爆炒,锁住食材鲜味,口感脆嫩' },
-//     { id: 'braise', name: '红烧', prompt: '红烧制作,色泽红亮,味道浓郁' },
-//     { id: 'soup', name: '煲汤', prompt: '制作成汤品,清香鲜美,营养丰富' },
-//     { id: 'cold', name: '凉拌', prompt: '凉拌制作,清爽开胃,适合夏季' },
-//     { id: 'grill', name: '烧烤', prompt: '烧烤方式制作,香气四溢,口感独特' }
-// ]
-
 const eventHandler = (event: any) => {
     try {
       const data = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;

+ 25 - 21
src/views/TableDesign.vue

@@ -473,12 +473,16 @@
 
 <script setup lang="ts">
 import { ref, reactive, Teleport, Transition, onMounted, onUnmounted } from 'vue'
+import { useI18n } from 'vue-i18n'
 import type { Recipe } from '@/types'
 import RecipeCard from '@/components/RecipeCard.vue'
 import GlobalNavigation from '@/components/GlobalNavigation.vue'
 import GlobalFooter from '@/components/GlobalFooter.vue'
 import { generateTableMenu, generateDishRecipe } from '@/services/aiService'
 
+// i18n
+const { t } = useI18n()
+
 // 配置选项
 interface TableConfig {
     dishCount: number
@@ -528,36 +532,36 @@ const currentCustomDish = ref('')
 
 // 配置选项数据
 const tasteOptions = [
-    { id: 'spicy', name: '麻辣', icon: '🌶️' },
-    { id: 'sweet', name: '甜味', icon: '🍯' },
-    { id: 'sour', name: '酸味', icon: '🍋' },
-    { id: 'salty', name: '咸鲜', icon: '🧂' },
-    { id: 'light', name: '清淡', icon: '🌿' },
-    { id: 'rich', name: '浓郁', icon: '🍖' }
+    { id: 'spicy', name: t('tableDesign.tasteOptions.spicy'), icon: '🌶️' },
+    { id: 'sweet', name: t('tableDesign.tasteOptions.sweet'), icon: '🍯' },
+    { id: 'sour', name: t('tableDesign.tasteOptions.sour'), icon: '🍋' },
+    { id: 'salty', name: t('tableDesign.tasteOptions.salty'), icon: '🧂' },
+    { id: 'light', name: t('tableDesign.tasteOptions.light'), icon: '🌿' },
+    { id: 'rich', name: t('tableDesign.tasteOptions.rich'), icon: '🍖' }
 ]
 
 const cuisineStyles = [
-    { id: 'mixed', name: '混合菜系', icon: '🌍' },
-    { id: 'chinese', name: '中式为主', icon: '🥢' },
-    { id: 'western', name: '西式为主', icon: '🍽️' },
-    { id: 'japanese', name: '日式为主', icon: '🍱' }
+    { id: 'mixed', name: t('tableDesign.cuisineStyles.mixed'), icon: '🌍' },
+    { id: 'chinese', name: t('tableDesign.cuisineStyles.chinese'), icon: '🥢' },
+    { id: 'western', name: t('tableDesign.cuisineStyles.western'), icon: '🍽️' },
+    { id: 'japanese', name: t('tableDesign.cuisineStyles.japanese'), icon: '🍱' }
 ]
 
 const diningScenes = [
-    { id: 'family', name: '家庭聚餐', icon: '👨‍👩‍👧‍👦' },
-    { id: 'friends', name: '朋友聚会', icon: '🎉' },
-    { id: 'romantic', name: '浪漫晚餐', icon: '💕' },
-    { id: 'business', name: '商务宴请', icon: '💼' },
-    { id: 'festival', name: '节日庆祝', icon: '🎊' },
-    { id: 'casual', name: '日常用餐', icon: '🍚' }
+    { id: 'family', name: t('tableDesign.diningScenes.family'), icon: '👨‍👩‍👧‍👦' },
+    { id: 'friends', name: t('tableDesign.diningScenes.friends'), icon: '🎉' },
+    { id: 'romantic', name: t('tableDesign.diningScenes.romantic'), icon: '💕' },
+    { id: 'business', name: t('tableDesign.diningScenes.business'), icon: '💼' },
+    { id: 'festival', name: t('tableDesign.diningScenes.festival'), icon: '🎊' },
+    { id: 'casual', name: t('tableDesign.diningScenes.casual'), icon: '🍚' }
 ]
 
 const nutritionOptions = [
-    { id: 'balanced', name: '营养均衡', icon: '⚖️' },
-    { id: 'protein', name: '高蛋白', icon: '💪' },
-    { id: 'vegetarian', name: '素食为主', icon: '🥬' },
-    { id: 'low_fat', name: '低脂健康', icon: '🏃‍♀️' },
-    { id: 'comfort', name: '滋补养生', icon: '🍲' }
+    { id: 'balanced', name: t('tableDesign.nutritionOptions.balanced'), icon: '⚖️' },
+    { id: 'protein', name: t('tableDesign.nutritionOptions.protein'), icon: '💪' },
+    { id: 'vegetarian', name: t('tableDesign.nutritionOptions.vegetarian'), icon: '🥬' },
+    { id: 'low_fat', name: t('tableDesign.nutritionOptions.low_fat'), icon: '🏃‍♀️' },
+    { id: 'comfort', name: t('tableDesign.nutritionOptions.comfort'), icon: '🍲' }
 ]
 
 // 切换口味选择