The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(pruef): 3D test models land in both studio registries
purple1d70bfb36540
diff --git a/src/lib/three/__tests__/cloud-picture-first.test.ts b/src/lib/three/__tests__/cloud-picture-first.test.tsindex 7b6e33da..33959c41 100644--- a/src/lib/three/__tests__/cloud-picture-first.test.ts+++ b/src/lib/three/__tests__/cloud-picture-first.test.ts@@ -3,7 +3,7 @@// stopped second run keeps the picture.import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'import schemas from '../../render/provider-schemas.json'-import { STUDIO_MODELS, type Schema } from '../../render/studio-contract'+import { STUDIO_MODELS, STUDIO_MODELS_WITH_RETIRED, type Schema } from '../../render/studio-contract'import { useCloudCatalogStore } from '../../../stores/cloudCatalogStore'import { checkPromptSafety } from '../../render/safety'import { installContentPolicyCap } from '../../content-policy-cap'@@ -21,7 +21,7 @@ const OPEN = { id: 'z-image', label: 'Z-Image Base', kind: 'image', adult: true,const CAPPED = { id: 'qwen-image-2.1', label: 'Qwen Image 2.1', kind: 'image', quote_required: true, tier: 'best', weights: 'open' }beforeAll(() => {- undo = installThreeDStudio(STUDIO_MODELS, schemas as Record<string, Schema>)+ undo = installThreeDStudio(STUDIO_MODELS, schemas as Record<string, Schema>, STUDIO_MODELS_WITH_RETIRED)catalogBefore = useCloudCatalogStore.getState().models})afterAll(() => {diff --git a/src/mobile/screens/create/__tests__/fixtures/three-d-models.ts b/src/mobile/screens/create/__tests__/fixtures/three-d-models.tsindex 8f7a369f..aa975348 100644--- a/src/mobile/screens/create/__tests__/fixtures/three-d-models.ts+++ b/src/mobile/screens/create/__tests__/fixtures/three-d-models.ts@@ -61,12 +61,27 @@ export function threeDCatalogEntries(): { id: string; label: string; kind: '3d';return Object.entries(THREE_D_STUDIO).map(([id, m]) => ({ id, label: m.label, kind: '3d', adult: m.adult, ops: ['studio'], quote_required: true, tier: m.tier, weights: m.weights }))}-/** Put the three into the registry objects the app reads. Returns the undo. */-export function installThreeDStudio(models: Record<string, StudioModel>, schemas: Record<string, Schema>): () => void {- Object.assign(models, THREE_D_STUDIO)+/** Put the three into the registry objects the app reads. Returns the undo.+ * `withRetired` is STUDIO_MODELS_WITH_RETIRED: since the catalogue sync of+ * 3.1.0 it is an object of its own next to STUDIO_MODELS, and studioSchema+ * reads the endpoint from it. The undo puts back what stood there before,+ * because some of the three ids are real catalogue entries now. */+export function installThreeDStudio(models: Record<string, StudioModel>, schemas: Record<string, Schema>, withRetired?: Record<string, StudioModel>): () => void {+ const targets = withRetired && withRetired !== models ? [models, withRetired] : [models]+ const before = targets.map((t) => Object.fromEntries(Object.keys(THREE_D_STUDIO).map((id) => [id, t[id]])))+ const schemasBefore = Object.fromEntries(Object.keys(THREE_D_SCHEMAS).map((path) => [path, schemas[path]]))+ for (const t of targets) Object.assign(t, THREE_D_STUDIO)Object.assign(schemas, THREE_D_SCHEMAS)return () => {- for (const id of Object.keys(THREE_D_STUDIO)) delete models[id]- for (const path of Object.keys(THREE_D_SCHEMAS)) delete schemas[path]+ targets.forEach((t, i) => {+ for (const [id, m] of Object.entries(before[i])) {+ if (m) t[id] = m+ else delete t[id]+ }+ })+ for (const [path, sc] of Object.entries(schemasBefore)) {+ if (sc) schemas[path] = sc+ else delete schemas[path]+ }}}diff --git a/src/mobile/screens/create/__tests__/three-d-picture-first.test.ts b/src/mobile/screens/create/__tests__/three-d-picture-first.test.tsindex 518a53bb..411803c7 100644--- a/src/mobile/screens/create/__tests__/three-d-picture-first.test.ts+++ b/src/mobile/screens/create/__tests__/three-d-picture-first.test.ts@@ -4,7 +4,7 @@*/import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'import schemas from '../../../../lib/render/provider-schemas.json'-import { STUDIO_MODELS, type Schema } from '../../../../lib/render/studio-contract'+import { STUDIO_MODELS, STUDIO_MODELS_WITH_RETIRED, type Schema } from '../../../../lib/render/studio-contract'import { useCloudCatalogStore } from '../../../../stores/cloudCatalogStore'import { useCreateStore } from '../../../../stores/createStore'import { installContentPolicyCap } from '../../../../lib/content-policy-cap'@@ -22,7 +22,7 @@ let undo: () => void = () => {}let catalogBefore: ReturnType<typeof useCloudCatalogStore.getState>['models']beforeAll(() => {- undo = installThreeDStudio(STUDIO_MODELS, schemas as Record<string, Schema>)+ undo = installThreeDStudio(STUDIO_MODELS, schemas as Record<string, Schema>, STUDIO_MODELS_WITH_RETIRED)catalogBefore = useCloudCatalogStore.getState().models})afterAll(() => {diff --git a/src/mobile/screens/create/__tests__/three-d.test.ts b/src/mobile/screens/create/__tests__/three-d.test.tsindex 41f1d4c7..3ae37da6 100644--- a/src/mobile/screens/create/__tests__/three-d.test.ts+++ b/src/mobile/screens/create/__tests__/three-d.test.ts@@ -25,7 +25,7 @@ vi.mock('../parts/photos', async () => {})import schemas from '../../../../lib/render/provider-schemas.json'-import { STUDIO_MODELS, type Schema } from '../../../../lib/render/studio-contract'+import { STUDIO_MODELS, STUDIO_MODELS_WITH_RETIRED, type Schema } from '../../../../lib/render/studio-contract'import { useCloudCatalogStore } from '../../../../stores/cloudCatalogStore'import { useCreateStore } from '../../../../stores/createStore'import { checkPromptSafety, SAFETY_BLOCK_MESSAGE } from '../../../../lib/render/safety'@@ -47,7 +47,7 @@ let undo: () => void = () => {}let catalogBefore: ReturnType<typeof useCloudCatalogStore.getState>['models']beforeAll(() => {- undo = installThreeDStudio(STUDIO_MODELS, schemas as Record<string, Schema>)+ undo = installThreeDStudio(STUDIO_MODELS, schemas as Record<string, Schema>, STUDIO_MODELS_WITH_RETIRED)catalogBefore = useCloudCatalogStore.getState().models})afterAll(() => {