diff --git a/app/web_ui/src/lib/utils/json_schema_editor/json_schema_form_element.svelte b/app/web_ui/src/lib/utils/json_schema_editor/json_schema_form_element.svelte index 715e0ee..b6ac624 100644 --- a/app/web_ui/src/lib/utils/json_schema_editor/json_schema_form_element.svelte +++ b/app/web_ui/src/lib/utils/json_schema_editor/json_schema_form_element.svelte @@ -6,7 +6,7 @@ let validation_errors: string[] = [] let id = Math.random().toString(36) - export let schema_model: SchemaModel = empty_schema_model + export let schema_model: SchemaModel = empty_schema_model() async function add_property() { schema_model.properties.push({ diff --git a/app/web_ui/src/lib/utils/json_schema_editor/json_schema_templates.ts b/app/web_ui/src/lib/utils/json_schema_editor/json_schema_templates.ts index 86b5593..27d763b 100644 --- a/app/web_ui/src/lib/utils/json_schema_editor/json_schema_templates.ts +++ b/app/web_ui/src/lib/utils/json_schema_editor/json_schema_templates.ts @@ -76,19 +76,23 @@ export function schema_from_model(m: SchemaModel): JsonSchema { } } -export const empty_schema_model: SchemaModel = { - properties: [], +export function empty_schema_model(): SchemaModel { + return { + properties: [], + } } -export const empty_schema: JsonSchema = schema_from_model(empty_schema_model) +export const empty_schema: JsonSchema = schema_from_model(empty_schema_model()) -export const example_schema_model: SchemaModel = { - properties: [ - { - title: "Example Property", - description: "Replace this with your own property", - type: "string", - required: true, - }, - ], +export function example_schema_model(): SchemaModel { + return { + properties: [ + { + title: "Example Property", + description: "Replace this with your own property", + type: "string", + required: true, + }, + ], + } } diff --git a/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/+page.svelte b/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/+page.svelte index ab76e80..db022b3 100644 --- a/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/+page.svelte +++ b/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/+page.svelte @@ -8,8 +8,8 @@ let task_description = "" let task_instructions = "" let task_requirements: TaskRequirement[] = [] - let task_input_schema: SchemaModel = example_schema_model - let task_output_schema: SchemaModel = example_schema_model + let task_input_schema: SchemaModel = example_schema_model() + let task_output_schema: SchemaModel = example_schema_model() let task_input_plaintext = true let task_output_plaintext = true let editTaskComponent: EditTask diff --git a/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/edit_task.svelte b/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/edit_task.svelte index 1757a87..0419e5d 100644 --- a/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/edit_task.svelte +++ b/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/edit_task.svelte @@ -25,9 +25,9 @@ export let task_instructions: string = "" export let task_requirements: TaskRequirement[] = [] export let task_input_plaintext = true - export let task_input_schema: SchemaModel = example_schema_model + export let task_input_schema: SchemaModel = example_schema_model() export let task_output_plaintext = true - export let task_output_schema: SchemaModel = example_schema_model + export let task_output_schema: SchemaModel = example_schema_model() let error: KilnError | null = null let submitting = false diff --git a/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/schema_section.svelte b/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/schema_section.svelte index 9fc85b2..9cb2a59 100644 --- a/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/schema_section.svelte +++ b/app/web_ui/src/routes/(fullscreen)/setup/(setup)/create_task/schema_section.svelte @@ -3,7 +3,7 @@ import type { SchemaModel } from "$lib/utils/json_schema_editor/json_schema_templates" import { empty_schema_model } from "$lib/utils/json_schema_editor/json_schema_templates" - export let schema_model: SchemaModel = empty_schema_model + export let schema_model: SchemaModel = empty_schema_model() export let plaintext: boolean = true let id = Math.random().toString(36)