Browse Source

切换模型为零一万物

liuziting 7 tháng trước cách đây
mục cha
commit
8c3d835126
4 tập tin đã thay đổi với 19 bổ sung10 xóa
  1. 5 2
      .env.example
  2. 2 2
      README.md
  3. 11 5
      src/services/aiService.ts
  4. 1 1
      src/services/imageService.ts

+ 5 - 2
.env.example

@@ -1,5 +1,8 @@
 # 菜谱生成模型,默认Deepseek
-VITE_TEXT_GENERATION_API_KEY=******
+VITE_TEXT_DEEPSEEK_API_KEY=******
+
+# 菜谱生成模型,零一万物
+VITE_TEXT_LINGYIWANGWU_API_KEY=******
 
 # 效果图生成模型,默认bigmodel
-VITE_IMAGE_GENERATION_API_KEY=******
+VITE_IMAGE_BIGMODEL_API_KEY=******

+ 2 - 2
README.md

@@ -119,10 +119,10 @@ npm run dev
 
 ```env
 # DeepSeek API 菜谱生成配置
-VITE_TEXT_GENERATION_API_KEY=your_deepseek_api_key_here
+VITE_TEXT_DEEPSEEK_API_KEY=your_deepseek_api_key_here
 
 # Bigmodel API 图像生成配置
-VITE_IMAGE_GENERATION_API_KEY=your_image_api_key_here
+VITE_IMAGE_BIGMODEL_API_KEY=your_image_api_key_here
 ```
 
 ## � 使用指南始

+ 11 - 5
src/services/aiService.ts

@@ -4,15 +4,21 @@ import type { Recipe, CuisineType, NutritionAnalysis, WinePairing, SauceRecipe,
 // AI服务配置 - 从环境变量读取
 const AI_CONFIG = {
     // baseURL: 'https://api.deepseek.com/v1/',
-    // apiKey: import.meta.env.VITE_TEXT_GENERATION_API_KEY,
+    // apiKey: import.meta.env.VITE_TEXT_DEEPSEEK_API_KEY,
     // model: 'deepseek-chat',
     // temperature: 0.7,
     // timeout: 300000
 
-    baseURL: 'https://open.bigmodel.cn/api/paas/v4/',
-    apiKey: import.meta.env.VITE_IMAGE_GENERATION_API_KEY,
-    model: 'GLM-4-Flash-250414',
-    temperature: 0.9,
+    // baseURL: 'https://open.bigmodel.cn/api/paas/v4/',
+    // apiKey: import.meta.env.VITE_IMAGE_BIGMODEL_API_KEY,
+    // model: 'GLM-4-Flash-250414',
+    // temperature: 0.9,
+    // timeout: 300000
+
+    baseURL: 'https://api.lingyiwanwu.com/v1/',
+    apiKey: import.meta.env.VITE_TEXT_LINGYIWANGWU_API_KEY,
+    model: 'yi-lightning',
+    temperature: 0.7,
     timeout: 300000
 }
 

+ 1 - 1
src/services/imageService.ts

@@ -1,6 +1,6 @@
 import type { Recipe } from '@/types'
 
-const API_KEY = import.meta.env.VITE_IMAGE_GENERATION_API_KEY
+const API_KEY = import.meta.env.VITE_IMAGE_BIGMODEL_API_KEY
 const API_URL = 'https://open.bigmodel.cn/api/paas/v4/images/generations'
 
 export interface GeneratedImage {