Skip to content

Commit

Permalink
Fix/schema omission (#993)
Browse files Browse the repository at this point in the history
  • Loading branch information
sceuick authored Aug 4, 2024
1 parent 94e000d commit 02b23d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,8 @@ export const schema = {
} satisfies Record<string, (...args: any[]) => JsonType>

export function toJsonSchema(body: JsonField[]): JsonSchema | undefined {
if (!Array.isArray(body && !body.length)) return
if (!Array.isArray(body) || !body.length) return
if (body.every((field) => field.disabled)) return

const schema: JsonSchema = {
title: 'Response',
Expand Down

0 comments on commit 02b23d1

Please sign in to comment.