Revert "Merge pull request #424 from Wangnov/feat/i18n"

This reverts commit 1d915d8327, reversing
changes made to 009f7c84f6.
This commit is contained in:
shaw
2025-09-12 09:21:53 +08:00
parent 1d915d8327
commit 9c4dc714f8
80 changed files with 7026 additions and 19087 deletions

View File

@@ -1,7 +1,6 @@
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import { apiStatsClient } from '@/config/apiStats'
import i18n from '@/i18n'
export const useApiStatsStore = defineStore('apistats', () => {
// 状态
@@ -94,7 +93,7 @@ export const useApiStatsStore = defineStore('apistats', () => {
}
if (!apiKey.value.trim()) {
error.value = i18n.global.t('apiStats.enterApiKey')
error.value = '请输入 API Key'
return
}
@@ -126,18 +125,14 @@ export const useApiStatsStore = defineStore('apistats', () => {
// 更新 URL
updateURL()
} else {
throw new Error(
statsResult.message || i18n.global.t('common.errors.requestFailed', { status: 500 })
)
throw new Error(statsResult.message || '查询失败')
}
} else {
throw new Error(
idResult.message || i18n.global.t('common.errors.requestFailed', { status: 500 })
)
throw new Error(idResult.message || '获取 API Key ID 失败')
}
} catch (err) {
console.error('Query stats error:', err)
error.value = err.message || i18n.global.t('apiStats.errors.queryStatsFailed')
error.value = err.message || '查询统计数据失败,请检查您的 API Key 是否正确'
statsData.value = null
modelStats.value = []
apiId.value = null
@@ -214,7 +209,7 @@ export const useApiStatsStore = defineStore('apistats', () => {
if (result.success) {
modelStats.value = result.data || []
} else {
throw new Error(result.message || i18n.global.t('apiStats.errors.loadModelStatsFailed'))
throw new Error(result.message || '加载模型统计失败')
}
} catch (err) {
console.error('Load model stats error:', err)
@@ -271,13 +266,11 @@ export const useApiStatsStore = defineStore('apistats', () => {
// 清除错误信息
error.value = ''
} else {
throw new Error(
result.message || i18n.global.t('common.errors.requestFailed', { status: 500 })
)
throw new Error(result.message || '查询失败')
}
} catch (err) {
console.error('Load stats with apiId error:', err)
error.value = err.message || i18n.global.t('apiStats.errors.queryStatsFailed')
error.value = err.message || '查询统计数据失败'
statsData.value = null
modelStats.value = []
} finally {
@@ -337,7 +330,7 @@ export const useApiStatsStore = defineStore('apistats', () => {
async function queryBatchStats() {
const keys = parseApiKeys()
if (keys.length === 0) {
error.value = i18n.global.t('apiStats.errors.enterAtLeastOneKey')
error.value = '请输入至少一个有效的 API Key'
return
}
@@ -367,7 +360,7 @@ export const useApiStatsStore = defineStore('apistats', () => {
})
if (validIds.length === 0) {
throw new Error(i18n.global.t('common.errors.allApiKeysInvalid'))
throw new Error('所有 API Key 都无效')
}
apiIds.value = validIds
@@ -391,11 +384,11 @@ export const useApiStatsStore = defineStore('apistats', () => {
// 更新 URL
updateBatchURL()
} else {
throw new Error(batchResult.message || i18n.global.t('apiStats.errors.batchQueryFailed'))
throw new Error(batchResult.message || '批量查询失败')
}
} catch (err) {
console.error('Batch query error:', err)
error.value = err.message || i18n.global.t('apiStats.errors.batchQueryFailed')
error.value = err.message || '批量查询统计数据失败'
aggregatedStats.value = null
individualStats.value = []
} finally {
@@ -415,7 +408,7 @@ export const useApiStatsStore = defineStore('apistats', () => {
if (result.success) {
modelStats.value = result.data || []
} else {
throw new Error(result.message || i18n.global.t('apiStats.errors.batchModelStatsFailed'))
throw new Error(result.message || '加载批量模型统计失败')
}
} catch (err) {
console.error('Load batch model stats error:', err)