mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 05:56:35 +00:00
feat(provider): add provider and model sync feature with vendored generator (#378)
* feat(provider): vendor and adapt pi model generator - Vendor generate-models.ts, model-data.ts, and models-dev-reasoning-options.ts from @earendil-works/pi tag v0.82.1 - Adapt imports to use @earendil-works/pi-ai and expose generateModels programmatic function - Add compare.test.ts to verify vendored generator against original built-in catalog - Add packages/core/src/provider/generator to eslint ignores * feat(provider): add provider and model sync api and ui * feat(webui): add checkbox for existing providers and clean dialog description * feat(webui): add expand all and collapse all to sync providers dialog * refactor(provider): remove compare.test.ts and cli overhead from generate-models * fix(provider): add 30s timeout and strict error handling to sync catalog fetching * fix(e2e): eliminate drag-and-drop race condition on webkit Allow requestAnimationFrame collision updates to settle in dragCard helper before releasing pointer, and scope fileCard locator via data-testid to avoid matching sidebar tree items.
This commit is contained in:
@@ -24,14 +24,32 @@ export async function dragCard(page: Page, source: Locator, target: Locator): Pr
|
||||
await page.mouse.move(fromX, fromY)
|
||||
await page.mouse.down()
|
||||
|
||||
// Move in several chunks so the dnd-kit sensor activates mid-drag
|
||||
const dx = toX - fromX
|
||||
const dy = toY - fromY
|
||||
const dist = Math.hypot(dx, dy)
|
||||
|
||||
// Step past the 10px activation constraint to trigger drag activation
|
||||
// and give the browser a brief moment for status to become 'dragging'
|
||||
const activationRatio = dist > 0 ? Math.min(1, 15 / dist) : 1
|
||||
await page.mouse.move(fromX + dx * activationRatio, fromY + dy * activationRatio)
|
||||
await page.waitForTimeout(50)
|
||||
|
||||
// Move in several chunks so the intermediate dragmove handlers run
|
||||
const chunks = 8
|
||||
for (let i = 1; i <= chunks; i++) {
|
||||
const x = fromX + ((toX - fromX) * i) / chunks
|
||||
const y = fromY + ((toY - fromY) * i) / chunks
|
||||
const x = fromX + (dx * i) / chunks
|
||||
const y = fromY + (dy * i) / chunks
|
||||
await page.mouse.move(x, y)
|
||||
await page.waitForTimeout(15)
|
||||
await page.waitForTimeout(20)
|
||||
}
|
||||
|
||||
// Ensure pointer is directly over target center and allow requestAnimationFrame
|
||||
// and collision microtasks to settle before triggering drop
|
||||
await page.mouse.move(toX, toY)
|
||||
await page.evaluate(
|
||||
() => new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))),
|
||||
)
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await page.mouse.up()
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ interface CreateShareResponse {
|
||||
*/
|
||||
export function fileCard(page: Page, name: string): Locator {
|
||||
return page
|
||||
.locator('div.group')
|
||||
.locator('[data-testid="file-card"]')
|
||||
.filter({
|
||||
has: page.locator(`input[value="${name}"]`).or(page.getByText(name, { exact: true })),
|
||||
})
|
||||
|
||||
@@ -74,6 +74,7 @@ export default tseslint.config(
|
||||
'**/packages/db/src/generated/**',
|
||||
'**/packages/core/src/generated/**',
|
||||
'**/data/**',
|
||||
'**/packages/core/src/provider/generator/**',
|
||||
'**/packages/webui/components/ui/**',
|
||||
'**/packages/webui/paraglide/**',
|
||||
'**/packages/webui/public/**',
|
||||
|
||||
@@ -319,4 +319,89 @@ describe('provider api', () => {
|
||||
itemId: 'p1',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/providers/sync-check checks for updates', async () => {
|
||||
vi.mocked(providerService.checkUpdates).mockResolvedValue({
|
||||
providers: [
|
||||
{
|
||||
name: 'deepseek',
|
||||
isNewProvider: true,
|
||||
config: { api: 'openai-responses', apiKey: 'DEEPSEEK_API_KEY' },
|
||||
models: [],
|
||||
},
|
||||
],
|
||||
totalNewProviders: 1,
|
||||
totalNewModels: 0,
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/providers/sync-check', {
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.totalNewProviders).toBe(1)
|
||||
expect(data.providers).toHaveLength(1)
|
||||
expect(providerService.checkUpdates).toHaveBeenCalledWith('t1')
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: expect.anything(),
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /teams/:teamId/providers/sync-apply applies sync selection', async () => {
|
||||
vi.mocked(providerService.applySync).mockResolvedValue({
|
||||
addedProviders: 1,
|
||||
addedModels: 3,
|
||||
})
|
||||
|
||||
const payload = {
|
||||
providers: [
|
||||
{
|
||||
name: 'deepseek',
|
||||
isNewProvider: true,
|
||||
config: { api: 'openai-responses', apiKey: 'KEY' },
|
||||
models: [
|
||||
{
|
||||
modelId: 'deepseek-v4-flash',
|
||||
name: 'DeepSeek V4 Flash',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: true,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const res = await app.request('/teams/t1/providers/sync-apply', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.addedProviders).toBe(1)
|
||||
expect(data.addedModels).toBe(3)
|
||||
expect(providerService.applySync).toHaveBeenCalledWith('t1', payload)
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: expect.anything(),
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'provider_update',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,6 +5,7 @@ import { providerService } from '@shumai/core/src/provider/provider'
|
||||
import {
|
||||
createModelRequestSchema,
|
||||
createProviderRequestSchema,
|
||||
syncApplyRequestSchema,
|
||||
updateModelRequestSchema,
|
||||
updateProviderRequestSchema,
|
||||
AuditAction,
|
||||
@@ -30,6 +31,46 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.json(providers)
|
||||
})
|
||||
|
||||
.post('/teams/:teamId/providers/sync-check', async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
const user = c.get('user')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const result = await providerService.checkUpdates(teamId)
|
||||
return c.json(result)
|
||||
})
|
||||
|
||||
.post(
|
||||
'/teams/:teamId/providers/sync-apply',
|
||||
zValidator('json', syncApplyRequestSchema),
|
||||
async (c) => {
|
||||
const teamId = c.req.param('teamId')
|
||||
const user = c.get('user')
|
||||
const body = c.req.valid('json')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const result = await providerService.applySync(teamId, body)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.provider_update,
|
||||
teamId,
|
||||
userId: user?.id,
|
||||
})
|
||||
return c.json(result)
|
||||
},
|
||||
)
|
||||
|
||||
.get('/providers/:id/models', async (c) => {
|
||||
const id = c.req.param('id')
|
||||
const user = c.get('user')
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
import type { ThinkingLevel, ThinkingLevelMap } from '@earendil-works/pi-ai'
|
||||
|
||||
export type ModelsDevReasoningOption =
|
||||
| { type: 'toggle' }
|
||||
| {
|
||||
type: 'effort'
|
||||
values: Array<
|
||||
'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'default' | null
|
||||
>
|
||||
}
|
||||
| { type: 'budget_tokens'; min?: number; max?: number }
|
||||
|
||||
const THINKING_LEVELS: readonly ThinkingLevel[] = [
|
||||
'minimal',
|
||||
'low',
|
||||
'medium',
|
||||
'high',
|
||||
'xhigh',
|
||||
'max',
|
||||
]
|
||||
|
||||
/**
|
||||
* Converts models.dev verified effort values into Pi's selectable thinking levels.
|
||||
* Values without a Pi equivalent (`default` and JSON `null`) are intentionally
|
||||
* omitted.
|
||||
*/
|
||||
export function getEffortThinkingLevelMap(
|
||||
options: readonly ModelsDevReasoningOption[],
|
||||
): ThinkingLevelMap | undefined {
|
||||
const effortValues = options.flatMap((option) => (option.type === 'effort' ? option.values : []))
|
||||
if (effortValues.length === 0) return undefined
|
||||
|
||||
const supported = new Set(effortValues)
|
||||
if (!THINKING_LEVELS.some((level) => supported.has(level)) && !supported.has('none'))
|
||||
return undefined
|
||||
|
||||
const map: ThinkingLevelMap = { off: supported.has('none') ? 'none' : null }
|
||||
for (const level of THINKING_LEVELS) {
|
||||
map[level] = supported.has(level) ? level : null
|
||||
}
|
||||
return map
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { providerService } from './provider'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import * as generateModelsModule from './generator/generate-models'
|
||||
import { ProviderConfigSerializable, providerModelSchema } from '@shumai/dtos'
|
||||
import { getBuiltinProvidersMap } from '@shumai/core/src/provider/builtin'
|
||||
import { z } from 'zod'
|
||||
@@ -346,4 +348,181 @@ describe('ProviderService', () => {
|
||||
expect((modelsAfterUpdate[0].config as { api: string }).api).toBe('anthropic-messages')
|
||||
expect((modelsAfterUpdate[1].config as { api: string }).api).toBe('anthropic-messages')
|
||||
})
|
||||
|
||||
it(
|
||||
'should check for updates and correctly segregate new vs existing providers',
|
||||
{ timeout: 30000 },
|
||||
async () => {
|
||||
// 1. Check updates with empty team: all discovered providers are new
|
||||
const emptyTeam = await prisma.team.create({
|
||||
data: { name: 'Empty Provider Team' },
|
||||
})
|
||||
const initialCheck = await providerService.checkUpdates(emptyTeam.id)
|
||||
expect(initialCheck.totalNewProviders).toBeGreaterThan(0)
|
||||
expect(initialCheck.totalNewModels).toBeGreaterThan(0)
|
||||
expect(initialCheck.providers.every((p) => p.isNewProvider)).toBe(true)
|
||||
|
||||
// 2. With default team (which has builtin providers initialized)
|
||||
const teamWithBuiltins = await teamService.ensureDefaultTeam()
|
||||
|
||||
// 3. Check updates after init: existing providers should have isNewProvider: false
|
||||
const afterInitCheck = await providerService.checkUpdates(teamWithBuiltins.id)
|
||||
const existing = afterInitCheck.providers.find((p) => !p.isNewProvider)
|
||||
if (existing) {
|
||||
expect(existing.isNewProvider).toBe(false)
|
||||
const dbModels = await providerService.listModelsByProvider(
|
||||
teamWithBuiltins.id,
|
||||
(await providerService.listByTeam(teamWithBuiltins.id)).find(
|
||||
(p) => p.name === existing.name,
|
||||
)!.id,
|
||||
)
|
||||
const dbModelIds = new Set(dbModels.map((m) => m.modelId))
|
||||
for (const m of existing.models) {
|
||||
expect(dbModelIds.has(m.modelId)).toBe(false)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
it('should throw an error when upstream catalog fetch fails in checkUpdates', async () => {
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const spy = vi
|
||||
.spyOn(generateModelsModule, 'generateModels')
|
||||
.mockRejectedValueOnce(new Error('Failed to load models.dev catalog: 502 Bad Gateway'))
|
||||
|
||||
await expect(providerService.checkUpdates(team.id)).rejects.toThrow(
|
||||
'Failed to load models.dev catalog: 502 Bad Gateway',
|
||||
)
|
||||
spy.mockRestore()
|
||||
})
|
||||
|
||||
it('should throw an error when upstream catalog is empty in checkUpdates', async () => {
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
const spy = vi.spyOn(generateModelsModule, 'generateModels').mockResolvedValueOnce({
|
||||
providers: {},
|
||||
groupedProviders: {},
|
||||
sortedProviderIds: [],
|
||||
})
|
||||
|
||||
await expect(providerService.checkUpdates(team.id)).rejects.toThrow(
|
||||
'Failed to retrieve model catalog from upstream services',
|
||||
)
|
||||
spy.mockRestore()
|
||||
})
|
||||
|
||||
it('should apply sync by adding selected providers and models without modifying existing ones', async () => {
|
||||
const team = await teamService.ensureDefaultTeam()
|
||||
|
||||
// Create an existing provider with 1 model and a custom apiKey
|
||||
const existingProvider = await providerService.create(
|
||||
team.id,
|
||||
'test-existing-provider',
|
||||
{ api: 'openai-responses', apiKey: 'custom-api-key', baseUrl: 'https://example.com' },
|
||||
[
|
||||
{
|
||||
modelId: 'existing-m1',
|
||||
name: 'Existing Model 1',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
// Apply sync with 1 new provider and 1 new model on the existing provider
|
||||
const syncResult = await providerService.applySync(team.id, {
|
||||
providers: [
|
||||
{
|
||||
name: 'test-new-synced-provider',
|
||||
isNewProvider: true,
|
||||
config: {
|
||||
api: 'anthropic-messages',
|
||||
apiKey: 'ENV_SYNC_KEY',
|
||||
baseUrl: 'https://api.anthropic.com',
|
||||
},
|
||||
models: [
|
||||
{
|
||||
modelId: 'new-p-m1',
|
||||
name: 'New Provider Model 1',
|
||||
config: {
|
||||
api: 'anthropic-messages',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 200000,
|
||||
maxTokens: 8192,
|
||||
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'test-existing-provider',
|
||||
isNewProvider: false,
|
||||
config: { api: 'openai-responses', apiKey: 'should-not-override' },
|
||||
models: [
|
||||
{
|
||||
modelId: 'existing-m2',
|
||||
name: 'Newly Added Model 2',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: true,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
// Duplicate model that already exists: should be ignored
|
||||
{
|
||||
modelId: 'existing-m1',
|
||||
name: 'Existing Model 1 Overwrite Attempt',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 999999,
|
||||
maxTokens: 999999,
|
||||
cost: { input: 9, output: 9, cacheRead: 9, cacheWrite: 9 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
expect(syncResult.addedProviders).toBe(1)
|
||||
expect(syncResult.addedModels).toBe(2)
|
||||
|
||||
// Verify existing provider config was NOT modified
|
||||
const reloadedExisting = await providerService.getById(existingProvider.id)
|
||||
expect((reloadedExisting?.config as { apiKey: string }).apiKey).toBe('custom-api-key')
|
||||
|
||||
// Verify existing model was NOT modified
|
||||
const existingModels = await providerService.listModelsByProvider(team.id, existingProvider.id)
|
||||
expect(existingModels).toHaveLength(2)
|
||||
const m1 = existingModels.find((m) => m.modelId === 'existing-m1')
|
||||
expect(m1?.name).toBe('Existing Model 1')
|
||||
expect((m1?.config as { contextWindow: number }).contextWindow).toBe(128000)
|
||||
|
||||
// Verify newly added model on existing provider
|
||||
const m2 = existingModels.find((m) => m.modelId === 'existing-m2')
|
||||
expect(m2).toBeDefined()
|
||||
expect(m2?.name).toBe('Newly Added Model 2')
|
||||
|
||||
// Verify newly added provider
|
||||
const providers = await providerService.listByTeam(team.id)
|
||||
const newProvider = providers.find((p) => p.name === 'test-new-synced-provider')
|
||||
expect(newProvider).toBeDefined()
|
||||
expect(newProvider?.isBuiltin).toBe(true)
|
||||
expect((newProvider?.config as { apiKey: string }).apiKey).toBe('ENV_SYNC_KEY')
|
||||
|
||||
const newProviderModels = await providerService.listModelsByProvider(team.id, newProvider!.id)
|
||||
expect(newProviderModels).toHaveLength(1)
|
||||
expect(newProviderModels[0].modelId).toBe('new-p-m1')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,9 +3,19 @@ import {
|
||||
CreateModelRequest,
|
||||
ProviderConfigSerializable,
|
||||
providerModelSchema,
|
||||
SyncApplyRequest,
|
||||
SyncApplyResponse,
|
||||
SyncCheckResponse,
|
||||
SyncModelItem,
|
||||
SyncProviderItem,
|
||||
UpdateModelRequest,
|
||||
} from '@shumai/dtos'
|
||||
import { getBuiltinProvidersMap } from '@shumai/core/src/provider/builtin'
|
||||
import {
|
||||
ENV_MAP,
|
||||
getBuiltinProvidersMap,
|
||||
PRIORITY_PROVIDERS,
|
||||
} from '@shumai/core/src/provider/builtin'
|
||||
import { generateModels } from '@shumai/core/src/provider/generator/generate-models'
|
||||
import { z } from 'zod'
|
||||
|
||||
type ProviderModel = z.infer<typeof providerModelSchema>
|
||||
@@ -294,6 +304,181 @@ export class ProviderService {
|
||||
where: { id, teamId },
|
||||
})
|
||||
}
|
||||
|
||||
async checkUpdates(teamId: string): Promise<SyncCheckResponse> {
|
||||
const catalog = await generateModels({ strict: true, timeoutMs: 30000 })
|
||||
|
||||
if (!catalog || catalog.sortedProviderIds.length === 0) {
|
||||
throw new Error('Failed to retrieve model catalog from upstream services')
|
||||
}
|
||||
|
||||
const existingProviders = await this.prismaClient.provider.findMany({
|
||||
where: { teamId },
|
||||
include: { models: true },
|
||||
})
|
||||
|
||||
const existingProviderMap = new Map<string, (typeof existingProviders)[number]>()
|
||||
for (const p of existingProviders) {
|
||||
existingProviderMap.set(p.name, p)
|
||||
}
|
||||
|
||||
const items: SyncProviderItem[] = []
|
||||
let totalNewProviders = 0
|
||||
let totalNewModels = 0
|
||||
|
||||
for (const providerId of catalog.sortedProviderIds) {
|
||||
const modelsMap = catalog.providers[providerId]
|
||||
if (!modelsMap) continue
|
||||
const modelList = Object.values(modelsMap)
|
||||
if (modelList.length === 0) continue
|
||||
|
||||
const existingProvider = existingProviderMap.get(providerId)
|
||||
|
||||
if (!existingProvider) {
|
||||
const firstModel = modelList[0]
|
||||
const newModels: SyncModelItem[] = modelList.map((m) => ({
|
||||
modelId: m.id,
|
||||
name: m.name || m.id,
|
||||
config: {
|
||||
api: m.api as ProviderConfigSerializable['api'],
|
||||
reasoning: m.reasoning ?? false,
|
||||
input: (m.input ?? ['text']) as ('text' | 'image')[],
|
||||
contextWindow: m.contextWindow,
|
||||
maxTokens: m.maxTokens,
|
||||
cost: {
|
||||
input: m.cost?.input ?? 0,
|
||||
output: m.cost?.output ?? 0,
|
||||
cacheRead: m.cost?.cacheRead ?? 0,
|
||||
cacheWrite: m.cost?.cacheWrite ?? 0,
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
items.push({
|
||||
name: providerId,
|
||||
isNewProvider: true,
|
||||
config: {
|
||||
api: firstModel.api as ProviderConfigSerializable['api'],
|
||||
baseUrl: firstModel.baseUrl,
|
||||
apiKey: ENV_MAP[providerId] || '',
|
||||
},
|
||||
models: newModels,
|
||||
})
|
||||
|
||||
totalNewProviders++
|
||||
totalNewModels += newModels.length
|
||||
} else {
|
||||
const existingModelIds = new Set(existingProvider.models.map((m) => m.modelId))
|
||||
const newModels: SyncModelItem[] = []
|
||||
|
||||
for (const m of modelList) {
|
||||
if (!existingModelIds.has(m.id)) {
|
||||
newModels.push({
|
||||
modelId: m.id,
|
||||
name: m.name || m.id,
|
||||
config: {
|
||||
api: m.api as ProviderConfigSerializable['api'],
|
||||
reasoning: m.reasoning ?? false,
|
||||
input: (m.input ?? ['text']) as ('text' | 'image')[],
|
||||
contextWindow: m.contextWindow,
|
||||
maxTokens: m.maxTokens,
|
||||
cost: {
|
||||
input: m.cost?.input ?? 0,
|
||||
output: m.cost?.output ?? 0,
|
||||
cacheRead: m.cost?.cacheRead ?? 0,
|
||||
cacheWrite: m.cost?.cacheWrite ?? 0,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (newModels.length > 0) {
|
||||
items.push({
|
||||
name: providerId,
|
||||
isNewProvider: false,
|
||||
config: existingProvider.config as ProviderConfigSerializable,
|
||||
models: newModels,
|
||||
})
|
||||
totalNewModels += newModels.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
items.sort((a, b) => {
|
||||
const indexA = PRIORITY_PROVIDERS.indexOf(a.name)
|
||||
const indexB = PRIORITY_PROVIDERS.indexOf(b.name)
|
||||
if (indexA !== -1 && indexB !== -1) return indexA - indexB
|
||||
if (indexA !== -1) return -1
|
||||
if (indexB !== -1) return 1
|
||||
return a.name.localeCompare(b.name)
|
||||
})
|
||||
|
||||
return {
|
||||
providers: items,
|
||||
totalNewProviders,
|
||||
totalNewModels,
|
||||
}
|
||||
}
|
||||
|
||||
async applySync(teamId: string, payload: SyncApplyRequest): Promise<SyncApplyResponse> {
|
||||
let addedProviders = 0
|
||||
let addedModels = 0
|
||||
|
||||
await this.prismaClient.$transaction(async (tx) => {
|
||||
for (const providerItem of payload.providers) {
|
||||
let providerId: string
|
||||
|
||||
if (providerItem.isNewProvider) {
|
||||
const existing = await tx.provider.findFirst({
|
||||
where: { teamId, name: providerItem.name },
|
||||
})
|
||||
if (!existing) {
|
||||
const created = await tx.provider.create({
|
||||
data: {
|
||||
teamId,
|
||||
name: providerItem.name,
|
||||
isBuiltin: true,
|
||||
config: providerItem.config,
|
||||
},
|
||||
})
|
||||
providerId = created.id
|
||||
addedProviders++
|
||||
} else {
|
||||
providerId = existing.id
|
||||
}
|
||||
} else {
|
||||
const existing = await tx.provider.findFirst({
|
||||
where: { teamId, name: providerItem.name },
|
||||
})
|
||||
if (!existing) continue
|
||||
providerId = existing.id
|
||||
}
|
||||
|
||||
for (const modelItem of providerItem.models) {
|
||||
const existingModel = await tx.model.findFirst({
|
||||
where: {
|
||||
providerId,
|
||||
modelId: modelItem.modelId,
|
||||
},
|
||||
})
|
||||
if (!existingModel) {
|
||||
await tx.model.create({
|
||||
data: {
|
||||
providerId,
|
||||
modelId: modelItem.modelId,
|
||||
name: modelItem.name || modelItem.modelId,
|
||||
config: modelItem.config,
|
||||
},
|
||||
})
|
||||
addedModels++
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return { addedProviders, addedModels }
|
||||
}
|
||||
}
|
||||
|
||||
export const providerService = new ProviderService()
|
||||
|
||||
@@ -90,3 +90,48 @@ export const providerResponseSchema = z.object({
|
||||
})
|
||||
|
||||
export type ProviderResponse = z.infer<typeof providerResponseSchema>
|
||||
|
||||
export const syncModelItemSchema = z.object({
|
||||
modelId: z.string().min(1),
|
||||
name: z.string().default(''),
|
||||
config: providerModelConfigSchema,
|
||||
})
|
||||
|
||||
export type SyncModelItem = z.infer<typeof syncModelItemSchema>
|
||||
|
||||
export const syncProviderItemSchema = z.object({
|
||||
name: z.string(),
|
||||
isNewProvider: z.boolean(),
|
||||
config: providerConfigSchema,
|
||||
models: z.array(syncModelItemSchema),
|
||||
})
|
||||
|
||||
export type SyncProviderItem = z.infer<typeof syncProviderItemSchema>
|
||||
|
||||
export const syncCheckResponseSchema = z.object({
|
||||
providers: z.array(syncProviderItemSchema),
|
||||
totalNewProviders: z.number(),
|
||||
totalNewModels: z.number(),
|
||||
})
|
||||
|
||||
export type SyncCheckResponse = z.infer<typeof syncCheckResponseSchema>
|
||||
|
||||
export const syncApplyRequestSchema = z.object({
|
||||
providers: z.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
isNewProvider: z.boolean(),
|
||||
config: providerConfigSchema,
|
||||
models: z.array(syncModelItemSchema),
|
||||
}),
|
||||
),
|
||||
})
|
||||
|
||||
export type SyncApplyRequest = z.infer<typeof syncApplyRequestSchema>
|
||||
|
||||
export const syncApplyResponseSchema = z.object({
|
||||
addedProviders: z.number(),
|
||||
addedModels: z.number(),
|
||||
})
|
||||
|
||||
export type SyncApplyResponse = z.infer<typeof syncApplyResponseSchema>
|
||||
|
||||
@@ -235,6 +235,7 @@ export function FileCard({
|
||||
e.preventDefault()
|
||||
}
|
||||
}}
|
||||
data-testid="file-card"
|
||||
className={cn(
|
||||
'group relative flex cursor-pointer select-none flex-col overflow-hidden rounded-xl border border-border bg-card transition-all hover:border-primary h-full m-1 outline-none focus:outline-none focus-visible:outline-none',
|
||||
(isSelected || isChecked) && 'outline-1 outline-primary border-primary',
|
||||
|
||||
@@ -189,6 +189,7 @@ export function FileListItem({
|
||||
e.preventDefault()
|
||||
}
|
||||
}}
|
||||
data-testid="file-card"
|
||||
className="group cursor-pointer select-none transition-colors whitespace-nowrap flex w-full outline-none focus:outline-none focus-visible:outline-none"
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -276,6 +276,7 @@ export function FolderCard({
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
data-testid="file-card"
|
||||
className={cn(
|
||||
'group relative w-full md:max-w-[340px] select-none cursor-pointer isolate flex flex-col items-center h-full outline-none focus:outline-none focus-visible:outline-none',
|
||||
)}
|
||||
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
SelectValue,
|
||||
} from '@/ui/components/ui/select'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/ui/components/ui/tabs'
|
||||
import { providerConfigSchema, KNOWN_APIS } from '@shumai/dtos'
|
||||
import { providerConfigSchema, KNOWN_APIS, type SyncCheckResponse } from '@shumai/dtos'
|
||||
import { useForm } from '@tanstack/react-form'
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { InferResponseType } from 'hono/client'
|
||||
@@ -51,6 +51,7 @@ import {
|
||||
Maximize2,
|
||||
MoreVertical,
|
||||
Plus,
|
||||
RefreshCw,
|
||||
Search,
|
||||
Trash2,
|
||||
Zap,
|
||||
@@ -60,6 +61,7 @@ import { toast } from 'sonner'
|
||||
import { z } from 'zod'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { ModelFormDialog, ModelFormValues } from './ModelFormDialog'
|
||||
import { SyncProvidersDialog } from './SyncProvidersDialog'
|
||||
|
||||
const API_PROTOCOL_LABELS: Record<(typeof KNOWN_APIS)[number], string> = {
|
||||
'openai-completions': 'OpenAI Completions',
|
||||
@@ -92,6 +94,33 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
|
||||
const [searchQuery, setSearchQuery] = useState('')
|
||||
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false)
|
||||
const [providerToDelete, setProviderToDelete] = useState<Provider | null>(null)
|
||||
const [isSyncDialogOpen, setIsSyncDialogOpen] = useState(false)
|
||||
const [syncData, setSyncData] = useState<SyncCheckResponse | null>(null)
|
||||
|
||||
// Check updates mutation
|
||||
const syncCheckMutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
const res = await client.api.teams[':teamId'].providers['sync-check'].$post({
|
||||
param: { teamId },
|
||||
})
|
||||
if (!res.ok) {
|
||||
const err = await res.json().catch(() => ({ message: 'Failed to check updates' }))
|
||||
throw new Error((err as { message?: string }).message || 'Failed to check updates')
|
||||
}
|
||||
return await res.json()
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
if (data.totalNewModels === 0 && data.totalNewProviders === 0) {
|
||||
toast.info(m.sync_providers_up_to_date())
|
||||
return
|
||||
}
|
||||
setSyncData(data)
|
||||
setIsSyncDialogOpen(true)
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
toast.error(error.message)
|
||||
},
|
||||
})
|
||||
|
||||
// Fetch Providers
|
||||
const { data: providers, isLoading } = useQuery({
|
||||
@@ -184,13 +213,33 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
|
||||
<Cpu className="w-5 h-5 text-primary" />
|
||||
{m.configured_ai_providers()}
|
||||
</h3>
|
||||
<Button
|
||||
onClick={() => setIsCreateDialogOpen(true)}
|
||||
className="bg-primary hover:bg-primary/90 text-primary-foreground gap-2"
|
||||
>
|
||||
<Plus className="w-4 h-4" />
|
||||
{m.add_provider()}
|
||||
</Button>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => syncCheckMutation.mutate()}
|
||||
disabled={syncCheckMutation.isPending}
|
||||
className="gap-2"
|
||||
>
|
||||
{syncCheckMutation.isPending ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 animate-spin" />
|
||||
{m.sync_providers_checking()}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<RefreshCw className="w-4 h-4" />
|
||||
{m.sync_providers()}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => setIsCreateDialogOpen(true)}
|
||||
className="bg-primary hover:bg-primary/90 text-primary-foreground gap-2"
|
||||
>
|
||||
<Plus className="w-4 h-4" />
|
||||
{m.add_provider()}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="relative px-0.5">
|
||||
@@ -350,6 +399,16 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
||||
<SyncProvidersDialog
|
||||
isOpen={isSyncDialogOpen}
|
||||
onClose={() => setIsSyncDialogOpen(false)}
|
||||
teamId={teamId}
|
||||
syncData={syncData}
|
||||
onSuccess={() => {
|
||||
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'providers'] })
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { cleanup, render, screen, fireEvent } from '@testing-library/react'
|
||||
import React from 'react'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { SyncProvidersDialog } from './SyncProvidersDialog'
|
||||
import type { SyncCheckResponse } from '@shumai/dtos'
|
||||
|
||||
describe('SyncProvidersDialog', () => {
|
||||
afterEach(() => {
|
||||
cleanup()
|
||||
})
|
||||
|
||||
const mockSyncData: SyncCheckResponse = {
|
||||
totalNewProviders: 1,
|
||||
totalNewModels: 3,
|
||||
providers: [
|
||||
{
|
||||
name: 'test-new-provider',
|
||||
isNewProvider: true,
|
||||
config: { api: 'openai-responses', apiKey: 'NEW_KEY' },
|
||||
models: [
|
||||
{
|
||||
modelId: 'm-new-1',
|
||||
name: 'New Model 1',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: true,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
{
|
||||
modelId: 'm-new-2',
|
||||
name: 'New Model 2',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 64000,
|
||||
maxTokens: 2048,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'test-existing-provider',
|
||||
isNewProvider: false,
|
||||
config: { api: 'anthropic-messages', apiKey: 'EXISTING_KEY' },
|
||||
models: [
|
||||
{
|
||||
modelId: 'm-existing-add-1',
|
||||
name: 'Existing Provider New Model 1',
|
||||
config: {
|
||||
api: 'anthropic-messages',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 200000,
|
||||
maxTokens: 8192,
|
||||
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
function renderDialog(props?: Partial<React.ComponentProps<typeof SyncProvidersDialog>>) {
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } },
|
||||
})
|
||||
|
||||
return render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SyncProvidersDialog
|
||||
isOpen={true}
|
||||
onClose={vi.fn()}
|
||||
teamId="team-1"
|
||||
syncData={mockSyncData}
|
||||
onSuccess={vi.fn()}
|
||||
{...props}
|
||||
/>
|
||||
</QueryClientProvider>,
|
||||
)
|
||||
}
|
||||
|
||||
it('renders the dialog with description, providers and models pre-selected by default', () => {
|
||||
renderDialog()
|
||||
|
||||
// Title and description
|
||||
expect(screen.getByRole('heading', { name: /sync providers & models/i })).toBeDefined()
|
||||
expect(
|
||||
screen.getAllByText(
|
||||
/existing providers, custom endpoints, api keys, and model configurations will never be deleted or modified/i,
|
||||
).length,
|
||||
).toBeGreaterThan(0)
|
||||
|
||||
// Check provider names
|
||||
expect(screen.getByText('test-new-provider')).toBeDefined()
|
||||
expect(screen.getByText('test-existing-provider')).toBeDefined()
|
||||
|
||||
// Badges
|
||||
expect(screen.getByText(/^new provider$/i)).toBeDefined()
|
||||
expect(screen.getByText(/^existing provider$/i)).toBeDefined()
|
||||
|
||||
// Check that both new and existing providers have checkboxes
|
||||
const newProviderCheckbox = document.getElementById('provider-check-test-new-provider')
|
||||
expect(newProviderCheckbox).toBeDefined()
|
||||
expect(newProviderCheckbox?.getAttribute('data-state')).toBe('checked')
|
||||
|
||||
const existingProviderCheckbox = document.getElementById(
|
||||
'provider-check-test-existing-provider',
|
||||
)
|
||||
expect(existingProviderCheckbox).toBeDefined()
|
||||
expect(existingProviderCheckbox?.getAttribute('data-state')).toBe('checked')
|
||||
|
||||
// Model checkboxes are checked by default
|
||||
const mNew1Check = document.getElementById('model-check-test-new-provider-m-new-1')
|
||||
expect(mNew1Check).toBeDefined()
|
||||
expect(mNew1Check?.getAttribute('data-state')).toBe('checked')
|
||||
})
|
||||
|
||||
it('toggles all models for an existing provider when its checkbox is clicked', () => {
|
||||
renderDialog()
|
||||
|
||||
const existingProviderCheckbox = document.getElementById(
|
||||
'provider-check-test-existing-provider',
|
||||
)!
|
||||
const existingModelCheck = document.getElementById(
|
||||
'model-check-test-existing-provider-m-existing-add-1',
|
||||
)!
|
||||
|
||||
expect(existingModelCheck.getAttribute('data-state')).toBe('checked')
|
||||
|
||||
// Click to uncheck all
|
||||
fireEvent.click(existingProviderCheckbox)
|
||||
expect(existingModelCheck.getAttribute('data-state')).toBe('unchecked')
|
||||
expect(existingProviderCheckbox.getAttribute('data-state')).toBe('unchecked')
|
||||
|
||||
// Click to check all
|
||||
fireEvent.click(existingProviderCheckbox)
|
||||
expect(existingModelCheck.getAttribute('data-state')).toBe('checked')
|
||||
expect(existingProviderCheckbox.getAttribute('data-state')).toBe('checked')
|
||||
})
|
||||
|
||||
it('supports select all and deselect all buttons', () => {
|
||||
renderDialog()
|
||||
|
||||
const deselectAllBtn = screen.getByRole('button', { name: /^deselect all$/i })
|
||||
fireEvent.click(deselectAllBtn)
|
||||
|
||||
const mNew1Check = document.getElementById('model-check-test-new-provider-m-new-1')
|
||||
expect(mNew1Check?.getAttribute('data-state')).toBe('unchecked')
|
||||
|
||||
const selectAllBtn = screen.getByRole('button', { name: /^select all$/i })
|
||||
fireEvent.click(selectAllBtn)
|
||||
expect(mNew1Check?.getAttribute('data-state')).toBe('checked')
|
||||
})
|
||||
|
||||
it('unchecks new provider when all its models are unchecked', () => {
|
||||
renderDialog()
|
||||
|
||||
const mNew1Check = document.getElementById('model-check-test-new-provider-m-new-1')!
|
||||
const mNew2Check = document.getElementById('model-check-test-new-provider-m-new-2')!
|
||||
const newProviderCheckbox = document.getElementById('provider-check-test-new-provider')!
|
||||
|
||||
// Uncheck both models
|
||||
fireEvent.click(mNew1Check)
|
||||
expect(newProviderCheckbox.getAttribute('data-state')).toBe('indeterminate')
|
||||
|
||||
fireEvent.click(mNew2Check)
|
||||
expect(newProviderCheckbox.getAttribute('data-state')).toBe('unchecked')
|
||||
|
||||
// Re-check one model -> provider should automatically check
|
||||
fireEvent.click(mNew1Check)
|
||||
expect(newProviderCheckbox.getAttribute('data-state')).not.toBe('unchecked')
|
||||
})
|
||||
|
||||
it('filters models when user types in search input', () => {
|
||||
renderDialog()
|
||||
|
||||
const searchInput = screen.getByPlaceholderText(/filter new providers or models/i)
|
||||
fireEvent.change(searchInput, { target: { value: 'm-existing-add-1' } })
|
||||
|
||||
// Only existing provider model should be visible
|
||||
expect(screen.queryByText('m-new-1')).toBeNull()
|
||||
expect(screen.getByText('Existing Provider New Model 1')).toBeDefined()
|
||||
})
|
||||
|
||||
it('supports expand all and collapse all buttons', () => {
|
||||
renderDialog()
|
||||
|
||||
// Models should be visible initially (all expanded)
|
||||
expect(document.getElementById('model-check-test-new-provider-m-new-1')).toBeDefined()
|
||||
|
||||
// Click Collapse All
|
||||
const collapseAllBtn = screen.getByRole('button', { name: /^collapse all$/i })
|
||||
fireEvent.click(collapseAllBtn)
|
||||
|
||||
// Child models should be collapsed (not in DOM)
|
||||
expect(document.getElementById('model-check-test-new-provider-m-new-1')).toBeNull()
|
||||
|
||||
// Click Expand All
|
||||
const expandAllBtn = screen.getByRole('button', { name: /^expand all$/i })
|
||||
fireEvent.click(expandAllBtn)
|
||||
|
||||
// Child models should be visible again
|
||||
expect(document.getElementById('model-check-test-new-provider-m-new-1')).toBeDefined()
|
||||
})
|
||||
|
||||
it('updates selection and expansion state when syncData prop changes while mounted', () => {
|
||||
const { rerender } = renderDialog()
|
||||
|
||||
// Initially, test-new-provider is present
|
||||
expect(screen.getByText('test-new-provider')).toBeDefined()
|
||||
|
||||
// Deselect all models to change internal state
|
||||
const deselectAllBtn = screen.getByRole('button', { name: /^deselect all$/i })
|
||||
fireEvent.click(deselectAllBtn)
|
||||
const mNew1Check = document.getElementById('model-check-test-new-provider-m-new-1')
|
||||
expect(mNew1Check?.getAttribute('data-state')).toBe('unchecked')
|
||||
|
||||
// Now supply new syncData prop with different providers and models
|
||||
const updatedSyncData: SyncCheckResponse = {
|
||||
totalNewProviders: 1,
|
||||
totalNewModels: 1,
|
||||
providers: [
|
||||
{
|
||||
name: 'updated-provider',
|
||||
isNewProvider: true,
|
||||
config: { api: 'openai-responses' },
|
||||
models: [
|
||||
{
|
||||
modelId: 'm-updated-1',
|
||||
name: 'Updated Model 1',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 32000,
|
||||
maxTokens: 1024,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } },
|
||||
})
|
||||
|
||||
rerender(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SyncProvidersDialog
|
||||
isOpen={true}
|
||||
onClose={vi.fn()}
|
||||
teamId="team-1"
|
||||
syncData={updatedSyncData}
|
||||
onSuccess={vi.fn()}
|
||||
/>
|
||||
</QueryClientProvider>,
|
||||
)
|
||||
|
||||
// New provider should be rendered, expanded by default, and model should be pre-selected
|
||||
expect(screen.getByText('updated-provider')).toBeDefined()
|
||||
const updatedModelCheck = document.getElementById('model-check-updated-provider-m-updated-1')
|
||||
expect(updatedModelCheck).toBeDefined()
|
||||
expect(updatedModelCheck?.getAttribute('data-state')).toBe('checked')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,474 @@
|
||||
import { useState, useMemo, useEffect } from 'react'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/ui/components/ui/dialog'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
import { Checkbox } from '@/ui/components/ui/checkbox'
|
||||
import { Badge } from '@/ui/components/ui/badge'
|
||||
import { Input } from '@/ui/components/ui/input'
|
||||
import { ScrollArea } from '@/ui/components/ui/scroll-area'
|
||||
import { ChevronDown, ChevronRight, Cpu, Loader2, Search, Sparkles } from 'lucide-react'
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { client } from '@/ui/api/client'
|
||||
import { toast } from 'sonner'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import type { SyncCheckResponse, SyncApplyRequest } from '@shumai/dtos'
|
||||
|
||||
interface SyncProvidersDialogProps {
|
||||
isOpen: boolean
|
||||
onClose: () => void
|
||||
teamId: string
|
||||
syncData: SyncCheckResponse | null
|
||||
onSuccess: () => void
|
||||
}
|
||||
|
||||
export function SyncProvidersDialog({
|
||||
isOpen,
|
||||
onClose,
|
||||
teamId,
|
||||
syncData,
|
||||
onSuccess,
|
||||
}: SyncProvidersDialogProps) {
|
||||
const [filterQuery, setFilterQuery] = useState('')
|
||||
const [expandedProviders, setExpandedProviders] = useState<Set<string>>(() => {
|
||||
return new Set(syncData?.providers.map((p) => p.name) || [])
|
||||
})
|
||||
|
||||
// Pre-selected by default (opt-out)
|
||||
const [selectedModels, setSelectedModels] = useState<Set<string>>(() => {
|
||||
const set = new Set<string>()
|
||||
syncData?.providers.forEach((p) => {
|
||||
p.models.forEach((mItem) => {
|
||||
set.add(`${p.name}:${mItem.modelId}`)
|
||||
})
|
||||
})
|
||||
return set
|
||||
})
|
||||
|
||||
// Sync state if syncData changes
|
||||
useEffect(() => {
|
||||
if (syncData) {
|
||||
setExpandedProviders(new Set(syncData.providers.map((p) => p.name)))
|
||||
const modelSet = new Set<string>()
|
||||
syncData.providers.forEach((p) => {
|
||||
p.models.forEach((mItem) => {
|
||||
modelSet.add(`${p.name}:${mItem.modelId}`)
|
||||
})
|
||||
})
|
||||
setSelectedModels(modelSet)
|
||||
}
|
||||
}, [syncData])
|
||||
|
||||
// Filtered tree data based on filterQuery
|
||||
const filteredTree = useMemo(() => {
|
||||
if (!syncData) return []
|
||||
const q = filterQuery.trim().toLowerCase()
|
||||
if (!q) return syncData.providers
|
||||
|
||||
return syncData.providers
|
||||
.map((p) => {
|
||||
const matchesProvider = p.name.toLowerCase().includes(q)
|
||||
const matchingModels = p.models.filter(
|
||||
(mItem) =>
|
||||
matchesProvider ||
|
||||
mItem.modelId.toLowerCase().includes(q) ||
|
||||
mItem.name.toLowerCase().includes(q),
|
||||
)
|
||||
if (matchingModels.length > 0) {
|
||||
return { ...p, models: matchingModels }
|
||||
}
|
||||
return null
|
||||
})
|
||||
.filter((p): p is NonNullable<typeof p> => p !== null)
|
||||
}, [syncData, filterQuery])
|
||||
|
||||
// Total selected models & providers
|
||||
const totalSelectedModelsCount = selectedModels.size
|
||||
const totalSelectedProvidersCount = useMemo(() => {
|
||||
if (!syncData) return 0
|
||||
let count = 0
|
||||
for (const p of syncData.providers) {
|
||||
const hasSelectedModel = p.models.some((mItem) =>
|
||||
selectedModels.has(`${p.name}:${mItem.modelId}`),
|
||||
)
|
||||
if (hasSelectedModel) count++
|
||||
}
|
||||
return count
|
||||
}, [syncData, selectedModels])
|
||||
|
||||
const toggleExpand = (providerName: string) => {
|
||||
setExpandedProviders((prev) => {
|
||||
const next = new Set(prev)
|
||||
if (next.has(providerName)) {
|
||||
next.delete(providerName)
|
||||
} else {
|
||||
next.add(providerName)
|
||||
}
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
const handleExpandAll = () => {
|
||||
if (!syncData) return
|
||||
setExpandedProviders(new Set(syncData.providers.map((p) => p.name)))
|
||||
}
|
||||
|
||||
const handleCollapseAll = () => {
|
||||
setExpandedProviders(new Set())
|
||||
}
|
||||
|
||||
const toggleModel = (providerName: string, modelId: string) => {
|
||||
const key = `${providerName}:${modelId}`
|
||||
setSelectedModels((prevModels) => {
|
||||
const nextModels = new Set(prevModels)
|
||||
if (nextModels.has(key)) {
|
||||
nextModels.delete(key)
|
||||
} else {
|
||||
nextModels.add(key)
|
||||
}
|
||||
return nextModels
|
||||
})
|
||||
}
|
||||
|
||||
const toggleProvider = (providerName: string) => {
|
||||
const providerData = syncData?.providers.find((p) => p.name === providerName)
|
||||
if (!providerData || providerData.models.length === 0) return
|
||||
|
||||
const allModelsChecked = providerData.models.every((mItem) =>
|
||||
selectedModels.has(`${providerName}:${mItem.modelId}`),
|
||||
)
|
||||
|
||||
setSelectedModels((prev) => {
|
||||
const next = new Set(prev)
|
||||
providerData.models.forEach((mItem) => {
|
||||
const key = `${providerName}:${mItem.modelId}`
|
||||
if (allModelsChecked) {
|
||||
next.delete(key)
|
||||
} else {
|
||||
next.add(key)
|
||||
}
|
||||
})
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
const handleSelectAll = () => {
|
||||
if (!syncData) return
|
||||
const modelSet = new Set<string>()
|
||||
syncData.providers.forEach((p) => {
|
||||
p.models.forEach((mItem) => {
|
||||
modelSet.add(`${p.name}:${mItem.modelId}`)
|
||||
})
|
||||
})
|
||||
setSelectedModels(modelSet)
|
||||
}
|
||||
|
||||
const handleDeselectAll = () => {
|
||||
setSelectedModels(new Set())
|
||||
}
|
||||
|
||||
// Apply mutation
|
||||
const applyMutation = useMutation({
|
||||
mutationFn: async (payload: SyncApplyRequest) => {
|
||||
const res = await client.api.teams[':teamId'].providers['sync-apply'].$post({
|
||||
param: { teamId },
|
||||
json: payload,
|
||||
})
|
||||
if (!res.ok) {
|
||||
const err = await res.json().catch(() => ({ message: 'Failed to apply sync' }))
|
||||
throw new Error((err as { message?: string }).message || 'Failed to apply sync')
|
||||
}
|
||||
return await res.json()
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
toast.success(
|
||||
m.sync_providers_success({
|
||||
modelCount: data.addedModels,
|
||||
providerCount: data.addedProviders,
|
||||
}),
|
||||
)
|
||||
onSuccess()
|
||||
onClose()
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
toast.error(error.message)
|
||||
},
|
||||
})
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (!syncData || totalSelectedModelsCount === 0) return
|
||||
|
||||
const providersToSync: SyncApplyRequest['providers'] = []
|
||||
|
||||
for (const p of syncData.providers) {
|
||||
const selectedModelsForProvider = p.models.filter((mItem) =>
|
||||
selectedModels.has(`${p.name}:${mItem.modelId}`),
|
||||
)
|
||||
|
||||
if (selectedModelsForProvider.length > 0) {
|
||||
providersToSync.push({
|
||||
name: p.name,
|
||||
isNewProvider: p.isNewProvider,
|
||||
config: p.config,
|
||||
models: selectedModelsForProvider,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (providersToSync.length === 0) return
|
||||
|
||||
await applyMutation.mutateAsync({
|
||||
providers: providersToSync,
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
|
||||
<DialogContent className="sm:max-w-3xl md:max-w-4xl w-full h-[85vh] max-h-[85vh] flex flex-col p-0 overflow-hidden gap-0">
|
||||
<DialogHeader className="p-6 pb-4 shrink-0">
|
||||
<DialogTitle className="flex items-center gap-2 text-xl font-semibold">
|
||||
<Sparkles className="w-5 h-5 text-primary" />
|
||||
{m.sync_providers_dialog_title()}
|
||||
</DialogTitle>
|
||||
<DialogDescription className="text-xs text-muted-foreground leading-relaxed mt-1.5">
|
||||
{m.sync_providers_dialog_description()}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
{/* Controls Toolbar */}
|
||||
<div className="px-6 pb-3 shrink-0">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div className="relative flex-1">
|
||||
<Search className="absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground" />
|
||||
<Input
|
||||
value={filterQuery}
|
||||
onChange={(e) => setFilterQuery(e.target.value)}
|
||||
placeholder={m.sync_providers_search_placeholder()}
|
||||
className="pl-8 h-8 text-xs bg-background"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={handleExpandAll}
|
||||
className="h-8 text-xs px-2.5"
|
||||
>
|
||||
{m.sync_providers_expand_all()}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={handleCollapseAll}
|
||||
className="h-8 text-xs px-2.5"
|
||||
>
|
||||
{m.sync_providers_collapse_all()}
|
||||
</Button>
|
||||
<div className="w-px h-4 bg-border mx-1" />
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={handleSelectAll}
|
||||
className="h-8 text-xs px-2.5"
|
||||
>
|
||||
{m.sync_providers_select_all()}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={handleDeselectAll}
|
||||
className="h-8 text-xs px-2.5"
|
||||
>
|
||||
{m.sync_providers_deselect_all()}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Tree List Container */}
|
||||
<div className="flex-1 min-h-0 px-6 overflow-hidden">
|
||||
<ScrollArea className="h-full border border-border/60 rounded-md bg-muted/20">
|
||||
<div className="p-3 space-y-3">
|
||||
{filteredTree.length === 0 ? (
|
||||
<div className="py-8 text-center text-sm text-muted-foreground">
|
||||
{m.no_matches_found()}
|
||||
</div>
|
||||
) : (
|
||||
filteredTree.map((provider) => {
|
||||
const isExpanded = expandedProviders.has(provider.name)
|
||||
const isNew = provider.isNewProvider
|
||||
|
||||
// Determine provider check state
|
||||
const checkedCount = provider.models.filter((mItem) =>
|
||||
selectedModels.has(`${provider.name}:${mItem.modelId}`),
|
||||
).length
|
||||
const allChecked = checkedCount === provider.models.length
|
||||
const someChecked = checkedCount > 0 && !allChecked
|
||||
|
||||
return (
|
||||
<div
|
||||
key={provider.name}
|
||||
className="border border-border/50 rounded-lg bg-background overflow-hidden"
|
||||
>
|
||||
{/* Provider Header Row */}
|
||||
<div className="flex items-center justify-between px-3 py-2 bg-card hover:bg-muted/40 transition-colors">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => toggleExpand(provider.name)}
|
||||
className="p-0.5 text-muted-foreground hover:text-foreground rounded transition-colors"
|
||||
>
|
||||
{isExpanded ? (
|
||||
<ChevronDown className="w-4 h-4" />
|
||||
) : (
|
||||
<ChevronRight className="w-4 h-4" />
|
||||
)}
|
||||
</button>
|
||||
|
||||
<Checkbox
|
||||
checked={allChecked ? true : someChecked ? 'indeterminate' : false}
|
||||
onCheckedChange={() => toggleProvider(provider.name)}
|
||||
id={`provider-check-${provider.name}`}
|
||||
/>
|
||||
|
||||
<label
|
||||
htmlFor={`provider-check-${provider.name}`}
|
||||
className="font-medium text-sm text-foreground flex items-center gap-2 cursor-pointer select-none"
|
||||
>
|
||||
<Cpu className="w-4 h-4 text-muted-foreground" />
|
||||
<span>{provider.name}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
{isNew ? (
|
||||
<Badge
|
||||
variant="secondary"
|
||||
className="text-[10px] px-1.5 py-0 bg-primary/10 text-primary border-primary/20"
|
||||
>
|
||||
{m.sync_providers_new_provider()}
|
||||
</Badge>
|
||||
) : (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="text-[10px] px-1.5 py-0 text-muted-foreground"
|
||||
>
|
||||
{m.sync_providers_existing_provider()}
|
||||
</Badge>
|
||||
)}
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{m.sync_providers_new_models_count({
|
||||
count: provider.models.length,
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Model Children Rows */}
|
||||
{isExpanded && (
|
||||
<div className="border-t border-border/40 divide-y divide-border/30 bg-muted/10">
|
||||
{provider.models.map((model) => {
|
||||
const isModelChecked = selectedModels.has(
|
||||
`${provider.name}:${model.modelId}`,
|
||||
)
|
||||
return (
|
||||
<div
|
||||
key={model.modelId}
|
||||
className="flex items-center justify-between pl-9 pr-3 py-2 hover:bg-muted/30 transition-colors"
|
||||
>
|
||||
<div className="flex items-center gap-2.5 min-w-0">
|
||||
<Checkbox
|
||||
checked={isModelChecked}
|
||||
onCheckedChange={() =>
|
||||
toggleModel(provider.name, model.modelId)
|
||||
}
|
||||
id={`model-check-${provider.name}-${model.modelId}`}
|
||||
/>
|
||||
<label
|
||||
htmlFor={`model-check-${provider.name}-${model.modelId}`}
|
||||
className="text-xs font-medium text-foreground cursor-pointer select-none truncate"
|
||||
>
|
||||
{model.name || model.modelId}
|
||||
<span className="ml-1.5 text-[11px] text-muted-foreground font-mono font-normal">
|
||||
{model.modelId}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-1.5 shrink-0 ml-2">
|
||||
{model.config.reasoning && (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="text-[10px] px-1.5 py-0 font-normal border-amber-500/30 text-amber-600 dark:text-amber-400"
|
||||
>
|
||||
{m.sync_providers_reasoning()}
|
||||
</Badge>
|
||||
)}
|
||||
<span className="text-[11px] text-muted-foreground font-mono">
|
||||
{m.sync_providers_context_window({
|
||||
count: Math.round(model.config.contextWindow / 1000),
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
|
||||
{/* Selected Count & Footer */}
|
||||
<DialogFooter className="p-6 pt-3 shrink-0 border-t border-border flex items-center justify-between sm:justify-between w-full">
|
||||
<div className="text-xs text-muted-foreground">
|
||||
{m.sync_providers_selected_count({
|
||||
modelCount: totalSelectedModelsCount,
|
||||
providerCount: totalSelectedProvidersCount,
|
||||
})}
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={onClose}
|
||||
disabled={applyMutation.isPending}
|
||||
>
|
||||
{m.cancel()}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={handleConfirm}
|
||||
disabled={totalSelectedModelsCount === 0 || applyMutation.isPending}
|
||||
className="gap-2"
|
||||
>
|
||||
{applyMutation.isPending ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 animate-spin" />
|
||||
{m.sync_providers_adding()}
|
||||
</>
|
||||
) : (
|
||||
m.sync_providers_add_selected({
|
||||
count: totalSelectedModelsCount,
|
||||
})
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
@@ -311,6 +311,25 @@
|
||||
"providers_description": "Configure AI providers and their models for this team.",
|
||||
"configured_ai_providers": "Configured AI Providers",
|
||||
"add_provider": "Add Provider",
|
||||
"sync_providers": "Sync Providers",
|
||||
"sync_providers_checking": "Checking for updates...",
|
||||
"sync_providers_dialog_title": "Sync Providers & Models",
|
||||
"sync_providers_dialog_description": "Select the new providers and models you want to add. Existing providers, custom endpoints, API keys, and model configurations will never be deleted or modified.",
|
||||
"sync_providers_up_to_date": "All providers and models are already up to date.",
|
||||
"sync_providers_select_all": "Select All",
|
||||
"sync_providers_deselect_all": "Deselect All",
|
||||
"sync_providers_expand_all": "Expand All",
|
||||
"sync_providers_collapse_all": "Collapse All",
|
||||
"sync_providers_search_placeholder": "Filter new providers or models...",
|
||||
"sync_providers_new_provider": "New Provider",
|
||||
"sync_providers_existing_provider": "Existing Provider",
|
||||
"sync_providers_new_models_count": "{count} new models",
|
||||
"sync_providers_selected_count": "{modelCount} models selected across {providerCount} providers",
|
||||
"sync_providers_reasoning": "reasoning",
|
||||
"sync_providers_context_window": "{count}k ctx",
|
||||
"sync_providers_add_selected": "Add Selected ({count})",
|
||||
"sync_providers_adding": "Adding...",
|
||||
"sync_providers_success": "Successfully added {modelCount} models across {providerCount} providers.",
|
||||
"search_providers_placeholder": "Search providers...",
|
||||
"no_providers_found": "No providers found",
|
||||
"built_in": "Built-in",
|
||||
|
||||
@@ -311,6 +311,25 @@
|
||||
"providers_description": "为此团队配置 AI 提供商及其模型。",
|
||||
"configured_ai_providers": "已配置的 AI 提供商",
|
||||
"add_provider": "添加提供商",
|
||||
"sync_providers": "同步提供商",
|
||||
"sync_providers_checking": "正在检查更新...",
|
||||
"sync_providers_dialog_title": "同步提供商与模型",
|
||||
"sync_providers_dialog_description": "选择您希望添加的新提供商和模型。现有的提供商、自定义端点、API 密钥和模型配置绝不会被删除或修改。",
|
||||
"sync_providers_up_to_date": "所有提供商和模型均已是最新状态。",
|
||||
"sync_providers_select_all": "全选",
|
||||
"sync_providers_deselect_all": "取消全选",
|
||||
"sync_providers_expand_all": "全部展开",
|
||||
"sync_providers_collapse_all": "全部折叠",
|
||||
"sync_providers_search_placeholder": "筛选新提供商或模型...",
|
||||
"sync_providers_new_provider": "新提供商",
|
||||
"sync_providers_existing_provider": "现有提供商",
|
||||
"sync_providers_new_models_count": "{count} 个新模型",
|
||||
"sync_providers_selected_count": "已选 {modelCount} 个模型,分布在 {providerCount} 个提供商中",
|
||||
"sync_providers_reasoning": "深度思考",
|
||||
"sync_providers_context_window": "{count}k 上下文",
|
||||
"sync_providers_add_selected": "添加所选 ({count})",
|
||||
"sync_providers_adding": "正在添加...",
|
||||
"sync_providers_success": "已成功添加 {providerCount} 个提供商中的 {modelCount} 个模型。",
|
||||
"search_providers_placeholder": "搜索提供商...",
|
||||
"no_providers_found": "未找到提供商",
|
||||
"built_in": "内置",
|
||||
|
||||
+19
@@ -295,6 +295,25 @@ export * from "./providers.js";
|
||||
export * from "./providers_description.js";
|
||||
export * from "./configured_ai_providers.js";
|
||||
export * from "./add_provider.js";
|
||||
export * from "./sync_providers.js";
|
||||
export * from "./sync_providers_checking.js";
|
||||
export * from "./sync_providers_dialog_title.js";
|
||||
export * from "./sync_providers_dialog_description.js";
|
||||
export * from "./sync_providers_up_to_date.js";
|
||||
export * from "./sync_providers_select_all.js";
|
||||
export * from "./sync_providers_deselect_all.js";
|
||||
export * from "./sync_providers_expand_all.js";
|
||||
export * from "./sync_providers_collapse_all.js";
|
||||
export * from "./sync_providers_search_placeholder.js";
|
||||
export * from "./sync_providers_new_provider.js";
|
||||
export * from "./sync_providers_existing_provider.js";
|
||||
export * from "./sync_providers_new_models_count.js";
|
||||
export * from "./sync_providers_selected_count.js";
|
||||
export * from "./sync_providers_reasoning.js";
|
||||
export * from "./sync_providers_context_window.js";
|
||||
export * from "./sync_providers_add_selected.js";
|
||||
export * from "./sync_providers_adding.js";
|
||||
export * from "./sync_providers_success.js";
|
||||
export * from "./search_providers_placeholder.js";
|
||||
export * from "./no_providers_found.js";
|
||||
export * from "./built_in.js";
|
||||
|
||||
+19
@@ -297,6 +297,25 @@ export * from './providers.js'
|
||||
export * from './providers_description.js'
|
||||
export * from './configured_ai_providers.js'
|
||||
export * from './add_provider.js'
|
||||
export * from './sync_providers.js'
|
||||
export * from './sync_providers_checking.js'
|
||||
export * from './sync_providers_dialog_title.js'
|
||||
export * from './sync_providers_dialog_description.js'
|
||||
export * from './sync_providers_up_to_date.js'
|
||||
export * from './sync_providers_select_all.js'
|
||||
export * from './sync_providers_deselect_all.js'
|
||||
export * from './sync_providers_expand_all.js'
|
||||
export * from './sync_providers_collapse_all.js'
|
||||
export * from './sync_providers_search_placeholder.js'
|
||||
export * from './sync_providers_new_provider.js'
|
||||
export * from './sync_providers_existing_provider.js'
|
||||
export * from './sync_providers_new_models_count.js'
|
||||
export * from './sync_providers_selected_count.js'
|
||||
export * from './sync_providers_reasoning.js'
|
||||
export * from './sync_providers_context_window.js'
|
||||
export * from './sync_providers_add_selected.js'
|
||||
export * from './sync_providers_adding.js'
|
||||
export * from './sync_providers_success.js'
|
||||
export * from './search_providers_placeholder.js'
|
||||
export * from './no_providers_found.js'
|
||||
export * from './built_in.js'
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Sync Providers" |
|
||||
*
|
||||
* @param {Sync_ProvidersInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers: ((inputs?: Sync_ProvidersInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_ProvidersInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_ProvidersInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_ProvidersInputs */
|
||||
|
||||
const en_sync_providers = /** @type {(inputs: Sync_ProvidersInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Sync Providers`)
|
||||
};
|
||||
|
||||
const zh_sync_providers = /** @type {(inputs: Sync_ProvidersInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`同步提供商`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Sync Providers" |
|
||||
*
|
||||
* @param {Sync_ProvidersInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers = /** @type {((inputs?: Sync_ProvidersInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_ProvidersInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers(inputs)
|
||||
return zh_sync_providers(inputs)
|
||||
});
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Add Selected ({count})" |
|
||||
*
|
||||
* @param {Sync_Providers_Add_SelectedInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_add_selected: ((inputs: Sync_Providers_Add_SelectedInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Add_SelectedInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Add_SelectedInputs = {
|
||||
count: NonNullable<unknown>;
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{ count: NonNullable<unknown> }} Sync_Providers_Add_SelectedInputs */
|
||||
|
||||
const en_sync_providers_add_selected = /** @type {(inputs: Sync_Providers_Add_SelectedInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`Add Selected (${i?.count})`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_add_selected = /** @type {(inputs: Sync_Providers_Add_SelectedInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`添加所选 (${i?.count})`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Add Selected ({count})" |
|
||||
*
|
||||
* @param {Sync_Providers_Add_SelectedInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_add_selected = /** @type {((inputs: Sync_Providers_Add_SelectedInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Add_SelectedInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_add_selected(inputs)
|
||||
return zh_sync_providers_add_selected(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Adding..." |
|
||||
*
|
||||
* @param {Sync_Providers_AddingInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_adding: ((inputs?: Sync_Providers_AddingInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_AddingInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_AddingInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_AddingInputs */
|
||||
|
||||
const en_sync_providers_adding = /** @type {(inputs: Sync_Providers_AddingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Adding...`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_adding = /** @type {(inputs: Sync_Providers_AddingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`正在添加...`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Adding..." |
|
||||
*
|
||||
* @param {Sync_Providers_AddingInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_adding = /** @type {((inputs?: Sync_Providers_AddingInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_AddingInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_adding(inputs)
|
||||
return zh_sync_providers_adding(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Checking for updates..." |
|
||||
*
|
||||
* @param {Sync_Providers_CheckingInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_checking: ((inputs?: Sync_Providers_CheckingInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_CheckingInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_CheckingInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_CheckingInputs */
|
||||
|
||||
const en_sync_providers_checking = /** @type {(inputs: Sync_Providers_CheckingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Checking for updates...`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_checking = /** @type {(inputs: Sync_Providers_CheckingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`正在检查更新...`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Checking for updates..." |
|
||||
*
|
||||
* @param {Sync_Providers_CheckingInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_checking = /** @type {((inputs?: Sync_Providers_CheckingInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_CheckingInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_checking(inputs)
|
||||
return zh_sync_providers_checking(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Collapse All" |
|
||||
*
|
||||
* @param {Sync_Providers_Collapse_AllInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_collapse_all: ((inputs?: Sync_Providers_Collapse_AllInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Collapse_AllInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Collapse_AllInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_Collapse_AllInputs */
|
||||
|
||||
const en_sync_providers_collapse_all = /** @type {(inputs: Sync_Providers_Collapse_AllInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Collapse All`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_collapse_all = /** @type {(inputs: Sync_Providers_Collapse_AllInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`全部折叠`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Collapse All" |
|
||||
*
|
||||
* @param {Sync_Providers_Collapse_AllInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_collapse_all = /** @type {((inputs?: Sync_Providers_Collapse_AllInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Collapse_AllInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_collapse_all(inputs)
|
||||
return zh_sync_providers_collapse_all(inputs)
|
||||
});
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "{count}k ctx" |
|
||||
*
|
||||
* @param {Sync_Providers_Context_WindowInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_context_window: ((inputs: Sync_Providers_Context_WindowInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Context_WindowInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Context_WindowInputs = {
|
||||
count: NonNullable<unknown>;
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{ count: NonNullable<unknown> }} Sync_Providers_Context_WindowInputs */
|
||||
|
||||
const en_sync_providers_context_window = /** @type {(inputs: Sync_Providers_Context_WindowInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`${i?.count}k ctx`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_context_window = /** @type {(inputs: Sync_Providers_Context_WindowInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`${i?.count}k 上下文`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "{count}k ctx" |
|
||||
*
|
||||
* @param {Sync_Providers_Context_WindowInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_context_window = /** @type {((inputs: Sync_Providers_Context_WindowInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Context_WindowInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_context_window(inputs)
|
||||
return zh_sync_providers_context_window(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Deselect All" |
|
||||
*
|
||||
* @param {Sync_Providers_Deselect_AllInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_deselect_all: ((inputs?: Sync_Providers_Deselect_AllInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Deselect_AllInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Deselect_AllInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_Deselect_AllInputs */
|
||||
|
||||
const en_sync_providers_deselect_all = /** @type {(inputs: Sync_Providers_Deselect_AllInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Deselect All`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_deselect_all = /** @type {(inputs: Sync_Providers_Deselect_AllInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`取消全选`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Deselect All" |
|
||||
*
|
||||
* @param {Sync_Providers_Deselect_AllInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_deselect_all = /** @type {((inputs?: Sync_Providers_Deselect_AllInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Deselect_AllInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_deselect_all(inputs)
|
||||
return zh_sync_providers_deselect_all(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Select the new providers and models you want to add. Existing providers, custom endpoints, API keys, and model configurations will never be deleted or modified." |
|
||||
*
|
||||
* @param {Sync_Providers_Dialog_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_dialog_description: ((inputs?: Sync_Providers_Dialog_DescriptionInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Dialog_DescriptionInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Dialog_DescriptionInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_Dialog_DescriptionInputs */
|
||||
|
||||
const en_sync_providers_dialog_description = /** @type {(inputs: Sync_Providers_Dialog_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Select the new providers and models you want to add. Existing providers, custom endpoints, API keys, and model configurations will never be deleted or modified.`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_dialog_description = /** @type {(inputs: Sync_Providers_Dialog_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`选择您希望添加的新提供商和模型。现有的提供商、自定义端点、API 密钥和模型配置绝不会被删除或修改。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Select the new providers and models you want to add. Existing providers, custom endpoints, API keys, and model configurations will never be deleted or modified." |
|
||||
*
|
||||
* @param {Sync_Providers_Dialog_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_dialog_description = /** @type {((inputs?: Sync_Providers_Dialog_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Dialog_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_dialog_description(inputs)
|
||||
return zh_sync_providers_dialog_description(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Sync Providers & Models" |
|
||||
*
|
||||
* @param {Sync_Providers_Dialog_TitleInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_dialog_title: ((inputs?: Sync_Providers_Dialog_TitleInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Dialog_TitleInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Dialog_TitleInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_Dialog_TitleInputs */
|
||||
|
||||
const en_sync_providers_dialog_title = /** @type {(inputs: Sync_Providers_Dialog_TitleInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Sync Providers & Models`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_dialog_title = /** @type {(inputs: Sync_Providers_Dialog_TitleInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`同步提供商与模型`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Sync Providers & Models" |
|
||||
*
|
||||
* @param {Sync_Providers_Dialog_TitleInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_dialog_title = /** @type {((inputs?: Sync_Providers_Dialog_TitleInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Dialog_TitleInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_dialog_title(inputs)
|
||||
return zh_sync_providers_dialog_title(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Existing Provider" |
|
||||
*
|
||||
* @param {Sync_Providers_Existing_ProviderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_existing_provider: ((inputs?: Sync_Providers_Existing_ProviderInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Existing_ProviderInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Existing_ProviderInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_Existing_ProviderInputs */
|
||||
|
||||
const en_sync_providers_existing_provider = /** @type {(inputs: Sync_Providers_Existing_ProviderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Existing Provider`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_existing_provider = /** @type {(inputs: Sync_Providers_Existing_ProviderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`现有提供商`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Existing Provider" |
|
||||
*
|
||||
* @param {Sync_Providers_Existing_ProviderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_existing_provider = /** @type {((inputs?: Sync_Providers_Existing_ProviderInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Existing_ProviderInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_existing_provider(inputs)
|
||||
return zh_sync_providers_existing_provider(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Expand All" |
|
||||
*
|
||||
* @param {Sync_Providers_Expand_AllInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_expand_all: ((inputs?: Sync_Providers_Expand_AllInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Expand_AllInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Expand_AllInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_Expand_AllInputs */
|
||||
|
||||
const en_sync_providers_expand_all = /** @type {(inputs: Sync_Providers_Expand_AllInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Expand All`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_expand_all = /** @type {(inputs: Sync_Providers_Expand_AllInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`全部展开`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Expand All" |
|
||||
*
|
||||
* @param {Sync_Providers_Expand_AllInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_expand_all = /** @type {((inputs?: Sync_Providers_Expand_AllInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Expand_AllInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_expand_all(inputs)
|
||||
return zh_sync_providers_expand_all(inputs)
|
||||
});
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "{count} new models" |
|
||||
*
|
||||
* @param {Sync_Providers_New_Models_CountInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_new_models_count: ((inputs: Sync_Providers_New_Models_CountInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_New_Models_CountInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_New_Models_CountInputs = {
|
||||
count: NonNullable<unknown>;
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{ count: NonNullable<unknown> }} Sync_Providers_New_Models_CountInputs */
|
||||
|
||||
const en_sync_providers_new_models_count = /** @type {(inputs: Sync_Providers_New_Models_CountInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`${i?.count} new models`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_new_models_count = /** @type {(inputs: Sync_Providers_New_Models_CountInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`${i?.count} 个新模型`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "{count} new models" |
|
||||
*
|
||||
* @param {Sync_Providers_New_Models_CountInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_new_models_count = /** @type {((inputs: Sync_Providers_New_Models_CountInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_New_Models_CountInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_new_models_count(inputs)
|
||||
return zh_sync_providers_new_models_count(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "New Provider" |
|
||||
*
|
||||
* @param {Sync_Providers_New_ProviderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_new_provider: ((inputs?: Sync_Providers_New_ProviderInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_New_ProviderInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_New_ProviderInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_New_ProviderInputs */
|
||||
|
||||
const en_sync_providers_new_provider = /** @type {(inputs: Sync_Providers_New_ProviderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`New Provider`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_new_provider = /** @type {(inputs: Sync_Providers_New_ProviderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`新提供商`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "New Provider" |
|
||||
*
|
||||
* @param {Sync_Providers_New_ProviderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_new_provider = /** @type {((inputs?: Sync_Providers_New_ProviderInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_New_ProviderInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_new_provider(inputs)
|
||||
return zh_sync_providers_new_provider(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "reasoning" |
|
||||
*
|
||||
* @param {Sync_Providers_ReasoningInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_reasoning: ((inputs?: Sync_Providers_ReasoningInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_ReasoningInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_ReasoningInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_ReasoningInputs */
|
||||
|
||||
const en_sync_providers_reasoning = /** @type {(inputs: Sync_Providers_ReasoningInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`reasoning`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_reasoning = /** @type {(inputs: Sync_Providers_ReasoningInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`深度思考`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "reasoning" |
|
||||
*
|
||||
* @param {Sync_Providers_ReasoningInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_reasoning = /** @type {((inputs?: Sync_Providers_ReasoningInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_ReasoningInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_reasoning(inputs)
|
||||
return zh_sync_providers_reasoning(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Filter new providers or models..." |
|
||||
*
|
||||
* @param {Sync_Providers_Search_PlaceholderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_search_placeholder: ((inputs?: Sync_Providers_Search_PlaceholderInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Search_PlaceholderInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Search_PlaceholderInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_Search_PlaceholderInputs */
|
||||
|
||||
const en_sync_providers_search_placeholder = /** @type {(inputs: Sync_Providers_Search_PlaceholderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Filter new providers or models...`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_search_placeholder = /** @type {(inputs: Sync_Providers_Search_PlaceholderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`筛选新提供商或模型...`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Filter new providers or models..." |
|
||||
*
|
||||
* @param {Sync_Providers_Search_PlaceholderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_search_placeholder = /** @type {((inputs?: Sync_Providers_Search_PlaceholderInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Search_PlaceholderInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_search_placeholder(inputs)
|
||||
return zh_sync_providers_search_placeholder(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Select All" |
|
||||
*
|
||||
* @param {Sync_Providers_Select_AllInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_select_all: ((inputs?: Sync_Providers_Select_AllInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Select_AllInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Select_AllInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_Select_AllInputs */
|
||||
|
||||
const en_sync_providers_select_all = /** @type {(inputs: Sync_Providers_Select_AllInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Select All`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_select_all = /** @type {(inputs: Sync_Providers_Select_AllInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`全选`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Select All" |
|
||||
*
|
||||
* @param {Sync_Providers_Select_AllInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_select_all = /** @type {((inputs?: Sync_Providers_Select_AllInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Select_AllInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_select_all(inputs)
|
||||
return zh_sync_providers_select_all(inputs)
|
||||
});
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "{modelCount} models selected across {providerCount} providers" |
|
||||
*
|
||||
* @param {Sync_Providers_Selected_CountInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_selected_count: ((inputs: Sync_Providers_Selected_CountInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Selected_CountInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Selected_CountInputs = {
|
||||
modelCount: NonNullable<unknown>;
|
||||
providerCount: NonNullable<unknown>;
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{ modelCount: NonNullable<unknown>, providerCount: NonNullable<unknown> }} Sync_Providers_Selected_CountInputs */
|
||||
|
||||
const en_sync_providers_selected_count = /** @type {(inputs: Sync_Providers_Selected_CountInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`${i?.modelCount} models selected across ${i?.providerCount} providers`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_selected_count = /** @type {(inputs: Sync_Providers_Selected_CountInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`已选 ${i?.modelCount} 个模型,分布在 ${i?.providerCount} 个提供商中`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "{modelCount} models selected across {providerCount} providers" |
|
||||
*
|
||||
* @param {Sync_Providers_Selected_CountInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_selected_count = /** @type {((inputs: Sync_Providers_Selected_CountInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Selected_CountInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_selected_count(inputs)
|
||||
return zh_sync_providers_selected_count(inputs)
|
||||
});
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Successfully added {modelCount} models across {providerCount} providers." |
|
||||
*
|
||||
* @param {Sync_Providers_SuccessInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_success: ((inputs: Sync_Providers_SuccessInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_SuccessInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_SuccessInputs = {
|
||||
modelCount: NonNullable<unknown>;
|
||||
providerCount: NonNullable<unknown>;
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{ modelCount: NonNullable<unknown>, providerCount: NonNullable<unknown> }} Sync_Providers_SuccessInputs */
|
||||
|
||||
const en_sync_providers_success = /** @type {(inputs: Sync_Providers_SuccessInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`Successfully added ${i?.modelCount} models across ${i?.providerCount} providers.`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_success = /** @type {(inputs: Sync_Providers_SuccessInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`已成功添加 ${i?.providerCount} 个提供商中的 ${i?.modelCount} 个模型。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Successfully added {modelCount} models across {providerCount} providers." |
|
||||
*
|
||||
* @param {Sync_Providers_SuccessInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_success = /** @type {((inputs: Sync_Providers_SuccessInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_SuccessInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_success(inputs)
|
||||
return zh_sync_providers_success(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "All providers and models are already up to date." |
|
||||
*
|
||||
* @param {Sync_Providers_Up_To_DateInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_up_to_date: ((inputs?: Sync_Providers_Up_To_DateInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Sync_Providers_Up_To_DateInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Sync_Providers_Up_To_DateInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Sync_Providers_Up_To_DateInputs */
|
||||
|
||||
const en_sync_providers_up_to_date = /** @type {(inputs: Sync_Providers_Up_To_DateInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`All providers and models are already up to date.`)
|
||||
};
|
||||
|
||||
const zh_sync_providers_up_to_date = /** @type {(inputs: Sync_Providers_Up_To_DateInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`所有提供商和模型均已是最新状态。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "All providers and models are already up to date." |
|
||||
*
|
||||
* @param {Sync_Providers_Up_To_DateInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const sync_providers_up_to_date = /** @type {((inputs?: Sync_Providers_Up_To_DateInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Sync_Providers_Up_To_DateInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_sync_providers_up_to_date(inputs)
|
||||
return zh_sync_providers_up_to_date(inputs)
|
||||
});
|
||||
Reference in New Issue
Block a user