mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 07:29:47 +00:00
feat(provider): optimize provider and model configuration management (#377)
* feat(provider): optimize provider and model configuration management * style(provider): use default tabs variant in provider settings dialog * style(provider): make tabs list full width * feat(provider): make model card row clickable and remove pencil edit icon * feat(settings): persist active settings tab in url hash * feat(agent): add search box and alphabetical sorting for provider and model selectors * refactor(providers): remove frontend pagination and display all models in scrollable list * fix(providers): address code review findings for model editing, i18n, and api protocol propagation
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
DialogTitle,
|
||||
} from '@/ui/components/ui/dialog'
|
||||
import { Field, FieldLabel, FieldError } from '@/ui/components/ui/field'
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
@@ -22,8 +23,8 @@ import {
|
||||
import { Switch } from '@/ui/components/ui/switch'
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { useForm, useStore } from '@tanstack/react-form'
|
||||
import { Loader2, Puzzle, Server, Terminal } from 'lucide-react'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { Check, ChevronDown, Loader2, Puzzle, Search, Server, Terminal, Zap } from 'lucide-react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { toast } from 'sonner'
|
||||
import { AgentInfo, AgentType, ThinkingLevel, thinkingLevelSchema } from '@shumai/dtos'
|
||||
@@ -218,6 +219,44 @@ export function AgentFormDialog({
|
||||
enabled: !!selectedProviderId && isOpen,
|
||||
})
|
||||
|
||||
const [providerSearchQuery, setProviderSearchQuery] = useState('')
|
||||
const [isProviderSelectOpen, setIsProviderSelectOpen] = useState(false)
|
||||
|
||||
// Sort providers alphabetically by name
|
||||
const sortedProviders = useMemo(() => {
|
||||
if (!providers) return []
|
||||
return [...providers].sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()))
|
||||
}, [providers])
|
||||
|
||||
// Filter providers based on search query
|
||||
const filteredProviders = useMemo(() => {
|
||||
if (!providerSearchQuery.trim()) return sortedProviders
|
||||
const q = providerSearchQuery.toLowerCase()
|
||||
return sortedProviders.filter((p) => p.name.toLowerCase().includes(q))
|
||||
}, [sortedProviders, providerSearchQuery])
|
||||
|
||||
const [modelSearchQuery, setModelSearchQuery] = useState('')
|
||||
const [isModelSelectOpen, setIsModelSelectOpen] = useState(false)
|
||||
|
||||
// Sort models alphabetically by display name / modelId
|
||||
const sortedModels = useMemo(() => {
|
||||
if (!models) return []
|
||||
return [...models].sort((a, b) => {
|
||||
const nameA = (a.name || a.modelId).toLowerCase()
|
||||
const nameB = (b.name || b.modelId).toLowerCase()
|
||||
return nameA.localeCompare(nameB)
|
||||
})
|
||||
}, [models])
|
||||
|
||||
// Filter models based on search query
|
||||
const filteredModels = useMemo(() => {
|
||||
if (!modelSearchQuery.trim()) return sortedModels
|
||||
const q = modelSearchQuery.toLowerCase()
|
||||
return sortedModels.filter(
|
||||
(m) => m.modelId.toLowerCase().includes(q) || (m.name && m.name.toLowerCase().includes(q)),
|
||||
)
|
||||
}, [sortedModels, modelSearchQuery])
|
||||
|
||||
const createMutation = useMutation({
|
||||
mutationFn: async (values: AgentFormValues) => {
|
||||
const res = await client.api.teams[':teamId'].agents.$post({
|
||||
@@ -259,6 +298,10 @@ export function AgentFormDialog({
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
form.reset()
|
||||
setProviderSearchQuery('')
|
||||
setIsProviderSelectOpen(false)
|
||||
setModelSearchQuery('')
|
||||
setIsModelSelectOpen(false)
|
||||
}
|
||||
}, [isOpen, initialValues, type])
|
||||
|
||||
@@ -421,27 +464,109 @@ export function AgentFormDialog({
|
||||
children={(field) => {
|
||||
const isInvalid =
|
||||
!!field.state.meta.errors.length && field.state.meta.isTouched
|
||||
const selectedProvider = providers?.find((p) => p.id === field.state.value)
|
||||
|
||||
return (
|
||||
<Field data-invalid={isInvalid}>
|
||||
<FieldLabel>{m.provider()}</FieldLabel>
|
||||
<Select
|
||||
value={field.state.value}
|
||||
onValueChange={(val) => {
|
||||
field.handleChange(val)
|
||||
form.setFieldValue('modelId', '')
|
||||
<Popover
|
||||
open={isProviderSelectOpen}
|
||||
onOpenChange={(open) => {
|
||||
setIsProviderSelectOpen(open)
|
||||
if (!open) setProviderSearchQuery('')
|
||||
}}
|
||||
modal={true}
|
||||
>
|
||||
<SelectTrigger aria-invalid={isInvalid}>
|
||||
<SelectValue placeholder={m.select_provider()} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{providers?.map((p) => (
|
||||
<SelectItem key={p.id} value={p.id}>
|
||||
{p.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
aria-expanded={isProviderSelectOpen}
|
||||
aria-invalid={isInvalid}
|
||||
className={cn(
|
||||
'w-full justify-between font-normal h-10 px-3 bg-background border-border hover:bg-accent/50',
|
||||
isInvalid && 'border-destructive ring-destructive',
|
||||
)}
|
||||
>
|
||||
<span className="truncate">
|
||||
{selectedProvider ? (
|
||||
<span className="font-medium text-foreground truncate">
|
||||
{selectedProvider.name}
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-muted-foreground">
|
||||
{m.select_provider()}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<ChevronDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
className="w-[--radix-popover-trigger-width] min-w-[320px] max-h-[360px] p-0 flex flex-col overflow-hidden"
|
||||
align="start"
|
||||
side="bottom"
|
||||
sideOffset={4}
|
||||
onWheel={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="relative p-2 pb-1.5 border-b border-border shrink-0">
|
||||
<Search className="absolute left-4.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground" />
|
||||
<Input
|
||||
placeholder={m.search_providers_placeholder()}
|
||||
value={providerSearchQuery}
|
||||
onChange={(e) => setProviderSearchQuery(e.target.value)}
|
||||
className="pl-8 h-8 text-xs bg-muted/40"
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
<ScrollArea
|
||||
className="w-full p-1"
|
||||
style={{
|
||||
height:
|
||||
filteredProviders.length === 0
|
||||
? '96px'
|
||||
: `${Math.min(filteredProviders.length * 38 + 8, 256)}px`,
|
||||
}}
|
||||
onWheel={(e) => e.stopPropagation()}
|
||||
>
|
||||
{filteredProviders.length === 0 ? (
|
||||
<div className="flex items-center justify-center h-full py-6 text-xs text-muted-foreground">
|
||||
{m.no_providers_found()}
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-0.5 pr-2">
|
||||
{filteredProviders.map((p) => {
|
||||
const isSelected = field.state.value === p.id
|
||||
return (
|
||||
<div
|
||||
key={p.id}
|
||||
onClick={() => {
|
||||
field.handleChange(p.id)
|
||||
form.setFieldValue('modelId', '')
|
||||
setModelSearchQuery('')
|
||||
setIsProviderSelectOpen(false)
|
||||
setProviderSearchQuery('')
|
||||
}}
|
||||
className={cn(
|
||||
'flex items-center justify-between px-2.5 py-2 rounded-md text-xs cursor-pointer transition-colors',
|
||||
isSelected
|
||||
? 'bg-accent text-accent-foreground font-medium'
|
||||
: 'hover:bg-muted/60 text-foreground',
|
||||
)}
|
||||
>
|
||||
<span className="truncate flex-1 pr-2">{p.name}</span>
|
||||
{isSelected && (
|
||||
<Check className="w-4 h-4 text-primary shrink-0" />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</ScrollArea>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
{isInvalid && (
|
||||
<FieldError errors={mapErrors(field.state.meta.errors)} />
|
||||
)}
|
||||
@@ -455,28 +580,141 @@ export function AgentFormDialog({
|
||||
children={(field) => {
|
||||
const isInvalid =
|
||||
!!field.state.meta.errors.length && field.state.meta.isTouched
|
||||
const selectedModel = models?.find((m) => m.id === field.state.value)
|
||||
|
||||
return (
|
||||
<Field data-invalid={isInvalid}>
|
||||
<FieldLabel className="flex items-center gap-2">
|
||||
{m.model()}
|
||||
{isModelsLoading && <Loader2 className="w-3 h-3 animate-spin" />}
|
||||
</FieldLabel>
|
||||
<Select
|
||||
value={field.state.value}
|
||||
onValueChange={field.handleChange}
|
||||
disabled={!selectedProviderId || isModelsLoading}
|
||||
<Popover
|
||||
open={isModelSelectOpen}
|
||||
onOpenChange={(open) => {
|
||||
setIsModelSelectOpen(open)
|
||||
if (!open) setModelSearchQuery('')
|
||||
}}
|
||||
modal={true}
|
||||
>
|
||||
<SelectTrigger aria-invalid={isInvalid}>
|
||||
<SelectValue placeholder={m.select_model()} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{models?.map((m) => (
|
||||
<SelectItem key={m.id} value={m.id}>
|
||||
{m.name || m.modelId}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
aria-expanded={isModelSelectOpen}
|
||||
aria-invalid={isInvalid}
|
||||
disabled={!selectedProviderId || isModelsLoading}
|
||||
className={cn(
|
||||
'w-full justify-between font-normal h-10 px-3 bg-background border-border hover:bg-accent/50',
|
||||
isInvalid && 'border-destructive ring-destructive',
|
||||
)}
|
||||
>
|
||||
<span className="truncate flex items-center gap-2">
|
||||
{selectedModel ? (
|
||||
<>
|
||||
<span className="truncate font-medium text-foreground">
|
||||
{selectedModel.name || selectedModel.modelId}
|
||||
</span>
|
||||
{selectedModel.name &&
|
||||
selectedModel.name !== selectedModel.modelId && (
|
||||
<Badge
|
||||
variant="secondary"
|
||||
className="font-mono text-[10px] px-1.5 py-0 shrink-0"
|
||||
>
|
||||
{selectedModel.modelId}
|
||||
</Badge>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<span className="text-muted-foreground">
|
||||
{m.select_model()}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<ChevronDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
className="w-[--radix-popover-trigger-width] min-w-[320px] max-h-[360px] p-0 flex flex-col overflow-hidden"
|
||||
align="start"
|
||||
side="bottom"
|
||||
sideOffset={4}
|
||||
onWheel={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="relative p-2 pb-1.5 border-b border-border shrink-0">
|
||||
<Search className="absolute left-4.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground" />
|
||||
<Input
|
||||
placeholder={m.search_models_placeholder()}
|
||||
value={modelSearchQuery}
|
||||
onChange={(e) => setModelSearchQuery(e.target.value)}
|
||||
className="pl-8 h-8 text-xs bg-muted/40"
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
<ScrollArea
|
||||
className="w-full p-1"
|
||||
style={{
|
||||
height:
|
||||
filteredModels.length === 0
|
||||
? '96px'
|
||||
: `${Math.min(filteredModels.length * 38 + 8, 256)}px`,
|
||||
}}
|
||||
onWheel={(e) => e.stopPropagation()}
|
||||
>
|
||||
{filteredModels.length === 0 ? (
|
||||
<div className="flex items-center justify-center h-full py-6 text-xs text-muted-foreground">
|
||||
{m.no_models_found()}
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-0.5 pr-2">
|
||||
{filteredModels.map((m) => {
|
||||
const isSelected = field.state.value === m.id
|
||||
return (
|
||||
<div
|
||||
key={m.id}
|
||||
onClick={() => {
|
||||
field.handleChange(m.id)
|
||||
setIsModelSelectOpen(false)
|
||||
setModelSearchQuery('')
|
||||
}}
|
||||
className={cn(
|
||||
'flex items-center justify-between px-2.5 py-2 rounded-md text-xs cursor-pointer transition-colors',
|
||||
isSelected
|
||||
? 'bg-accent text-accent-foreground font-medium'
|
||||
: 'hover:bg-muted/60 text-foreground',
|
||||
)}
|
||||
>
|
||||
<div className="min-w-0 flex-1 pr-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="truncate">
|
||||
{m.name || m.modelId}
|
||||
</span>
|
||||
{m.name && m.name !== m.modelId && (
|
||||
<span className="font-mono text-[10px] text-muted-foreground truncate">
|
||||
({m.modelId})
|
||||
</span>
|
||||
)}
|
||||
{m.config?.reasoning && (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="text-[9px] px-1 py-0 h-4 gap-0.5 bg-primary/10 text-primary border-primary/20 shrink-0"
|
||||
>
|
||||
<Zap className="w-2.5 h-2.5" />
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{isSelected && (
|
||||
<Check className="w-4 h-4 text-primary shrink-0" />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</ScrollArea>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
{isInvalid && (
|
||||
<FieldError errors={mapErrors(field.state.meta.errors)} />
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { cleanup, render, screen } from '@testing-library/react'
|
||||
import React from 'react'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { ModelFormDialog } from './ModelFormDialog'
|
||||
import type { ModelFormValues } from './ModelFormDialog'
|
||||
|
||||
describe('ModelFormDialog', () => {
|
||||
afterEach(() => {
|
||||
cleanup()
|
||||
})
|
||||
|
||||
const model1: ModelFormValues = {
|
||||
modelId: 'gpt-4o',
|
||||
name: 'GPT-4o Production',
|
||||
config: {
|
||||
api: 'openai-responses',
|
||||
reasoning: true,
|
||||
input: ['text', 'image'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 2.5, output: 10, cacheRead: 1.25, cacheWrite: 2.5 },
|
||||
},
|
||||
}
|
||||
|
||||
const model2: ModelFormValues = {
|
||||
modelId: 'claude-3-5-sonnet',
|
||||
name: 'Claude 3.5 Sonnet',
|
||||
config: {
|
||||
api: 'anthropic-messages',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 200000,
|
||||
maxTokens: 8192,
|
||||
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
||||
},
|
||||
}
|
||||
|
||||
it('populates fields with initialValues when opened for editing', () => {
|
||||
render(
|
||||
<ModelFormDialog
|
||||
isOpen={true}
|
||||
onClose={vi.fn()}
|
||||
onSubmit={vi.fn()}
|
||||
title="Edit Model"
|
||||
initialValues={model1}
|
||||
defaultApi="openai-responses"
|
||||
/>,
|
||||
)
|
||||
|
||||
const modelIdInput = screen.getByLabelText(/model id/i) as HTMLInputElement
|
||||
const nameInput = screen.getByLabelText(/display name/i) as HTMLInputElement
|
||||
|
||||
expect(modelIdInput.value).toBe('gpt-4o')
|
||||
expect(nameInput.value).toBe('GPT-4o Production')
|
||||
})
|
||||
|
||||
it('updates fields when switching between different models', () => {
|
||||
const { rerender } = render(
|
||||
<ModelFormDialog
|
||||
key="model-1"
|
||||
isOpen={true}
|
||||
onClose={vi.fn()}
|
||||
onSubmit={vi.fn()}
|
||||
title="Edit Model"
|
||||
initialValues={model1}
|
||||
defaultApi="openai-responses"
|
||||
/>,
|
||||
)
|
||||
|
||||
let modelIdInput = screen.getByLabelText(/model id/i) as HTMLInputElement
|
||||
expect(modelIdInput.value).toBe('gpt-4o')
|
||||
|
||||
rerender(
|
||||
<ModelFormDialog
|
||||
key="model-2"
|
||||
isOpen={true}
|
||||
onClose={vi.fn()}
|
||||
onSubmit={vi.fn()}
|
||||
title="Edit Model"
|
||||
initialValues={model2}
|
||||
defaultApi="anthropic-messages"
|
||||
/>,
|
||||
)
|
||||
|
||||
modelIdInput = screen.getByLabelText(/model id/i) as HTMLInputElement
|
||||
const nameInput = screen.getByLabelText(/display name/i) as HTMLInputElement
|
||||
|
||||
expect(modelIdInput.value).toBe('claude-3-5-sonnet')
|
||||
expect(nameInput.value).toBe('Claude 3.5 Sonnet')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,398 @@
|
||||
import { ScrollArea } from '@/ui/components/ui/scroll-area'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/ui/components/ui/dialog'
|
||||
import { Field, FieldError, FieldLabel } from '@/ui/components/ui/field'
|
||||
import { Input } from '@/ui/components/ui/input'
|
||||
import { Switch } from '@/ui/components/ui/switch'
|
||||
import { createModelRequestSchema } from '@shumai/dtos'
|
||||
import { useForm } from '@tanstack/react-form'
|
||||
import { DollarSign, Loader2 } from 'lucide-react'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { z } from 'zod'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
|
||||
export type ModelFormValues = z.infer<typeof createModelRequestSchema>
|
||||
|
||||
export interface ModelFormDialogProps {
|
||||
isOpen: boolean
|
||||
onClose: () => void
|
||||
onSubmit: (values: ModelFormValues) => void
|
||||
initialValues?: ModelFormValues | null
|
||||
title: string
|
||||
isLoading?: boolean
|
||||
defaultApi?: string
|
||||
existingModelIds?: string[]
|
||||
}
|
||||
|
||||
export function ModelFormDialog({
|
||||
isOpen,
|
||||
onClose,
|
||||
onSubmit,
|
||||
initialValues,
|
||||
title,
|
||||
isLoading = false,
|
||||
defaultApi,
|
||||
existingModelIds = [],
|
||||
}: ModelFormDialogProps) {
|
||||
const schema = useMemo(() => {
|
||||
return createModelRequestSchema.extend({
|
||||
modelId: z
|
||||
.string()
|
||||
.min(1, m.model_id())
|
||||
.refine(
|
||||
(id) => {
|
||||
if (initialValues?.modelId === id) return true
|
||||
return !existingModelIds.includes(id)
|
||||
},
|
||||
{ message: m.model_id_already_exists() },
|
||||
),
|
||||
})
|
||||
}, [existingModelIds, initialValues])
|
||||
|
||||
const getDefaultValues = () =>
|
||||
(initialValues || {
|
||||
modelId: '',
|
||||
name: '',
|
||||
config: {
|
||||
api: defaultApi,
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 128000,
|
||||
maxTokens: 4096,
|
||||
cost: {
|
||||
input: 0,
|
||||
output: 0,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
},
|
||||
}) as z.input<typeof schema>
|
||||
|
||||
const form = useForm({
|
||||
defaultValues: getDefaultValues(),
|
||||
validators: {
|
||||
onSubmit: schema,
|
||||
},
|
||||
onSubmit: async ({ value }) => {
|
||||
onSubmit(value as ModelFormValues)
|
||||
},
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
form.reset(getDefaultValues())
|
||||
}
|
||||
}, [isOpen, initialValues, defaultApi, form])
|
||||
|
||||
const mapErrors = (errors: unknown[]) => {
|
||||
return errors.map((e) => {
|
||||
if (typeof e === 'string') return { message: e }
|
||||
if (e && typeof e === 'object' && 'message' in e) {
|
||||
return { message: String(e.message) }
|
||||
}
|
||||
return { message: String(e || '') }
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={isOpen} onOpenChange={onClose}>
|
||||
<DialogContent className="sm:max-w-xl h-[85vh] max-h-[700px] flex flex-col p-0 overflow-hidden">
|
||||
<DialogHeader className="p-6 pb-2 shrink-0">
|
||||
<DialogTitle className="text-xl">{title}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
form.handleSubmit()
|
||||
}}
|
||||
className="flex-1 flex flex-col min-h-0 overflow-hidden"
|
||||
>
|
||||
<div className="flex-1 min-h-0">
|
||||
<ScrollArea className="h-full">
|
||||
<div className="p-6 pt-2 space-y-6 pr-6">
|
||||
{/* Basic Model Info */}
|
||||
<div className="space-y-4">
|
||||
<form.Field
|
||||
name="modelId"
|
||||
children={(field) => {
|
||||
const isInvalid =
|
||||
!!field.state.meta.errors.length && field.state.meta.isTouched
|
||||
return (
|
||||
<Field data-invalid={isInvalid}>
|
||||
<FieldLabel htmlFor={field.name}>{m.model_id()}</FieldLabel>
|
||||
<Input
|
||||
id={field.name}
|
||||
name={field.name}
|
||||
value={field.state.value}
|
||||
onBlur={field.handleBlur}
|
||||
onChange={(e) => field.handleChange(e.target.value)}
|
||||
placeholder={m.model_id_placeholder()}
|
||||
aria-invalid={isInvalid}
|
||||
/>
|
||||
{isInvalid && <FieldError errors={mapErrors(field.state.meta.errors)} />}
|
||||
</Field>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
|
||||
<form.Field
|
||||
name="name"
|
||||
children={(field) => {
|
||||
const isInvalid =
|
||||
!!field.state.meta.errors.length && field.state.meta.isTouched
|
||||
return (
|
||||
<Field data-invalid={isInvalid}>
|
||||
<FieldLabel htmlFor={field.name}>{m.display_name_optional()}</FieldLabel>
|
||||
<Input
|
||||
id={field.name}
|
||||
name={field.name}
|
||||
value={field.state.value || ''}
|
||||
onBlur={field.handleBlur}
|
||||
onChange={(e) => field.handleChange(e.target.value)}
|
||||
placeholder={m.model_name_placeholder()}
|
||||
aria-invalid={isInvalid}
|
||||
/>
|
||||
{isInvalid && <FieldError errors={mapErrors(field.state.meta.errors)} />}
|
||||
</Field>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Parameters & Reasoning */}
|
||||
<div className="space-y-4 pt-2 border-t border-border">
|
||||
<h4 className="text-sm font-semibold text-foreground">{m.parameters()}</h4>
|
||||
<form.Field
|
||||
name="config.reasoning"
|
||||
children={(field) => (
|
||||
<Field
|
||||
orientation="horizontal"
|
||||
className="rounded-lg border border-border p-3 shadow-sm bg-muted/40 justify-between flex items-center"
|
||||
>
|
||||
<FieldLabel htmlFor={field.name} className="cursor-pointer">
|
||||
{m.reasoning_support()}
|
||||
</FieldLabel>
|
||||
<Switch
|
||||
id={field.name}
|
||||
checked={field.state.value}
|
||||
onCheckedChange={field.handleChange}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<form.Field
|
||||
name="config.contextWindow"
|
||||
children={(field) => {
|
||||
const isInvalid =
|
||||
!!field.state.meta.errors.length && field.state.meta.isTouched
|
||||
return (
|
||||
<Field data-invalid={isInvalid}>
|
||||
<FieldLabel htmlFor={field.name} className="text-xs">
|
||||
{m.context_window_tokens()}
|
||||
</FieldLabel>
|
||||
<Input
|
||||
id={field.name}
|
||||
name={field.name}
|
||||
type="number"
|
||||
value={field.state.value}
|
||||
onBlur={field.handleBlur}
|
||||
onChange={(e) => field.handleChange(parseInt(e.target.value) || 0)}
|
||||
aria-invalid={isInvalid}
|
||||
/>
|
||||
{isInvalid && (
|
||||
<FieldError errors={mapErrors(field.state.meta.errors)} />
|
||||
)}
|
||||
</Field>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
|
||||
<form.Field
|
||||
name="config.maxTokens"
|
||||
children={(field) => {
|
||||
const isInvalid =
|
||||
!!field.state.meta.errors.length && field.state.meta.isTouched
|
||||
return (
|
||||
<Field data-invalid={isInvalid}>
|
||||
<FieldLabel htmlFor={field.name} className="text-xs">
|
||||
{m.max_output_tokens()}
|
||||
</FieldLabel>
|
||||
<Input
|
||||
id={field.name}
|
||||
name={field.name}
|
||||
type="number"
|
||||
value={field.state.value}
|
||||
onBlur={field.handleBlur}
|
||||
onChange={(e) => field.handleChange(parseInt(e.target.value) || 0)}
|
||||
aria-invalid={isInvalid}
|
||||
/>
|
||||
{isInvalid && (
|
||||
<FieldError errors={mapErrors(field.state.meta.errors)} />
|
||||
)}
|
||||
</Field>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Pricing Section */}
|
||||
<div className="space-y-4 pt-2 border-t border-border">
|
||||
<h4 className="text-sm font-semibold text-foreground flex items-center gap-1.5">
|
||||
<DollarSign className="w-4 h-4 text-primary" />
|
||||
{m.pricing()}
|
||||
</h4>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<form.Field
|
||||
name="config.cost.input"
|
||||
children={(field) => {
|
||||
const isInvalid =
|
||||
!!field.state.meta.errors.length && field.state.meta.isTouched
|
||||
return (
|
||||
<Field data-invalid={isInvalid}>
|
||||
<FieldLabel htmlFor={field.name} className="text-xs">
|
||||
{m.input_cost_1m()}
|
||||
</FieldLabel>
|
||||
<Input
|
||||
id={field.name}
|
||||
name={field.name}
|
||||
type="number"
|
||||
step="0.0001"
|
||||
value={field.state.value}
|
||||
onBlur={field.handleBlur}
|
||||
onChange={(e) => field.handleChange(parseFloat(e.target.value) || 0)}
|
||||
aria-invalid={isInvalid}
|
||||
/>
|
||||
{isInvalid && (
|
||||
<FieldError errors={mapErrors(field.state.meta.errors)} />
|
||||
)}
|
||||
</Field>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
|
||||
<form.Field
|
||||
name="config.cost.output"
|
||||
children={(field) => {
|
||||
const isInvalid =
|
||||
!!field.state.meta.errors.length && field.state.meta.isTouched
|
||||
return (
|
||||
<Field data-invalid={isInvalid}>
|
||||
<FieldLabel htmlFor={field.name} className="text-xs">
|
||||
{m.output_cost_1m()}
|
||||
</FieldLabel>
|
||||
<Input
|
||||
id={field.name}
|
||||
name={field.name}
|
||||
type="number"
|
||||
step="0.0001"
|
||||
value={field.state.value}
|
||||
onBlur={field.handleBlur}
|
||||
onChange={(e) => field.handleChange(parseFloat(e.target.value) || 0)}
|
||||
aria-invalid={isInvalid}
|
||||
/>
|
||||
{isInvalid && (
|
||||
<FieldError errors={mapErrors(field.state.meta.errors)} />
|
||||
)}
|
||||
</Field>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
|
||||
<form.Field
|
||||
name="config.cost.cacheRead"
|
||||
children={(field) => {
|
||||
const isInvalid =
|
||||
!!field.state.meta.errors.length && field.state.meta.isTouched
|
||||
return (
|
||||
<Field data-invalid={isInvalid}>
|
||||
<FieldLabel htmlFor={field.name} className="text-xs">
|
||||
{m.cache_read_cost_1m()}
|
||||
</FieldLabel>
|
||||
<Input
|
||||
id={field.name}
|
||||
name={field.name}
|
||||
type="number"
|
||||
step="0.0001"
|
||||
value={field.state.value}
|
||||
onBlur={field.handleBlur}
|
||||
onChange={(e) => field.handleChange(parseFloat(e.target.value) || 0)}
|
||||
aria-invalid={isInvalid}
|
||||
/>
|
||||
{isInvalid && (
|
||||
<FieldError errors={mapErrors(field.state.meta.errors)} />
|
||||
)}
|
||||
</Field>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
|
||||
<form.Field
|
||||
name="config.cost.cacheWrite"
|
||||
children={(field) => {
|
||||
const isInvalid =
|
||||
!!field.state.meta.errors.length && field.state.meta.isTouched
|
||||
return (
|
||||
<Field data-invalid={isInvalid}>
|
||||
<FieldLabel htmlFor={field.name} className="text-xs">
|
||||
{m.cache_write_cost_1m()}
|
||||
</FieldLabel>
|
||||
<Input
|
||||
id={field.name}
|
||||
name={field.name}
|
||||
type="number"
|
||||
step="0.0001"
|
||||
value={field.state.value}
|
||||
onBlur={field.handleBlur}
|
||||
onChange={(e) => field.handleChange(parseFloat(e.target.value) || 0)}
|
||||
aria-invalid={isInvalid}
|
||||
/>
|
||||
{isInvalid && (
|
||||
<FieldError errors={mapErrors(field.state.meta.errors)} />
|
||||
)}
|
||||
</Field>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
|
||||
<DialogFooter className="p-6 pt-4 border-t border-border gap-2 shrink-0">
|
||||
<Button type="button" variant="outline" onClick={onClose} disabled={isLoading}>
|
||||
{m.cancel()}
|
||||
</Button>
|
||||
<form.Subscribe
|
||||
selector={(state) => [state.canSubmit, state.isSubmitting]}
|
||||
children={([canSubmit, isSubmitting]) => (
|
||||
<Button
|
||||
type="submit"
|
||||
className="min-w-[100px]"
|
||||
disabled={!canSubmit || isSubmitting || isLoading}
|
||||
>
|
||||
{isSubmitting || isLoading ? (
|
||||
<Loader2 className="w-4 h-4 animate-spin" />
|
||||
) : (
|
||||
m.save_changes()
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
/>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -312,6 +312,7 @@
|
||||
"configured_ai_providers": "Configured AI Providers",
|
||||
"add_provider": "Add Provider",
|
||||
"search_providers_placeholder": "Search providers...",
|
||||
"no_providers_found": "No providers found",
|
||||
"built_in": "Built-in",
|
||||
"models_count": "Models",
|
||||
"n_models_count": "{count} Models",
|
||||
@@ -340,6 +341,20 @@
|
||||
"api_key_description": "You can provide a literal value (e.g. sk-...) or an Environment variable name (e.g. MY_API_KEY).",
|
||||
"models_configuration": "Models Configuration",
|
||||
"add_model": "Add Model",
|
||||
"edit_model": "Edit Model",
|
||||
"delete_model": "Delete Model",
|
||||
"delete_model_confirmation": "This action cannot be undone. This will permanently delete the model \"{name}\".",
|
||||
"model_created_successfully": "Model created successfully",
|
||||
"model_updated_successfully": "Model updated successfully",
|
||||
"model_deleted_successfully": "Model deleted successfully",
|
||||
"models": "Models",
|
||||
"search_models_placeholder": "Search models by ID or name...",
|
||||
"no_models_found": "No models found",
|
||||
"page_info": "Page {current} of {total}",
|
||||
"previous": "Previous",
|
||||
"next": "Next",
|
||||
"pricing": "Pricing ($ per 1M tokens)",
|
||||
"parameters": "Parameters",
|
||||
"model_id": "Model ID",
|
||||
"display_name_optional": "Display Name (Optional)",
|
||||
"reasoning_support": "Reasoning Support",
|
||||
@@ -347,8 +362,16 @@
|
||||
"max_output_tokens": "Max Output Tokens",
|
||||
"input_cost_1m": "Input Cost (1M)",
|
||||
"output_cost_1m": "Output Cost (1M)",
|
||||
"tokens": "tokens",
|
||||
"cache_read_cost_1m": "Cache Read Cost (1M)",
|
||||
"cache_write_cost_1m": "Cache Write Cost (1M)",
|
||||
"save_configuration": "Save Configuration",
|
||||
"at_least_one_model_required": "At least one model is required",
|
||||
"model_id_already_exists": "Model ID already exists for this provider",
|
||||
"model_id_placeholder": "e.g., gpt-4o, claude-3-5-sonnet-20241022",
|
||||
"model_name_placeholder": "e.g., GPT-4o",
|
||||
"cost_per_million": "${input}/1M in · ${output}/1M out",
|
||||
"max_tokens_label": "max {count}",
|
||||
"provider": "Provider",
|
||||
"model": "Model",
|
||||
"select_provider": "Select Provider",
|
||||
|
||||
@@ -312,6 +312,7 @@
|
||||
"configured_ai_providers": "已配置的 AI 提供商",
|
||||
"add_provider": "添加提供商",
|
||||
"search_providers_placeholder": "搜索提供商...",
|
||||
"no_providers_found": "未找到提供商",
|
||||
"built_in": "内置",
|
||||
"models_count": "模型",
|
||||
"n_models_count": "{count} 个模型",
|
||||
@@ -340,6 +341,20 @@
|
||||
"api_key_description": "您可以提供一个字面值(例如 sk-...)或环境变量名称(例如 MY_API_KEY)。",
|
||||
"models_configuration": "模型配置",
|
||||
"add_model": "添加模型",
|
||||
"edit_model": "编辑模型",
|
||||
"delete_model": "删除模型",
|
||||
"delete_model_confirmation": "此操作无法撤销。这将永久删除模型 \"{name}\"。",
|
||||
"model_created_successfully": "模型创建成功",
|
||||
"model_updated_successfully": "模型更新成功",
|
||||
"model_deleted_successfully": "模型删除成功",
|
||||
"models": "模型列表",
|
||||
"search_models_placeholder": "按 ID 或名称搜索模型...",
|
||||
"no_models_found": "未找到模型",
|
||||
"page_info": "第 {current} 页,共 {total} 页",
|
||||
"previous": "上一页",
|
||||
"next": "下一页",
|
||||
"pricing": "计费(每百万令牌美元)",
|
||||
"parameters": "参数",
|
||||
"model_id": "模型 ID",
|
||||
"display_name_optional": "显示名称(可选)",
|
||||
"reasoning_support": "推理支持",
|
||||
@@ -347,8 +362,16 @@
|
||||
"max_output_tokens": "最大输出令牌数",
|
||||
"input_cost_1m": "输入成本(每百万)",
|
||||
"output_cost_1m": "输出成本(每百万)",
|
||||
"tokens": "令牌",
|
||||
"cache_read_cost_1m": "缓存读取成本(每百万)",
|
||||
"cache_write_cost_1m": "缓存写入成本(每百万)",
|
||||
"save_configuration": "保存配置",
|
||||
"at_least_one_model_required": "至少需要一个模型",
|
||||
"model_id_already_exists": "此提供商已存在该模型 ID",
|
||||
"model_id_placeholder": "例如:gpt-4o, claude-3-5-sonnet-20241022",
|
||||
"model_name_placeholder": "例如:GPT-4o",
|
||||
"cost_per_million": "${input}/1M 输入 · ${output}/1M 输出",
|
||||
"max_tokens_label": "最大 {count}",
|
||||
"provider": "提供商",
|
||||
"model": "模型",
|
||||
"select_provider": "选择提供商",
|
||||
|
||||
+23
@@ -296,6 +296,7 @@ export * from "./providers_description.js";
|
||||
export * from "./configured_ai_providers.js";
|
||||
export * from "./add_provider.js";
|
||||
export * from "./search_providers_placeholder.js";
|
||||
export * from "./no_providers_found.js";
|
||||
export * from "./built_in.js";
|
||||
export * from "./models_count.js";
|
||||
export * from "./n_models_count.js";
|
||||
@@ -324,6 +325,20 @@ export * from "./api_key_placeholder.js";
|
||||
export * from "./api_key_description.js";
|
||||
export * from "./models_configuration.js";
|
||||
export * from "./add_model.js";
|
||||
export * from "./edit_model.js";
|
||||
export * from "./delete_model.js";
|
||||
export * from "./delete_model_confirmation.js";
|
||||
export * from "./model_created_successfully.js";
|
||||
export * from "./model_updated_successfully.js";
|
||||
export * from "./model_deleted_successfully.js";
|
||||
export * from "./models.js";
|
||||
export * from "./search_models_placeholder.js";
|
||||
export * from "./no_models_found.js";
|
||||
export * from "./page_info.js";
|
||||
export * from "./previous.js";
|
||||
export * from "./next.js";
|
||||
export * from "./pricing.js";
|
||||
export * from "./parameters.js";
|
||||
export * from "./model_id.js";
|
||||
export * from "./display_name_optional.js";
|
||||
export * from "./reasoning_support.js";
|
||||
@@ -331,8 +346,16 @@ export * from "./context_window_tokens.js";
|
||||
export * from "./max_output_tokens.js";
|
||||
export * from "./input_cost_1m.js";
|
||||
export * from "./output_cost_1m.js";
|
||||
export * from "./tokens.js";
|
||||
export * from "./cache_read_cost_1m.js";
|
||||
export * from "./cache_write_cost_1m.js";
|
||||
export * from "./save_configuration.js";
|
||||
export * from "./at_least_one_model_required.js";
|
||||
export * from "./model_id_already_exists.js";
|
||||
export * from "./model_id_placeholder.js";
|
||||
export * from "./model_name_placeholder.js";
|
||||
export * from "./cost_per_million.js";
|
||||
export * from "./max_tokens_label.js";
|
||||
export * from "./provider.js";
|
||||
export * from "./model.js";
|
||||
export * from "./select_provider.js";
|
||||
|
||||
+23
@@ -298,6 +298,7 @@ export * from './providers_description.js'
|
||||
export * from './configured_ai_providers.js'
|
||||
export * from './add_provider.js'
|
||||
export * from './search_providers_placeholder.js'
|
||||
export * from './no_providers_found.js'
|
||||
export * from './built_in.js'
|
||||
export * from './models_count.js'
|
||||
export * from './n_models_count.js'
|
||||
@@ -326,6 +327,20 @@ export * from './api_key_placeholder.js'
|
||||
export * from './api_key_description.js'
|
||||
export * from './models_configuration.js'
|
||||
export * from './add_model.js'
|
||||
export * from './edit_model.js'
|
||||
export * from './delete_model.js'
|
||||
export * from './delete_model_confirmation.js'
|
||||
export * from './model_created_successfully.js'
|
||||
export * from './model_updated_successfully.js'
|
||||
export * from './model_deleted_successfully.js'
|
||||
export * from './models.js'
|
||||
export * from './search_models_placeholder.js'
|
||||
export * from './no_models_found.js'
|
||||
export * from './page_info.js'
|
||||
export * from './previous.js'
|
||||
export * from './next.js'
|
||||
export * from './pricing.js'
|
||||
export * from './parameters.js'
|
||||
export * from './model_id.js'
|
||||
export * from './display_name_optional.js'
|
||||
export * from './reasoning_support.js'
|
||||
@@ -333,8 +348,16 @@ export * from './context_window_tokens.js'
|
||||
export * from './max_output_tokens.js'
|
||||
export * from './input_cost_1m.js'
|
||||
export * from './output_cost_1m.js'
|
||||
export * from './tokens.js'
|
||||
export * from './cache_read_cost_1m.js'
|
||||
export * from './cache_write_cost_1m.js'
|
||||
export * from './save_configuration.js'
|
||||
export * from './at_least_one_model_required.js'
|
||||
export * from './model_id_already_exists.js'
|
||||
export * from './model_id_placeholder.js'
|
||||
export * from './model_name_placeholder.js'
|
||||
export * from './cost_per_million.js'
|
||||
export * from './max_tokens_label.js'
|
||||
export * from './provider.js'
|
||||
export * from './model.js'
|
||||
export * from './select_provider.js'
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Cache Read Cost (1M)" |
|
||||
*
|
||||
* @param {Cache_Read_Cost_1mInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const cache_read_cost_1m: ((inputs?: Cache_Read_Cost_1mInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Cache_Read_Cost_1mInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Cache_Read_Cost_1mInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Cache_Read_Cost_1mInputs */
|
||||
|
||||
const en_cache_read_cost_1m = /** @type {(inputs: Cache_Read_Cost_1mInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Cache Read Cost (1M)`)
|
||||
};
|
||||
|
||||
const zh_cache_read_cost_1m = /** @type {(inputs: Cache_Read_Cost_1mInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`缓存读取成本(每百万)`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Cache Read Cost (1M)" |
|
||||
*
|
||||
* @param {Cache_Read_Cost_1mInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const cache_read_cost_1m = /** @type {((inputs?: Cache_Read_Cost_1mInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Cache_Read_Cost_1mInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_cache_read_cost_1m(inputs)
|
||||
return zh_cache_read_cost_1m(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Cache Write Cost (1M)" |
|
||||
*
|
||||
* @param {Cache_Write_Cost_1mInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const cache_write_cost_1m: ((inputs?: Cache_Write_Cost_1mInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Cache_Write_Cost_1mInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Cache_Write_Cost_1mInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Cache_Write_Cost_1mInputs */
|
||||
|
||||
const en_cache_write_cost_1m = /** @type {(inputs: Cache_Write_Cost_1mInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Cache Write Cost (1M)`)
|
||||
};
|
||||
|
||||
const zh_cache_write_cost_1m = /** @type {(inputs: Cache_Write_Cost_1mInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`缓存写入成本(每百万)`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Cache Write Cost (1M)" |
|
||||
*
|
||||
* @param {Cache_Write_Cost_1mInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const cache_write_cost_1m = /** @type {((inputs?: Cache_Write_Cost_1mInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Cache_Write_Cost_1mInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_cache_write_cost_1m(inputs)
|
||||
return zh_cache_write_cost_1m(inputs)
|
||||
});
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "${input}/1M in · ${output}/1M out" |
|
||||
*
|
||||
* @param {Cost_Per_MillionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const cost_per_million: ((inputs: Cost_Per_MillionInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Cost_Per_MillionInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Cost_Per_MillionInputs = {
|
||||
input: NonNullable<unknown>;
|
||||
output: NonNullable<unknown>;
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{ input: NonNullable<unknown>, output: NonNullable<unknown> }} Cost_Per_MillionInputs */
|
||||
|
||||
const en_cost_per_million = /** @type {(inputs: Cost_Per_MillionInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`$${i?.input}/1M in · $${i?.output}/1M out`)
|
||||
};
|
||||
|
||||
const zh_cost_per_million = /** @type {(inputs: Cost_Per_MillionInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`$${i?.input}/1M 输入 · $${i?.output}/1M 输出`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "${input}/1M in · ${output}/1M out" |
|
||||
*
|
||||
* @param {Cost_Per_MillionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const cost_per_million = /** @type {((inputs: Cost_Per_MillionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Cost_Per_MillionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_cost_per_million(inputs)
|
||||
return zh_cost_per_million(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Delete Model" |
|
||||
*
|
||||
* @param {Delete_ModelInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const delete_model: ((inputs?: Delete_ModelInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Delete_ModelInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Delete_ModelInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Delete_ModelInputs */
|
||||
|
||||
const en_delete_model = /** @type {(inputs: Delete_ModelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Delete Model`)
|
||||
};
|
||||
|
||||
const zh_delete_model = /** @type {(inputs: Delete_ModelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`删除模型`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Delete Model" |
|
||||
*
|
||||
* @param {Delete_ModelInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const delete_model = /** @type {((inputs?: Delete_ModelInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Delete_ModelInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_delete_model(inputs)
|
||||
return zh_delete_model(inputs)
|
||||
});
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "This action cannot be undone. This will permanently delete the model \"{name}\"." |
|
||||
*
|
||||
* @param {Delete_Model_ConfirmationInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const delete_model_confirmation: ((inputs: Delete_Model_ConfirmationInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Delete_Model_ConfirmationInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Delete_Model_ConfirmationInputs = {
|
||||
name: NonNullable<unknown>;
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{ name: NonNullable<unknown> }} Delete_Model_ConfirmationInputs */
|
||||
|
||||
const en_delete_model_confirmation = /** @type {(inputs: Delete_Model_ConfirmationInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`This action cannot be undone. This will permanently delete the model "${i?.name}".`)
|
||||
};
|
||||
|
||||
const zh_delete_model_confirmation = /** @type {(inputs: Delete_Model_ConfirmationInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`此操作无法撤销。这将永久删除模型 "${i?.name}"。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "This action cannot be undone. This will permanently delete the model \"{name}\"." |
|
||||
*
|
||||
* @param {Delete_Model_ConfirmationInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const delete_model_confirmation = /** @type {((inputs: Delete_Model_ConfirmationInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Delete_Model_ConfirmationInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_delete_model_confirmation(inputs)
|
||||
return zh_delete_model_confirmation(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Edit Model" |
|
||||
*
|
||||
* @param {Edit_ModelInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const edit_model: ((inputs?: Edit_ModelInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Edit_ModelInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Edit_ModelInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Edit_ModelInputs */
|
||||
|
||||
const en_edit_model = /** @type {(inputs: Edit_ModelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Edit Model`)
|
||||
};
|
||||
|
||||
const zh_edit_model = /** @type {(inputs: Edit_ModelInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`编辑模型`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Edit Model" |
|
||||
*
|
||||
* @param {Edit_ModelInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const edit_model = /** @type {((inputs?: Edit_ModelInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Edit_ModelInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_edit_model(inputs)
|
||||
return zh_edit_model(inputs)
|
||||
});
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "max {count}" |
|
||||
*
|
||||
* @param {Max_Tokens_LabelInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const max_tokens_label: ((inputs: Max_Tokens_LabelInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Max_Tokens_LabelInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Max_Tokens_LabelInputs = {
|
||||
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> }} Max_Tokens_LabelInputs */
|
||||
|
||||
const en_max_tokens_label = /** @type {(inputs: Max_Tokens_LabelInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`max ${i?.count}`)
|
||||
};
|
||||
|
||||
const zh_max_tokens_label = /** @type {(inputs: Max_Tokens_LabelInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`最大 ${i?.count}`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "max {count}" |
|
||||
*
|
||||
* @param {Max_Tokens_LabelInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const max_tokens_label = /** @type {((inputs: Max_Tokens_LabelInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Max_Tokens_LabelInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_max_tokens_label(inputs)
|
||||
return zh_max_tokens_label(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Model created successfully" |
|
||||
*
|
||||
* @param {Model_Created_SuccessfullyInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_created_successfully: ((inputs?: Model_Created_SuccessfullyInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Model_Created_SuccessfullyInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Model_Created_SuccessfullyInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Model_Created_SuccessfullyInputs */
|
||||
|
||||
const en_model_created_successfully = /** @type {(inputs: Model_Created_SuccessfullyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Model created successfully`)
|
||||
};
|
||||
|
||||
const zh_model_created_successfully = /** @type {(inputs: Model_Created_SuccessfullyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`模型创建成功`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Model created successfully" |
|
||||
*
|
||||
* @param {Model_Created_SuccessfullyInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_created_successfully = /** @type {((inputs?: Model_Created_SuccessfullyInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Model_Created_SuccessfullyInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_model_created_successfully(inputs)
|
||||
return zh_model_created_successfully(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Model deleted successfully" |
|
||||
*
|
||||
* @param {Model_Deleted_SuccessfullyInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_deleted_successfully: ((inputs?: Model_Deleted_SuccessfullyInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Model_Deleted_SuccessfullyInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Model_Deleted_SuccessfullyInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Model_Deleted_SuccessfullyInputs */
|
||||
|
||||
const en_model_deleted_successfully = /** @type {(inputs: Model_Deleted_SuccessfullyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Model deleted successfully`)
|
||||
};
|
||||
|
||||
const zh_model_deleted_successfully = /** @type {(inputs: Model_Deleted_SuccessfullyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`模型删除成功`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Model deleted successfully" |
|
||||
*
|
||||
* @param {Model_Deleted_SuccessfullyInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_deleted_successfully = /** @type {((inputs?: Model_Deleted_SuccessfullyInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Model_Deleted_SuccessfullyInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_model_deleted_successfully(inputs)
|
||||
return zh_model_deleted_successfully(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Model ID already exists for this provider" |
|
||||
*
|
||||
* @param {Model_Id_Already_ExistsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_id_already_exists: ((inputs?: Model_Id_Already_ExistsInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Model_Id_Already_ExistsInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Model_Id_Already_ExistsInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Model_Id_Already_ExistsInputs */
|
||||
|
||||
const en_model_id_already_exists = /** @type {(inputs: Model_Id_Already_ExistsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Model ID already exists for this provider`)
|
||||
};
|
||||
|
||||
const zh_model_id_already_exists = /** @type {(inputs: Model_Id_Already_ExistsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`此提供商已存在该模型 ID`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Model ID already exists for this provider" |
|
||||
*
|
||||
* @param {Model_Id_Already_ExistsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_id_already_exists = /** @type {((inputs?: Model_Id_Already_ExistsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Model_Id_Already_ExistsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_model_id_already_exists(inputs)
|
||||
return zh_model_id_already_exists(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "e.g., gpt-4o, claude-3-5-sonnet-20241022" |
|
||||
*
|
||||
* @param {Model_Id_PlaceholderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_id_placeholder: ((inputs?: Model_Id_PlaceholderInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Model_Id_PlaceholderInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Model_Id_PlaceholderInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Model_Id_PlaceholderInputs */
|
||||
|
||||
const en_model_id_placeholder = /** @type {(inputs: Model_Id_PlaceholderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`e.g., gpt-4o, claude-3-5-sonnet-20241022`)
|
||||
};
|
||||
|
||||
const zh_model_id_placeholder = /** @type {(inputs: Model_Id_PlaceholderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`例如:gpt-4o, claude-3-5-sonnet-20241022`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "e.g., gpt-4o, claude-3-5-sonnet-20241022" |
|
||||
*
|
||||
* @param {Model_Id_PlaceholderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_id_placeholder = /** @type {((inputs?: Model_Id_PlaceholderInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Model_Id_PlaceholderInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_model_id_placeholder(inputs)
|
||||
return zh_model_id_placeholder(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "e.g., GPT-4o" |
|
||||
*
|
||||
* @param {Model_Name_PlaceholderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_name_placeholder: ((inputs?: Model_Name_PlaceholderInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Model_Name_PlaceholderInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Model_Name_PlaceholderInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Model_Name_PlaceholderInputs */
|
||||
|
||||
const en_model_name_placeholder = /** @type {(inputs: Model_Name_PlaceholderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`e.g., GPT-4o`)
|
||||
};
|
||||
|
||||
const zh_model_name_placeholder = /** @type {(inputs: Model_Name_PlaceholderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`例如:GPT-4o`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "e.g., GPT-4o" |
|
||||
*
|
||||
* @param {Model_Name_PlaceholderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_name_placeholder = /** @type {((inputs?: Model_Name_PlaceholderInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Model_Name_PlaceholderInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_model_name_placeholder(inputs)
|
||||
return zh_model_name_placeholder(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Model updated successfully" |
|
||||
*
|
||||
* @param {Model_Updated_SuccessfullyInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_updated_successfully: ((inputs?: Model_Updated_SuccessfullyInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Model_Updated_SuccessfullyInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Model_Updated_SuccessfullyInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Model_Updated_SuccessfullyInputs */
|
||||
|
||||
const en_model_updated_successfully = /** @type {(inputs: Model_Updated_SuccessfullyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Model updated successfully`)
|
||||
};
|
||||
|
||||
const zh_model_updated_successfully = /** @type {(inputs: Model_Updated_SuccessfullyInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`模型更新成功`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Model updated successfully" |
|
||||
*
|
||||
* @param {Model_Updated_SuccessfullyInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const model_updated_successfully = /** @type {((inputs?: Model_Updated_SuccessfullyInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Model_Updated_SuccessfullyInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_model_updated_successfully(inputs)
|
||||
return zh_model_updated_successfully(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Models" |
|
||||
*
|
||||
* @param {ModelsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const models: ((inputs?: ModelsInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<ModelsInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type ModelsInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} ModelsInputs */
|
||||
|
||||
const en_models = /** @type {(inputs: ModelsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Models`)
|
||||
};
|
||||
|
||||
const zh_models = /** @type {(inputs: ModelsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`模型列表`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Models" |
|
||||
*
|
||||
* @param {ModelsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const models = /** @type {((inputs?: ModelsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<ModelsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_models(inputs)
|
||||
return zh_models(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Next" |
|
||||
*
|
||||
* @param {NextInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const next: ((inputs?: NextInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<NextInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type NextInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} NextInputs */
|
||||
|
||||
const en_next = /** @type {(inputs: NextInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Next`)
|
||||
};
|
||||
|
||||
const zh_next = /** @type {(inputs: NextInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`下一页`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Next" |
|
||||
*
|
||||
* @param {NextInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const next = /** @type {((inputs?: NextInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<NextInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_next(inputs)
|
||||
return zh_next(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "No models found" |
|
||||
*
|
||||
* @param {No_Models_FoundInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const no_models_found: ((inputs?: No_Models_FoundInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<No_Models_FoundInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type No_Models_FoundInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} No_Models_FoundInputs */
|
||||
|
||||
const en_no_models_found = /** @type {(inputs: No_Models_FoundInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`No models found`)
|
||||
};
|
||||
|
||||
const zh_no_models_found = /** @type {(inputs: No_Models_FoundInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`未找到模型`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "No models found" |
|
||||
*
|
||||
* @param {No_Models_FoundInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const no_models_found = /** @type {((inputs?: No_Models_FoundInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<No_Models_FoundInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_no_models_found(inputs)
|
||||
return zh_no_models_found(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "No providers found" |
|
||||
*
|
||||
* @param {No_Providers_FoundInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const no_providers_found: ((inputs?: No_Providers_FoundInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<No_Providers_FoundInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type No_Providers_FoundInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} No_Providers_FoundInputs */
|
||||
|
||||
const en_no_providers_found = /** @type {(inputs: No_Providers_FoundInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`No providers found`)
|
||||
};
|
||||
|
||||
const zh_no_providers_found = /** @type {(inputs: No_Providers_FoundInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`未找到提供商`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "No providers found" |
|
||||
*
|
||||
* @param {No_Providers_FoundInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const no_providers_found = /** @type {((inputs?: No_Providers_FoundInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<No_Providers_FoundInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_no_providers_found(inputs)
|
||||
return zh_no_providers_found(inputs)
|
||||
});
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Page {current} of {total}" |
|
||||
*
|
||||
* @param {Page_InfoInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const page_info: ((inputs: Page_InfoInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Page_InfoInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Page_InfoInputs = {
|
||||
current: NonNullable<unknown>;
|
||||
total: NonNullable<unknown>;
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{ current: NonNullable<unknown>, total: NonNullable<unknown> }} Page_InfoInputs */
|
||||
|
||||
const en_page_info = /** @type {(inputs: Page_InfoInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`Page ${i?.current} of ${i?.total}`)
|
||||
};
|
||||
|
||||
const zh_page_info = /** @type {(inputs: Page_InfoInputs) => LocalizedString} */ (i) => {
|
||||
return /** @type {LocalizedString} */ (`第 ${i?.current} 页,共 ${i?.total} 页`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Page {current} of {total}" |
|
||||
*
|
||||
* @param {Page_InfoInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const page_info = /** @type {((inputs: Page_InfoInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Page_InfoInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_page_info(inputs)
|
||||
return zh_page_info(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Parameters" |
|
||||
*
|
||||
* @param {ParametersInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const parameters: ((inputs?: ParametersInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<ParametersInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type ParametersInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} ParametersInputs */
|
||||
|
||||
const en_parameters = /** @type {(inputs: ParametersInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Parameters`)
|
||||
};
|
||||
|
||||
const zh_parameters = /** @type {(inputs: ParametersInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`参数`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Parameters" |
|
||||
*
|
||||
* @param {ParametersInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const parameters = /** @type {((inputs?: ParametersInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<ParametersInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_parameters(inputs)
|
||||
return zh_parameters(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Previous" |
|
||||
*
|
||||
* @param {PreviousInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const previous: ((inputs?: PreviousInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<PreviousInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type PreviousInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} PreviousInputs */
|
||||
|
||||
const en_previous = /** @type {(inputs: PreviousInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Previous`)
|
||||
};
|
||||
|
||||
const zh_previous = /** @type {(inputs: PreviousInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`上一页`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Previous" |
|
||||
*
|
||||
* @param {PreviousInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const previous = /** @type {((inputs?: PreviousInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<PreviousInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_previous(inputs)
|
||||
return zh_previous(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Pricing ($ per 1M tokens)" |
|
||||
*
|
||||
* @param {PricingInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const pricing: ((inputs?: PricingInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<PricingInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type PricingInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} PricingInputs */
|
||||
|
||||
const en_pricing = /** @type {(inputs: PricingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Pricing ($ per 1M tokens)`)
|
||||
};
|
||||
|
||||
const zh_pricing = /** @type {(inputs: PricingInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`计费(每百万令牌美元)`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Pricing ($ per 1M tokens)" |
|
||||
*
|
||||
* @param {PricingInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const pricing = /** @type {((inputs?: PricingInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<PricingInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_pricing(inputs)
|
||||
return zh_pricing(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Search models by ID or name..." |
|
||||
*
|
||||
* @param {Search_Models_PlaceholderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const search_models_placeholder: ((inputs?: Search_Models_PlaceholderInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Search_Models_PlaceholderInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Search_Models_PlaceholderInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Search_Models_PlaceholderInputs */
|
||||
|
||||
const en_search_models_placeholder = /** @type {(inputs: Search_Models_PlaceholderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Search models by ID or name...`)
|
||||
};
|
||||
|
||||
const zh_search_models_placeholder = /** @type {(inputs: Search_Models_PlaceholderInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`按 ID 或名称搜索模型...`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Search models by ID or name..." |
|
||||
*
|
||||
* @param {Search_Models_PlaceholderInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const search_models_placeholder = /** @type {((inputs?: Search_Models_PlaceholderInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Search_Models_PlaceholderInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_search_models_placeholder(inputs)
|
||||
return zh_search_models_placeholder(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "tokens" |
|
||||
*
|
||||
* @param {TokensInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const tokens: ((inputs?: TokensInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<TokensInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type TokensInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} TokensInputs */
|
||||
|
||||
const en_tokens = /** @type {(inputs: TokensInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`tokens`)
|
||||
};
|
||||
|
||||
const zh_tokens = /** @type {(inputs: TokensInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`令牌`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "tokens" |
|
||||
*
|
||||
* @param {TokensInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const tokens = /** @type {((inputs?: TokensInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<TokensInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_tokens(inputs)
|
||||
return zh_tokens(inputs)
|
||||
});
|
||||
@@ -58,10 +58,51 @@ type SettingsTab =
|
||||
| 'notifications'
|
||||
| 'developer'
|
||||
|
||||
const VALID_SETTINGS_TABS: readonly SettingsTab[] = [
|
||||
'general',
|
||||
'transcode',
|
||||
'quotas',
|
||||
'skills',
|
||||
'mcp',
|
||||
'providers',
|
||||
'agents',
|
||||
'sandbox',
|
||||
'notifications',
|
||||
'developer',
|
||||
]
|
||||
|
||||
function getTabFromHash(): SettingsTab {
|
||||
if (typeof window === 'undefined') return 'general'
|
||||
const hash = window.location.hash.replace(/^#/, '')
|
||||
return (VALID_SETTINGS_TABS as readonly string[]).includes(hash)
|
||||
? (hash as SettingsTab)
|
||||
: 'general'
|
||||
}
|
||||
|
||||
function TeamSettingsPage() {
|
||||
const { teamId } = Route.useParams()
|
||||
const queryClient = useQueryClient()
|
||||
const [activeTab, setActiveTab] = useState<SettingsTab>('general')
|
||||
const [activeTab, setActiveTabState] = useState<SettingsTab>(getTabFromHash)
|
||||
|
||||
const handleTabChange = (tab: SettingsTab) => {
|
||||
setActiveTabState(tab)
|
||||
const newHash = tab === 'general' ? '' : `#${tab}`
|
||||
if (window.location.hash !== newHash) {
|
||||
window.history.replaceState(
|
||||
null,
|
||||
'',
|
||||
window.location.pathname + window.location.search + newHash,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onHashChange = () => {
|
||||
setActiveTabState(getTabFromHash())
|
||||
}
|
||||
window.addEventListener('hashchange', onHashChange)
|
||||
return () => window.removeEventListener('hashchange', onHashChange)
|
||||
}, [])
|
||||
const [profileName, setProfileName] = useState('')
|
||||
const [isCropOpen, setIsCropOpen] = useState(false)
|
||||
const [cropImageSrc, setCropImageSrc] = useState<string | null>(null)
|
||||
@@ -128,7 +169,7 @@ function TeamSettingsPage() {
|
||||
'sandbox',
|
||||
]
|
||||
if (me && me.role !== 'owner' && ownerOnlyTabs.includes(activeTab)) {
|
||||
setActiveTab('general')
|
||||
handleTabChange('general')
|
||||
}
|
||||
}, [me, activeTab])
|
||||
|
||||
@@ -295,7 +336,7 @@ function TeamSettingsPage() {
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('general')}
|
||||
onClick={() => handleTabChange('general')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'general'
|
||||
@@ -311,7 +352,7 @@ function TeamSettingsPage() {
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('notifications')}
|
||||
onClick={() => handleTabChange('notifications')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'notifications'
|
||||
@@ -327,7 +368,7 @@ function TeamSettingsPage() {
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('developer')}
|
||||
onClick={() => handleTabChange('developer')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'developer'
|
||||
@@ -350,7 +391,7 @@ function TeamSettingsPage() {
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('transcode')}
|
||||
onClick={() => handleTabChange('transcode')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'transcode'
|
||||
@@ -366,7 +407,7 @@ function TeamSettingsPage() {
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('quotas')}
|
||||
onClick={() => handleTabChange('quotas')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'quotas'
|
||||
@@ -391,7 +432,7 @@ function TeamSettingsPage() {
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('providers')}
|
||||
onClick={() => handleTabChange('providers')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'providers'
|
||||
@@ -407,7 +448,7 @@ function TeamSettingsPage() {
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('skills')}
|
||||
onClick={() => handleTabChange('skills')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'skills'
|
||||
@@ -423,7 +464,7 @@ function TeamSettingsPage() {
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('mcp')}
|
||||
onClick={() => handleTabChange('mcp')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'mcp'
|
||||
@@ -439,7 +480,7 @@ function TeamSettingsPage() {
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('agents')}
|
||||
onClick={() => handleTabChange('agents')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'agents'
|
||||
@@ -455,7 +496,7 @@ function TeamSettingsPage() {
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('sandbox')}
|
||||
onClick={() => handleTabChange('sandbox')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'sandbox'
|
||||
|
||||
Reference in New Issue
Block a user