Skip to content

Open source CapCut alternative.

TypeScript

refactor(site): allow model-neutral inference requests

David Le16ada85254db
diff --git a/site/src/lib/inference/schemas.ts b/site/src/lib/inference/schemas.ts
index 41b75ecf..740e54b3 100644
--- a/site/src/lib/inference/schemas.ts
+++ b/site/src/lib/inference/schemas.ts
@@ -19,6 +19,9 @@ export const modelsQuerySchema = z.object({
output_modalities: z.string().optional(),
});
+// Model is optional, exactly like `responseCreateRequestSchema`: a model-neutral caller (the notch reply
+// stream, the request-understanding stream) omits it and the provider resolves its default. Keeping the two
+// schemas symmetric is what lets the same caller stay provider-neutral whether it streams or not.
export const chatCompletionRequestSchema = z
.object({
messages: z.array(jsonObjectSchema).min(1),
@@ -29,16 +32,7 @@ export const chatCompletionRequestSchema = z
provider: jsonObjectSchema.optional(),
metadata: metadataSchema.optional(),
})
- .passthrough()
- .superRefine((value, context) => {
- if (!value.model && !value.models?.length) {
- context.addIssue({
- code: "custom",
- message: "Either model or models is required.",
- path: ["model"],
- });
- }
- });
+ .passthrough();
export const responsesProviderSelectionSchema = z.enum(["openai", "gemini"]);