mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-01 14:52:25 +00:00
Upgrade to Zod v4 (#2605)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { ModelMessage } from "ai"
|
||||
import { unique } from "remeda"
|
||||
import type { JSONSchema } from "zod/v4/core"
|
||||
|
||||
export namespace ProviderTransform {
|
||||
function normalizeToolCallIds(msgs: ModelMessage[]): ModelMessage[] {
|
||||
@@ -112,4 +113,29 @@ export namespace ProviderTransform {
|
||||
}
|
||||
return outputLimit
|
||||
}
|
||||
|
||||
export function schema(_providerID: string, _modelID: string, schema: JSONSchema.BaseSchema) {
|
||||
/*
|
||||
if (["openai", "azure"].includes(providerID)) {
|
||||
if (schema.type === "object" && schema.properties) {
|
||||
for (const [key, value] of Object.entries(schema.properties)) {
|
||||
if (schema.required?.includes(key)) continue
|
||||
schema.properties[key] = {
|
||||
anyOf: [
|
||||
value as JSONSchema.JSONSchema,
|
||||
{
|
||||
type: "null",
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (providerID === "google") {
|
||||
}
|
||||
*/
|
||||
|
||||
return schema
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user