Skip to content

Commit

Permalink
Fix templates. Need to each be a unique copy
Browse files Browse the repository at this point in the history
  • Loading branch information
scosman committed Oct 8, 2024
1 parent 5bc62f0 commit a15c861
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
],
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
</script>
Expand Down

0 comments on commit a15c861

Please sign in to comment.