|
@@ -1,47 +1,63 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div v-if="isVisible" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-2 md:p-4">
|
|
|
|
|
- <div class="bg-white rounded-lg max-w-2xl w-full max-h-[95vh] md:max-h-[90vh] flex flex-col">
|
|
|
|
|
|
|
+ <div v-if="isVisible" class="fixed inset-0 bg-black bg-opacity-50 z-50">
|
|
|
|
|
+ <!-- 轻提示 -->
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-if="toast.show"
|
|
|
|
|
+ class="fixed top-4 left-1/2 transform -translate-x-1/2 z-60 bg-white border border-gray-200 rounded-lg shadow-lg px-4 py-3 flex items-center gap-2 transition-all duration-300"
|
|
|
|
|
+ >
|
|
|
|
|
+ <svg v-if="toast.type === 'success'" class="w-5 h-5 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
|
|
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
|
|
|
|
|
+ </svg>
|
|
|
|
|
+ <svg v-if="toast.type === 'info'" class="w-5 h-5 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
|
|
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
|
|
|
+ </svg>
|
|
|
|
|
+ <span class="text-sm text-gray-700">{{ toast.message }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="bg-white w-full h-full flex flex-col">
|
|
|
<!-- 固定头部 -->
|
|
<!-- 固定头部 -->
|
|
|
- <div class="flex justify-between items-center p-4 md:p-6 pb-3 md:pb-4 border-b">
|
|
|
|
|
- <h2 class="text-xl md:text-2xl font-bold text-gray-800">系统设置</h2>
|
|
|
|
|
- <button @click="closeModal" class="text-gray-500 hover:text-gray-700">
|
|
|
|
|
- <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
|
|
|
|
+ <div class="flex justify-between items-center px-4 py-3 md:px-6 md:py-4 border-b border-gray-200 bg-white flex-shrink-0">
|
|
|
|
|
+ <h2 class="text-lg md:text-xl font-semibold text-gray-800">系统设置</h2>
|
|
|
|
|
+ <button @click="closeModal" class="text-gray-400 hover:text-gray-600 p-1">
|
|
|
|
|
+ <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
|
|
|
</svg>
|
|
</svg>
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <!-- 可滚动内容区域 -->
|
|
|
|
|
- <div class="flex-1 overflow-y-auto px-4 md:px-6 py-3 md:py-4">
|
|
|
|
|
- <div class="space-y-4 md:space-y-6">
|
|
|
|
|
- <!-- 302.AI 推荐广告 -->
|
|
|
|
|
- <div class="bg-gradient-to-r from-blue-50 to-purple-50 border border-blue-200 rounded-lg p-3 md:p-4">
|
|
|
|
|
- <!-- 手机端:垂直布局,桌面端:水平布局 -->
|
|
|
|
|
- <div class="flex flex-col md:flex-row md:items-center gap-3">
|
|
|
|
|
- <div class="flex-shrink-0 flex justify-center md:justify-start">
|
|
|
|
|
- <div class="w-10 h-10 from-blue-500 to-purple-600 rounded-xl flex items-center justify-center">
|
|
|
|
|
- <img src="/logo.svg" alt="302.AI Logo" class="w-8 h-8 md:w-10 md:h-10" />
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="flex-1 text-center md:text-left">
|
|
|
|
|
- <h3 class="text-sm md:text-base font-semibold text-gray-800 mb-1">🚀 推荐API服务商</h3>
|
|
|
|
|
- <p class="text-xs text-gray-600 mb-2 leading-relaxed">
|
|
|
|
|
- 本项目正在使用 <strong>302.AI</strong> 提供的高质量AI API服务!<strong>302.AI</strong>
|
|
|
|
|
- 是一个按用量付费的企业级AI资源平台,提供市场上最新、最全面的AI模型和API,以及多种开箱即用的在线AI应用
|
|
|
|
|
- </p>
|
|
|
|
|
- <div class="flex flex-col md:flex-row items-center gap-2">
|
|
|
|
|
- <div class="flex flex-wrap gap-1 justify-center md:justify-start">
|
|
|
|
|
- <span class="bg-green-100 text-green-800 text-xs px-2 py-0.5 rounded">✓ 多模型</span>
|
|
|
|
|
- <span class="bg-green-100 text-green-800 text-xs px-2 py-0.5 rounded">✓ 优惠</span>
|
|
|
|
|
- <span class="bg-green-100 text-green-800 text-xs px-2 py-0.5 rounded">✓ 稳定</span>
|
|
|
|
|
|
|
+ <!-- 主要内容区域 -->
|
|
|
|
|
+ <div class="flex-1 overflow-hidden">
|
|
|
|
|
+ <!-- 移动端:垂直滚动布局,PC端:左右布局 -->
|
|
|
|
|
+ <div class="h-full md:flex md:overflow-hidden">
|
|
|
|
|
+ <!-- 移动端和PC端的统一滚动容器 -->
|
|
|
|
|
+ <div class="h-full overflow-y-auto md:flex md:w-full">
|
|
|
|
|
+ <!-- 左侧:推荐广告区域 -->
|
|
|
|
|
+ <div class="md:w-1/3 bg-gradient-to-br from-blue-50 to-purple-50 p-3 md:p-6 border-b md:border-b-0 md:border-r border-blue-200 md:flex-shrink-0">
|
|
|
|
|
+ <div class="md:h-full md:flex md:flex-col md:justify-center">
|
|
|
|
|
+ <div class="text-center">
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="w-12 h-12 md:w-20 md:h-20 mx-auto mb-2 md:mb-4 bg-gradient-to-r from-blue-500 to-purple-600 rounded-xl md:rounded-2xl flex items-center justify-center"
|
|
|
|
|
+ >
|
|
|
|
|
+ <img src="/logo.svg" alt="302.AI Logo" class="w-8 h-8 md:w-16 md:h-16" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <h3 class="text-base md:text-xl font-bold text-gray-800 mb-2 md:mb-3">🚀 推荐API服务商</h3>
|
|
|
|
|
+ <p class="text-xs md:text-sm text-gray-600 mb-2 md:mb-4 leading-relaxed hidden md:block">
|
|
|
|
|
+ 本项目正在使用 <strong>302.AI</strong> 提供的高质量AI API服务!<strong>302.AI</strong>
|
|
|
|
|
+ 是一个按用量付费的企业级AI资源平台,提供市场上最新、最全面的AI模型和API。
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <p class="text-xs text-gray-600 mb-2 leading-relaxed md:hidden">使用 <strong>302.AI</strong> 高质量AI API服务</p>
|
|
|
|
|
+ <div class="flex flex-wrap gap-1 md:gap-2 justify-center mb-2 md:mb-4">
|
|
|
|
|
+ <span class="bg-green-100 text-green-800 text-xs md:text-sm px-2 py-0.5 md:px-3 md:py-1 rounded-full">✓ 多模型</span>
|
|
|
|
|
+ <span class="bg-green-100 text-green-800 text-xs md:text-sm px-2 py-0.5 md:px-3 md:py-1 rounded-full">✓ 优惠</span>
|
|
|
|
|
+ <span class="bg-green-100 text-green-800 text-xs md:text-sm px-2 py-0.5 md:px-3 md:py-1 rounded-full">✓ 稳定</span>
|
|
|
</div>
|
|
</div>
|
|
|
<a
|
|
<a
|
|
|
href="https://share.302.AI/DymMSI"
|
|
href="https://share.302.AI/DymMSI"
|
|
|
target="_blank"
|
|
target="_blank"
|
|
|
- class="inline-flex items-center gap-1 bg-blue-500 hover:bg-blue-600 text-white text-xs px-3 py-1 rounded transition-colors md:ml-auto"
|
|
|
|
|
|
|
+ class="inline-flex items-center gap-1 md:gap-2 bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 md:px-6 md:py-3 rounded md:rounded-lg transition-colors text-xs md:text-sm font-medium"
|
|
|
>
|
|
>
|
|
|
- <span>访问</span>
|
|
|
|
|
- <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
|
|
|
|
+ <span>立即访问</span>
|
|
|
|
|
+ <svg class="w-3 h-3 md:w-4 md:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
<path
|
|
<path
|
|
|
stroke-linecap="round"
|
|
stroke-linecap="round"
|
|
|
stroke-linejoin="round"
|
|
stroke-linejoin="round"
|
|
@@ -53,161 +69,134 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
|
|
|
|
- <!-- 菜谱生成模型配置 -->
|
|
|
|
|
- <div class="border rounded-lg">
|
|
|
|
|
- <button
|
|
|
|
|
- @click="isTextConfigExpanded = !isTextConfigExpanded"
|
|
|
|
|
- class="w-full p-3 md:p-4 flex items-center justify-between text-left hover:bg-gray-50 transition-colors"
|
|
|
|
|
- >
|
|
|
|
|
- <h3 class="text-base md:text-lg font-semibold text-gray-800 flex items-center">
|
|
|
|
|
- <svg class="w-4 h-4 md:w-5 md:h-5 mr-2 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
|
|
- <path
|
|
|
|
|
- stroke-linecap="round"
|
|
|
|
|
- stroke-linejoin="round"
|
|
|
|
|
- stroke-width="2"
|
|
|
|
|
- d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
|
|
|
- ></path>
|
|
|
|
|
- </svg>
|
|
|
|
|
- 菜谱生成模型配置
|
|
|
|
|
- </h3>
|
|
|
|
|
- <svg
|
|
|
|
|
- class="w-5 h-5 text-gray-500 transition-transform"
|
|
|
|
|
- :class="{ 'rotate-180': isTextConfigExpanded }"
|
|
|
|
|
- fill="none"
|
|
|
|
|
- stroke="currentColor"
|
|
|
|
|
- viewBox="0 0 24 24"
|
|
|
|
|
- >
|
|
|
|
|
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
|
|
|
|
- </svg>
|
|
|
|
|
- </button>
|
|
|
|
|
-
|
|
|
|
|
- <div v-show="isTextConfigExpanded" class="px-3 md:px-4 pb-3 md:pb-4">
|
|
|
|
|
- <div class="space-y-3 md:space-y-4">
|
|
|
|
|
- <!-- API地址单独一行 -->
|
|
|
|
|
- <div>
|
|
|
|
|
- <label class="block text-sm font-medium text-gray-700 mb-1">API地址</label>
|
|
|
|
|
- <input
|
|
|
|
|
- v-model="textConfig.baseUrl"
|
|
|
|
|
- type="text"
|
|
|
|
|
- class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
|
|
|
- placeholder="https://api.example.com/v1/"
|
|
|
|
|
- />
|
|
|
|
|
- <p class="text-xs text-gray-500 mt-1">基础API地址,系统会自动添加 /chat/completions 路径</p>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <!-- 右侧:配置表单区域 -->
|
|
|
|
|
+ <div class="md:flex-1 p-4 md:p-6">
|
|
|
|
|
+ <div class="w-full space-y-6">
|
|
|
|
|
+ <!-- 菜谱生成模型配置 -->
|
|
|
|
|
+ <div class="bg-white border border-gray-200 rounded-lg p-4 md:p-6">
|
|
|
|
|
+ <h3 class="text-lg font-semibold text-gray-800 flex items-center mb-4">
|
|
|
|
|
+ <svg class="w-5 h-5 mr-3 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
|
|
+ <path
|
|
|
|
|
+ stroke-linecap="round"
|
|
|
|
|
+ stroke-linejoin="round"
|
|
|
|
|
+ stroke-width="2"
|
|
|
|
|
+ d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
|
|
|
+ ></path>
|
|
|
|
|
+ </svg>
|
|
|
|
|
+ 菜谱生成模型配置
|
|
|
|
|
+ </h3>
|
|
|
|
|
|
|
|
- <!-- 其他配置项两列布局 -->
|
|
|
|
|
- <div class="grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4">
|
|
|
|
|
- <div>
|
|
|
|
|
- <label class="block text-sm font-medium text-gray-700 mb-1">API密钥</label>
|
|
|
|
|
- <input
|
|
|
|
|
- v-model="textConfig.apiKey"
|
|
|
|
|
- type="password"
|
|
|
|
|
- class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
|
|
|
- placeholder="输入API密钥"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div class="space-y-4">
|
|
|
|
|
+ <!-- API地址 -->
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <label class="block text-sm font-medium text-gray-700 mb-2">API地址</label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ v-model="textConfig.baseUrl"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm"
|
|
|
|
|
+ placeholder="https://api.example.com/v1/"
|
|
|
|
|
+ />
|
|
|
|
|
+ <p class="text-xs text-gray-500 mt-1">基础API地址,系统会自动添加 /chat/completions 路径</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
- <div>
|
|
|
|
|
- <label class="block text-sm font-medium text-gray-700 mb-1">模型名称</label>
|
|
|
|
|
- <input
|
|
|
|
|
- v-model="textConfig.model"
|
|
|
|
|
- type="text"
|
|
|
|
|
- class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
|
|
|
- placeholder="yi-lightning"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <!-- 配置项网格 -->
|
|
|
|
|
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <label class="block text-sm font-medium text-gray-700 mb-2">API密钥</label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ v-model="textConfig.apiKey"
|
|
|
|
|
+ type="password"
|
|
|
|
|
+ class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm"
|
|
|
|
|
+ placeholder="输入API密钥"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
- <div>
|
|
|
|
|
- <label class="block text-sm font-medium text-gray-700 mb-1">温度参数 (0-1)</label>
|
|
|
|
|
- <input
|
|
|
|
|
- v-model.number="textConfig.temperature"
|
|
|
|
|
- type="number"
|
|
|
|
|
- min="0"
|
|
|
|
|
- max="1"
|
|
|
|
|
- step="0.1"
|
|
|
|
|
- class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
|
|
|
- />
|
|
|
|
|
- <p class="text-xs text-gray-500 mt-1">控制回答的创造性,0.7为推荐值</p>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <label class="block text-sm font-medium text-gray-700 mb-2">模型名称</label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ v-model="textConfig.model"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm"
|
|
|
|
|
+ placeholder="yi-lightning"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
- <div>
|
|
|
|
|
- <label class="block text-sm font-medium text-gray-700 mb-1">超时时间 (毫秒)</label>
|
|
|
|
|
- <input
|
|
|
|
|
- v-model.number="textConfig.timeout"
|
|
|
|
|
- type="number"
|
|
|
|
|
- class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
|
|
|
- placeholder="300000"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <label class="block text-sm font-medium text-gray-700 mb-2">温度参数 (0-1)</label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ v-model.number="textConfig.temperature"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ min="0"
|
|
|
|
|
+ max="1"
|
|
|
|
|
+ step="0.1"
|
|
|
|
|
+ class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm"
|
|
|
|
|
+ />
|
|
|
|
|
+ <p class="text-xs text-gray-500 mt-1">控制回答的创造性,0.7为推荐值</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <label class="block text-sm font-medium text-gray-700 mb-2">超时时间 (毫秒)</label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ v-model.number="textConfig.timeout"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm"
|
|
|
|
|
+ placeholder="300000"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
|
|
|
- <!-- 图片生成模型配置 -->
|
|
|
|
|
- <div class="border rounded-lg">
|
|
|
|
|
- <button
|
|
|
|
|
- @click="isImageConfigExpanded = !isImageConfigExpanded"
|
|
|
|
|
- class="w-full p-3 md:p-4 flex items-center justify-between text-left hover:bg-gray-50 transition-colors"
|
|
|
|
|
- >
|
|
|
|
|
- <h3 class="text-base md:text-lg font-semibold text-gray-800 flex items-center">
|
|
|
|
|
- <svg class="w-4 h-4 md:w-5 md:h-5 mr-2 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
|
|
- <path
|
|
|
|
|
- stroke-linecap="round"
|
|
|
|
|
- stroke-linejoin="round"
|
|
|
|
|
- stroke-width="2"
|
|
|
|
|
- d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
|
|
|
- ></path>
|
|
|
|
|
- </svg>
|
|
|
|
|
- 图片生成模型配置
|
|
|
|
|
- </h3>
|
|
|
|
|
- <svg
|
|
|
|
|
- class="w-5 h-5 text-gray-500 transition-transform"
|
|
|
|
|
- :class="{ 'rotate-180': isImageConfigExpanded }"
|
|
|
|
|
- fill="none"
|
|
|
|
|
- stroke="currentColor"
|
|
|
|
|
- viewBox="0 0 24 24"
|
|
|
|
|
- >
|
|
|
|
|
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
|
|
|
|
- </svg>
|
|
|
|
|
- </button>
|
|
|
|
|
-
|
|
|
|
|
- <div v-show="isImageConfigExpanded" class="px-3 md:px-4 pb-3 md:pb-4">
|
|
|
|
|
- <div class="space-y-3 md:space-y-4">
|
|
|
|
|
- <!-- API地址单独一行 -->
|
|
|
|
|
- <div>
|
|
|
|
|
- <label class="block text-sm font-medium text-gray-700 mb-1">API地址</label>
|
|
|
|
|
- <input
|
|
|
|
|
- v-model="imageConfig.baseUrl"
|
|
|
|
|
- type="text"
|
|
|
|
|
- class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500"
|
|
|
|
|
- placeholder="https://api.example.com/v4/images/generations"
|
|
|
|
|
- />
|
|
|
|
|
- <p class="text-xs text-gray-500 mt-1">图片生成API的完整地址,包含具体的端点路径</p>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <!-- 图片生成模型配置 -->
|
|
|
|
|
+ <div class="bg-white border border-gray-200 rounded-lg p-4 md:p-6">
|
|
|
|
|
+ <h3 class="text-lg font-semibold text-gray-800 flex items-center mb-4">
|
|
|
|
|
+ <svg class="w-5 h-5 mr-3 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
|
|
|
+ <path
|
|
|
|
|
+ stroke-linecap="round"
|
|
|
|
|
+ stroke-linejoin="round"
|
|
|
|
|
+ stroke-width="2"
|
|
|
|
|
+ d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
|
|
|
+ ></path>
|
|
|
|
|
+ </svg>
|
|
|
|
|
+ 图片生成模型配置
|
|
|
|
|
+ </h3>
|
|
|
|
|
|
|
|
- <!-- 其他配置项两列布局 -->
|
|
|
|
|
- <div class="grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4">
|
|
|
|
|
- <div>
|
|
|
|
|
- <label class="block text-sm font-medium text-gray-700 mb-1">API密钥</label>
|
|
|
|
|
- <input
|
|
|
|
|
- v-model="imageConfig.apiKey"
|
|
|
|
|
- type="password"
|
|
|
|
|
- class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500"
|
|
|
|
|
- placeholder="输入API密钥"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div class="space-y-4">
|
|
|
|
|
+ <!-- API地址 -->
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <label class="block text-sm font-medium text-gray-700 mb-2">API地址</label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ v-model="imageConfig.baseUrl"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500 text-sm"
|
|
|
|
|
+ placeholder="https://api.example.com/v4/images/generations"
|
|
|
|
|
+ />
|
|
|
|
|
+ <p class="text-xs text-gray-500 mt-1">图片生成API的完整地址,包含具体的端点路径</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 配置项网格 -->
|
|
|
|
|
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <label class="block text-sm font-medium text-gray-700 mb-2">API密钥</label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ v-model="imageConfig.apiKey"
|
|
|
|
|
+ type="password"
|
|
|
|
|
+ class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500 text-sm"
|
|
|
|
|
+ placeholder="输入API密钥"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
- <div>
|
|
|
|
|
- <label class="block text-sm font-medium text-gray-700 mb-1">模型名称</label>
|
|
|
|
|
- <input
|
|
|
|
|
- v-model="imageConfig.model"
|
|
|
|
|
- type="text"
|
|
|
|
|
- class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500"
|
|
|
|
|
- placeholder="cogview-3-flash"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <label class="block text-sm font-medium text-gray-700 mb-2">模型名称</label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ v-model="imageConfig.model"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500 text-sm"
|
|
|
|
|
+ placeholder="cogview-3-flash"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -217,12 +206,9 @@
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 固定底部按钮 -->
|
|
<!-- 固定底部按钮 -->
|
|
|
- <div class="flex flex-col md:flex-row justify-end gap-2 md:gap-3 p-4 md:p-6 pt-3 md:pt-4 border-t bg-gray-50 rounded-b-lg">
|
|
|
|
|
- <button @click="resetToDefault" class="px-4 py-2 text-gray-600 border border-gray-300 rounded-md hover:bg-gray-50 transition-colors text-sm md:text-base">
|
|
|
|
|
- 恢复默认
|
|
|
|
|
- </button>
|
|
|
|
|
- <button @click="closeModal" class="px-4 py-2 text-gray-600 border border-gray-300 rounded-md hover:bg-gray-50 transition-colors text-sm md:text-base">取消</button>
|
|
|
|
|
- <button @click="saveSettings" class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition-colors text-sm md:text-base">保存设置</button>
|
|
|
|
|
|
|
+ <div class="flex justify-end gap-3 px-4 py-3 md:px-6 md:py-4 border-t border-gray-200 bg-gray-50 flex-shrink-0">
|
|
|
|
|
+ <button @click="resetToDefault" class="px-4 py-2 text-gray-600 border border-gray-300 rounded hover:bg-gray-100 transition-colors text-sm">恢复默认</button>
|
|
|
|
|
+ <button @click="saveSettings" class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors text-sm">保存设置</button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -243,9 +229,26 @@ const emit = defineEmits(['close', 'save'])
|
|
|
|
|
|
|
|
const settingsStore = useSettingsStore()
|
|
const settingsStore = useSettingsStore()
|
|
|
|
|
|
|
|
-// 折叠状态
|
|
|
|
|
-const isTextConfigExpanded = ref(true) // 默认展开菜谱生成模型配置
|
|
|
|
|
-const isImageConfigExpanded = ref(false)
|
|
|
|
|
|
|
+// 配置状态管理
|
|
|
|
|
+
|
|
|
|
|
+// 轻提示状态
|
|
|
|
|
+const toast = reactive({
|
|
|
|
|
+ show: false,
|
|
|
|
|
+ message: '',
|
|
|
|
|
+ type: 'success' // 'success' | 'info'
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+// 显示提示
|
|
|
|
|
+const showToast = (message, type = 'success') => {
|
|
|
|
|
+ toast.message = message
|
|
|
|
|
+ toast.type = type
|
|
|
|
|
+ toast.show = true
|
|
|
|
|
+
|
|
|
|
|
+ // 2秒后自动隐藏
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ toast.show = false
|
|
|
|
|
+ }, 2000)
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
// 文本生成配置
|
|
// 文本生成配置
|
|
|
const textConfig = reactive({
|
|
const textConfig = reactive({
|
|
@@ -313,14 +316,20 @@ const saveSettings = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
settingsStore.updateSettings(newSettings)
|
|
settingsStore.updateSettings(newSettings)
|
|
|
|
|
+ showToast('设置已保存', 'success')
|
|
|
emit('save')
|
|
emit('save')
|
|
|
- closeModal()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 延迟关闭弹窗,让用户看到提示
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ closeModal()
|
|
|
|
|
+ }, 500)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 恢复默认设置
|
|
// 恢复默认设置
|
|
|
const resetToDefault = () => {
|
|
const resetToDefault = () => {
|
|
|
settingsStore.resetToDefault()
|
|
settingsStore.resetToDefault()
|
|
|
loadCurrentSettings()
|
|
loadCurrentSettings()
|
|
|
|
|
+ showToast('已恢复默认设置', 'info')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 关闭弹窗
|
|
// 关闭弹窗
|