Files
simstudioai--sim/apps/sim/lib/api/contracts/tools/quiver.ts
T
wehub-resource-sync d25d482dc2
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

50 lines
1.6 KiB
TypeScript

import { z } from 'zod'
import { genericToolResponseSchema } from '@/lib/api/contracts/tools/shared'
import { defineRouteContract } from '@/lib/api/contracts/types'
import { FileInputSchema } from '@/lib/uploads/utils/file-schemas'
const quiverCommonBodySchema = z.object({
apiKey: z.string().min(1),
model: z.string().min(1),
temperature: z.number().min(0).max(2).optional().nullable(),
top_p: z.number().min(0).max(1).optional().nullable(),
max_output_tokens: z.number().int().min(1).max(131072).optional().nullable(),
presence_penalty: z.number().min(-2).max(2).optional().nullable(),
})
export const quiverTextToSvgBodySchema = quiverCommonBodySchema.extend({
prompt: z.string().min(1),
instructions: z.string().optional().nullable(),
references: z
.union([z.array(FileInputSchema), FileInputSchema, z.string()])
.optional()
.nullable(),
n: z.number().int().min(1).max(16).optional().nullable(),
})
export const quiverImageToSvgBodySchema = quiverCommonBodySchema.extend({
image: z.union([FileInputSchema, z.string()]),
auto_crop: z.boolean().optional().nullable(),
target_size: z.number().int().min(128).max(4096).optional().nullable(),
})
export const quiverTextToSvgContract = defineRouteContract({
method: 'POST',
path: '/api/tools/quiver/text-to-svg',
body: quiverTextToSvgBodySchema,
response: {
mode: 'json',
schema: genericToolResponseSchema,
},
})
export const quiverImageToSvgContract = defineRouteContract({
method: 'POST',
path: '/api/tools/quiver/image-to-svg',
body: quiverImageToSvgBodySchema,
response: {
mode: 'json',
schema: genericToolResponseSchema,
},
})