mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
Zod: qualify records
This commit is contained in:
@@ -70,7 +70,7 @@ export namespace OpenAPI_Schema {
|
||||
format: z.string().optional(),
|
||||
|
||||
// [object] properties (recursively)
|
||||
properties: z.record(z.any() /* could refer to self using z.lazy().... */).optional(),
|
||||
properties: z.record(z.string(), z.any() /* could refer to self using z.lazy().... */).optional(),
|
||||
// [object] required properties
|
||||
required: z.array(z.string()).optional(),
|
||||
|
||||
@@ -315,7 +315,7 @@ export namespace AixWire_Tooling {
|
||||
*/
|
||||
input_schema: z.object({
|
||||
// type: z.literal('object'), // Note: every protocol adapter adds this in the structure, here's we're just opting to not add it
|
||||
properties: z.record(OpenAPI_Schema.Object_schema),
|
||||
properties: z.record(z.string(), OpenAPI_Schema.Object_schema),
|
||||
required: z.array(z.string()).optional(),
|
||||
}).optional(),
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ const fetchPageWorkerOutputSchema = z.object({
|
||||
url: z.string(),
|
||||
title: z.string(),
|
||||
|
||||
content: z.record(pageTransformSchema, z.string()).optional(), // either...
|
||||
content: z.partialRecord(pageTransformSchema, z.string()).optional(), // either...
|
||||
file: z.object({ // ...or
|
||||
mimeType: z.string(),
|
||||
encoding: z.literal('base64'),
|
||||
|
||||
@@ -28,7 +28,7 @@ const t2iCreateImageOutputSchema = z.object({
|
||||
|
||||
// origin
|
||||
generatorName: z.string(),
|
||||
parameters: z.record(z.any()),
|
||||
parameters: z.record(z.string(), z.any()),
|
||||
generatedAt: z.string(),
|
||||
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ const chatGptMessageSchema = z.object({
|
||||
id: z.string(),
|
||||
author: z.object({
|
||||
role: z.enum(['user', 'assistant', 'system', 'tool']),
|
||||
metadata: z.record(z.unknown()),
|
||||
metadata: z.record(z.string(), z.unknown()),
|
||||
}),
|
||||
create_time: z.optional(z.number()),
|
||||
content: z.object({
|
||||
@@ -16,7 +16,7 @@ const chatGptMessageSchema = z.object({
|
||||
status: z.string(),
|
||||
end_turn: z.optional(z.boolean()),
|
||||
weight: z.number(),
|
||||
metadata: z.record(z.unknown()),
|
||||
metadata: z.record(z.string(), z.unknown()),
|
||||
recipient: z.string(), // wazs: z.enum(['all', 'python']), but can be a plugin full name too
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ export const chatGptSharedChatSchema = z.object({
|
||||
title: z.string(),
|
||||
create_time: z.number(),
|
||||
update_time: z.number(),
|
||||
// mapping: z.record(chatGptNodeSchema), // comment out, to reduce the data transfer - 'duplicate' of linear_conversation
|
||||
// mapping: z.record(z.string(), chatGptNodeSchema), // comment out, to reduce the data transfer - 'duplicate' of linear_conversation
|
||||
moderation_results: z.array(z.unknown()),
|
||||
current_node: z.string(),
|
||||
is_public: z.boolean(),
|
||||
@@ -45,7 +45,7 @@ export const chatGptSharedChatSchema = z.object({
|
||||
description: z.string(),
|
||||
tags: z.array(z.string()),
|
||||
}),
|
||||
moderation_state: z.record(z.unknown()),
|
||||
moderation_state: z.record(z.string(), z.unknown()),
|
||||
});
|
||||
|
||||
export type ChatGptSharedChatSchema = z.infer<typeof chatGptSharedChatSchema>;
|
||||
|
||||
Reference in New Issue
Block a user