mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-02 08:31:35 +00:00
feat(frontend): Fast/Flex 策略支持搜索选择用户
将手工 User ID 输入替换为带防抖的邮箱模糊搜索和多选标签,同时继续保存 user_ids。 回显已有用户邮箱并保留无法解析的历史 ID,补齐中英文文案路径及组件回归测试。
This commit is contained in:
1 parent
e316ebf528
commit
0464856c4a
6 files changed
+390
-76
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import en from '../locales/en'
|
||||
import zh from '../locales/zh'
|
||||
|
||||
describe('OpenAI Fast/Flex policy locale keys', () => {
|
||||
it('exposes user scope copy at the runtime zh path', () => {
|
||||
expect(zh.admin.settings.openaiFastPolicy).toMatchObject({
|
||||
userIds: '指定用户',
|
||||
userIdsHint: '输入任意邮箱关键词进行模糊搜索。留空表示对全部 Sub2API 用户生效;选中用户的 API Key 请求优先匹配用户规则。',
|
||||
userSearchPlaceholder: '输入用户邮箱搜索',
|
||||
userSearchEmpty: '未找到匹配用户',
|
||||
userDeleted: '(已删除)',
|
||||
userIdFallback: '用户 #{id}',
|
||||
removeUser: '移除用户'
|
||||
})
|
||||
})
|
||||
|
||||
it('exposes user scope copy at the runtime en path', () => {
|
||||
expect(en.admin.settings.openaiFastPolicy).toMatchObject({
|
||||
userIds: 'Specific users',
|
||||
userIdsHint: 'Type any part of a user email to search. Leave empty to apply to all Sub2API users. Selected users match requests from their API keys and take precedence over global rules.',
|
||||
userSearchPlaceholder: 'Search by user email',
|
||||
userSearchEmpty: 'No matching users found',
|
||||
userDeleted: '(deleted)',
|
||||
userIdFallback: 'User #{id}',
|
||||
removeUser: 'Remove user'
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -979,11 +979,6 @@ export default {
|
||||
scopeOAuth: 'OAuth only',
|
||||
scopeAPIKey: 'API Key only',
|
||||
scopeBedrock: 'Bedrock only',
|
||||
userIds: 'Specific user IDs',
|
||||
userIdsHint: 'Leave empty to apply to all Sub2API users. Specified users match requests from their API keys and take precedence over global rules.',
|
||||
userIdPlaceholder: 'e.g., 1001',
|
||||
addUserId: 'Add user ID',
|
||||
removeUserId: 'Remove user ID',
|
||||
errorMessage: 'Error message',
|
||||
errorMessagePlaceholder: 'Custom error message when blocked',
|
||||
errorMessageHint: 'Leave empty for default message',
|
||||
@@ -1024,6 +1019,13 @@ export default {
|
||||
scopeOAuth: 'OAuth only',
|
||||
scopeAPIKey: 'API Key only',
|
||||
scopeBedrock: 'Bedrock only',
|
||||
userIds: 'Specific users',
|
||||
userIdsHint: 'Type any part of a user email to search. Leave empty to apply to all Sub2API users. Selected users match requests from their API keys and take precedence over global rules.',
|
||||
userSearchPlaceholder: 'Search by user email',
|
||||
userSearchEmpty: 'No matching users found',
|
||||
userDeleted: '(deleted)',
|
||||
userIdFallback: 'User #{id}',
|
||||
removeUser: 'Remove user',
|
||||
errorMessage: 'Error message',
|
||||
errorMessagePlaceholder: 'Custom error message when blocked',
|
||||
errorMessageHint: 'Leave empty for the default message.',
|
||||
|
||||
@@ -974,11 +974,6 @@ export default {
|
||||
scopeOAuth: '仅 OAuth 账号',
|
||||
scopeAPIKey: '仅 API Key 账号',
|
||||
scopeBedrock: '仅 Bedrock 账号',
|
||||
userIds: '指定用户 ID',
|
||||
userIdsHint: '留空表示对全部 Sub2API 用户生效。指定后仅匹配这些用户的 API Key 请求,且优先于全局规则。',
|
||||
userIdPlaceholder: '例如: 1001',
|
||||
addUserId: '添加用户 ID',
|
||||
removeUserId: '移除用户 ID',
|
||||
errorMessage: '错误消息',
|
||||
errorMessagePlaceholder: '拦截时返回的自定义错误消息',
|
||||
errorMessageHint: '留空则使用默认错误消息',
|
||||
@@ -1019,6 +1014,13 @@ export default {
|
||||
scopeOAuth: '仅 OAuth 账号',
|
||||
scopeAPIKey: '仅 API Key 账号',
|
||||
scopeBedrock: '仅 Bedrock 账号',
|
||||
userIds: '指定用户',
|
||||
userIdsHint: '输入任意邮箱关键词进行模糊搜索。留空表示对全部 Sub2API 用户生效;选中用户的 API Key 请求优先匹配用户规则。',
|
||||
userSearchPlaceholder: '输入用户邮箱搜索',
|
||||
userSearchEmpty: '未找到匹配用户',
|
||||
userDeleted: '(已删除)',
|
||||
userIdFallback: '用户 #{id}',
|
||||
removeUser: '移除用户',
|
||||
errorMessage: '错误消息',
|
||||
errorMessagePlaceholder: '拦截时返回的自定义错误消息',
|
||||
errorMessageHint: '留空则使用默认错误消息。',
|
||||
|
||||
Reference in new issue
Block a user