fix(frontend): 修复账号管理页面 API Key 类型的提示文案错误
- 添加 OpenAI/Gemini 平台的 baseUrlHint 和 apiKeyHint 国际化文案 - 修改 CreateAccountModal 和 EditAccountModal 根据平台显示正确提示 - 将重复的平台判断逻辑抽取为 computed 属性,优化代码结构
This commit is contained in:
@@ -530,7 +530,7 @@
|
|||||||
: 'https://api.anthropic.com'
|
: 'https://api.anthropic.com'
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<p class="input-hint">{{ t('admin.accounts.baseUrlHint') }}</p>
|
<p class="input-hint">{{ baseUrlHint }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="input-label">{{ t('admin.accounts.apiKeyRequired') }}</label>
|
<label class="input-label">{{ t('admin.accounts.apiKeyRequired') }}</label>
|
||||||
@@ -547,13 +547,7 @@
|
|||||||
: 'sk-ant-...'
|
: 'sk-ant-...'
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<p class="input-hint">
|
<p class="input-hint">{{ apiKeyHint }}</p>
|
||||||
{{
|
|
||||||
form.platform === 'gemini'
|
|
||||||
? t('admin.accounts.gemini.apiKeyHint')
|
|
||||||
: t('admin.accounts.apiKeyHint')
|
|
||||||
}}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Model Restriction Section (不适用于 Gemini) -->
|
<!-- Model Restriction Section (不适用于 Gemini) -->
|
||||||
@@ -1115,6 +1109,19 @@ const oauthStepTitle = computed(() => {
|
|||||||
return t('admin.accounts.oauth.title')
|
return t('admin.accounts.oauth.title')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Platform-specific hints for API Key type
|
||||||
|
const baseUrlHint = computed(() => {
|
||||||
|
if (form.platform === 'openai') return t('admin.accounts.openai.baseUrlHint')
|
||||||
|
if (form.platform === 'gemini') return t('admin.accounts.gemini.baseUrlHint')
|
||||||
|
return t('admin.accounts.baseUrlHint')
|
||||||
|
})
|
||||||
|
|
||||||
|
const apiKeyHint = computed(() => {
|
||||||
|
if (form.platform === 'openai') return t('admin.accounts.openai.apiKeyHint')
|
||||||
|
if (form.platform === 'gemini') return t('admin.accounts.gemini.apiKeyHint')
|
||||||
|
return t('admin.accounts.apiKeyHint')
|
||||||
|
})
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
show: boolean
|
show: boolean
|
||||||
proxies: Proxy[]
|
proxies: Proxy[]
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
: 'https://api.anthropic.com'
|
: 'https://api.anthropic.com'
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<p class="input-hint">{{ t('admin.accounts.baseUrlHint') }}</p>
|
<p class="input-hint">{{ baseUrlHint }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="input-label">{{ t('admin.accounts.apiKey') }}</label>
|
<label class="input-label">{{ t('admin.accounts.apiKey') }}</label>
|
||||||
@@ -536,6 +536,14 @@ const emit = defineEmits<{
|
|||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
|
|
||||||
|
// Platform-specific hint for Base URL
|
||||||
|
const baseUrlHint = computed(() => {
|
||||||
|
if (!props.account) return t('admin.accounts.baseUrlHint')
|
||||||
|
if (props.account.platform === 'openai') return t('admin.accounts.openai.baseUrlHint')
|
||||||
|
if (props.account.platform === 'gemini') return t('admin.accounts.gemini.baseUrlHint')
|
||||||
|
return t('admin.accounts.baseUrlHint')
|
||||||
|
})
|
||||||
|
|
||||||
// Model mapping type
|
// Model mapping type
|
||||||
interface ModelMapping {
|
interface ModelMapping {
|
||||||
from: string
|
from: string
|
||||||
|
|||||||
@@ -915,6 +915,11 @@ export default {
|
|||||||
apiKeyRequired: 'API Key *',
|
apiKeyRequired: 'API Key *',
|
||||||
apiKeyPlaceholder: 'sk-ant-api03-...',
|
apiKeyPlaceholder: 'sk-ant-api03-...',
|
||||||
apiKeyHint: 'Your Claude Console API Key',
|
apiKeyHint: 'Your Claude Console API Key',
|
||||||
|
// OpenAI specific hints
|
||||||
|
openai: {
|
||||||
|
baseUrlHint: 'Leave default for official OpenAI API',
|
||||||
|
apiKeyHint: 'Your OpenAI API Key'
|
||||||
|
},
|
||||||
modelRestriction: 'Model Restriction (Optional)',
|
modelRestriction: 'Model Restriction (Optional)',
|
||||||
modelWhitelist: 'Model Whitelist',
|
modelWhitelist: 'Model Whitelist',
|
||||||
modelMapping: 'Model Mapping',
|
modelMapping: 'Model Mapping',
|
||||||
@@ -1076,6 +1081,7 @@ export default {
|
|||||||
modelPassthrough: 'Gemini Model Passthrough',
|
modelPassthrough: 'Gemini Model Passthrough',
|
||||||
modelPassthroughDesc:
|
modelPassthroughDesc:
|
||||||
'All model requests are forwarded directly to the Gemini API without model restrictions or mappings.',
|
'All model requests are forwarded directly to the Gemini API without model restrictions or mappings.',
|
||||||
|
baseUrlHint: 'Leave default for official Gemini API',
|
||||||
apiKeyHint: 'Your Gemini API Key (starts with AIza)'
|
apiKeyHint: 'Your Gemini API Key (starts with AIza)'
|
||||||
},
|
},
|
||||||
// Re-Auth Modal
|
// Re-Auth Modal
|
||||||
|
|||||||
@@ -1054,6 +1054,11 @@ export default {
|
|||||||
apiKeyRequired: 'API Key *',
|
apiKeyRequired: 'API Key *',
|
||||||
apiKeyPlaceholder: 'sk-ant-api03-...',
|
apiKeyPlaceholder: 'sk-ant-api03-...',
|
||||||
apiKeyHint: '您的 Claude Console API Key',
|
apiKeyHint: '您的 Claude Console API Key',
|
||||||
|
// OpenAI specific hints
|
||||||
|
openai: {
|
||||||
|
baseUrlHint: '留空使用官方 OpenAI API',
|
||||||
|
apiKeyHint: '您的 OpenAI API Key'
|
||||||
|
},
|
||||||
modelRestriction: '模型限制(可选)',
|
modelRestriction: '模型限制(可选)',
|
||||||
modelWhitelist: '模型白名单',
|
modelWhitelist: '模型白名单',
|
||||||
modelMapping: '模型映射',
|
modelMapping: '模型映射',
|
||||||
@@ -1197,7 +1202,8 @@ export default {
|
|||||||
gemini: {
|
gemini: {
|
||||||
modelPassthrough: 'Gemini 直接转发模型',
|
modelPassthrough: 'Gemini 直接转发模型',
|
||||||
modelPassthroughDesc: '所有模型请求将直接转发至 Gemini API,不进行模型限制或映射。',
|
modelPassthroughDesc: '所有模型请求将直接转发至 Gemini API,不进行模型限制或映射。',
|
||||||
apiKeyHint: 'Your Gemini API Key(以 AIza 开头)'
|
baseUrlHint: '留空使用官方 Gemini API',
|
||||||
|
apiKeyHint: '您的 Gemini API Key(以 AIza 开头)'
|
||||||
},
|
},
|
||||||
// Re-Auth Modal
|
// Re-Auth Modal
|
||||||
reAuthorizeAccount: '重新授权账号',
|
reAuthorizeAccount: '重新授权账号',
|
||||||
|
|||||||
Reference in New Issue
Block a user