feat: add usage IP geolocation lookup

This commit is contained in:
DaydreamCoding
2026-07-01 21:49:49 +08:00
parent 7dc7cfce1d
commit 0ff93aca7a
11 changed files with 938 additions and 3 deletions
@@ -0,0 +1,24 @@
import { describe, expect, it } from 'vitest'
import en from '../locales/en'
import zh from '../locales/zh'
describe('usage ipGeo locale keys', () => {
it('contains zh labels for IP geolocation UI', () => {
expect(zh.usage.ipGeo.fetch).toBe('获取地区')
expect(zh.usage.ipGeo.fetching).toBe('获取中...')
expect(zh.usage.ipGeo.failed).toBe('获取失败')
expect(zh.usage.ipGeo.private).toBe('内网地址')
expect(zh.usage.ipGeo.batchFetch).toBe('批量获取地区')
expect(zh.usage.ipGeo.pending).toBe('{count} 个 IP 待获取地区')
})
it('contains en labels for IP geolocation UI', () => {
expect(en.usage.ipGeo.fetch).toBe('Fetch region')
expect(en.usage.ipGeo.fetching).toBe('Fetching...')
expect(en.usage.ipGeo.failed).toBe('Failed')
expect(en.usage.ipGeo.private).toBe('Private address')
expect(en.usage.ipGeo.batchFetch).toBe('Batch fetch regions')
expect(en.usage.ipGeo.pending).toBe('{count} IPs pending')
})
})
+15
View File
@@ -995,6 +995,21 @@ export default {
exportExcelFailed: 'Failed to export usage data',
imageUnit: ' images',
userAgent: 'User-Agent',
ipGeo: {
fetch: 'Fetch region',
fetching: 'Fetching...',
failed: 'Failed',
private: 'Private address',
refreshTitle: 'Refresh region info',
batchFetch: 'Batch fetch regions',
batchFetching: 'Fetching...',
pending: '{count} IPs pending',
batchFailed: 'Failed to batch fetch IP regions',
detailOrg: 'ISP',
detailTimezone: 'Timezone',
detailAccuracy: 'Accuracy',
detailCoordinates: 'Coordinates',
},
tabs: { usage: 'Usage', errors: 'Error Requests' },
errors: {
time: 'Time', model: 'Model', endpoint: 'Endpoint', status: 'Status',
+15
View File
@@ -999,6 +999,21 @@ export default {
exportExcelFailed: '使用数据导出失败',
imageUnit: '张',
userAgent: 'User-Agent',
ipGeo: {
fetch: '获取地区',
fetching: '获取中...',
failed: '获取失败',
private: '内网地址',
refreshTitle: '刷新地区信息',
batchFetch: '批量获取地区',
batchFetching: '获取中...',
pending: '{count} 个 IP 待获取地区',
batchFailed: '批量获取地区信息失败',
detailOrg: '运营商',
detailTimezone: '时区',
detailAccuracy: '定位精度',
detailCoordinates: '坐标',
},
tabs: { usage: '用量明细', errors: '错误请求' },
errors: {
time: '时间', model: '模型', endpoint: '端点', status: '状态码',