mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-30 21:04:59 +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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user