🐛Fix: T4 & T5 & T6 累积更新
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
</div>
|
||||
|
||||
<!-- 保存按钮 -->
|
||||
<!-- TODO 保存后应该使得 ChatPanel 组件刷新,使得能够选择厂商 -->
|
||||
<div class="form-group">
|
||||
<button @click="saveConfig" :disabled="!canSave" class="save-btn">
|
||||
保存配置
|
||||
@@ -60,7 +61,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { encrypt, decrypt } from '../utils/encryption'
|
||||
import { encrypt } from '../utils/encryption'
|
||||
|
||||
// 厂商配置预设
|
||||
const platforms = [
|
||||
@@ -72,31 +73,31 @@ const platforms = [
|
||||
keyType: 'api_key'
|
||||
},
|
||||
{
|
||||
id: 'anthropic',
|
||||
name: 'Anthropic',
|
||||
endpoint: 'https://api.anthropic.com/v1/messages',
|
||||
id: 'zhipu',
|
||||
name: '智谱',
|
||||
endpoint: 'https://open.bigmodel.cn/api/paas/v4/chat/completions',
|
||||
keyPlaceholder: 'sk-...',
|
||||
keyType: 'api_key'
|
||||
},
|
||||
{
|
||||
id: 'google',
|
||||
name: 'Google (Gemini)',
|
||||
endpoint: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent',
|
||||
keyPlaceholder: 'AIza...',
|
||||
id: 'deepseek',
|
||||
name: 'DeepSeek',
|
||||
endpoint: 'https://api.deepseek.com/chat/completions',
|
||||
keyPlaceholder: 'sk-...',
|
||||
keyType: 'api_key'
|
||||
},
|
||||
{
|
||||
id: 'qwen',
|
||||
name: '通义千问(阿里云)',
|
||||
endpoint: 'https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation',
|
||||
name: '通义千问',
|
||||
endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
|
||||
keyPlaceholder: 'sk-...',
|
||||
keyType: 'api_key'
|
||||
},
|
||||
{
|
||||
id: 'wenxin',
|
||||
name: '文心一言(百度)',
|
||||
endpoint: 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie_bot',
|
||||
keyPlaceholder: 'your_api_key',
|
||||
id: 'siliconflow',
|
||||
name: '硅基流动',
|
||||
endpoint: 'https://api.siliconflow.cn/v1/chat/completions',
|
||||
keyPlaceholder: 'sk-...',
|
||||
keyType: 'api_key'
|
||||
}
|
||||
]
|
||||
@@ -196,14 +197,9 @@ const validateApiKey = () => {
|
||||
if (!platform) return true
|
||||
|
||||
// 根据厂商类型验证密钥格式
|
||||
if (platform.id === 'openai' || platform.id === 'qwen' || platform.id === 'anthropic') {
|
||||
if (!key.startsWith('sk-')) {
|
||||
showValidation('OpenAI/通义千问密钥应以 "sk-" 开头', 'error')
|
||||
return false
|
||||
}
|
||||
} else if (platform.id === 'google') {
|
||||
if (!key.startsWith('AIza')) {
|
||||
showValidation('Google密钥应以 "AIza" 开头', 'error')
|
||||
if (platform.keyType === 'api_key') {
|
||||
if (!key.startsWith('sk-') || key.length < 20) {
|
||||
showValidation('API 密钥格式不正确,应以 "sk-" 开头且长度不少于20位', 'error')
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user