Skip to content

Commit 0af44e3

Browse files
committed
feedback
1 parent 8ae6ff6 commit 0af44e3

File tree

3 files changed

+82
-59
lines changed

3 files changed

+82
-59
lines changed

app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/create_spec/+page.svelte renamed to app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/define_spec/+page.svelte

Lines changed: 78 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,28 @@
4141
// Get field configs for the current spec_type
4242
$: field_configs = spec_field_configs[spec_type] || []
4343
44+
let loading = false
45+
let loading_error: KilnError | null = null
46+
4447
onMount(async () => {
48+
loading = true
49+
4550
// Check if kiln-copilot is connected
4651
try {
4752
const { data, error } = await client.GET("/api/settings")
48-
if (!error && data && data["kiln_copilot_api_key"]) {
53+
if (error) {
54+
throw error
55+
}
56+
if (!data) {
57+
throw new Error("Failed to load Kiln settings")
58+
}
59+
if (data["kiln_copilot_api_key"]) {
4960
has_kiln_copilot = true
61+
} else {
62+
has_kiln_copilot = false
5063
}
5164
} catch (e) {
52-
console.error("Failed to check kiln-copilot status", e)
65+
loading_error = createKilnError(e)
5366
}
5467
5568
// Check for URL params first (fresh navigation from select_template)
@@ -67,6 +80,7 @@
6780
initial_property_values = { ...formData.property_values }
6881
evaluate_full_trace = formData.evaluate_full_trace
6982
initialized = true
83+
loading = false
7084
return
7185
}
7286
@@ -106,6 +120,7 @@
106120
}
107121
108122
initialized = true
123+
loading = false
109124
})
110125
111126
let next_error: KilnError | null = null
@@ -118,7 +133,6 @@
118133
let copilot_v_manual_dialog: Dialog | null = null
119134
let has_kiln_copilot = false
120135
let show_connect_kiln_steps = false
121-
let connect_steps_component: ConnectKilnCopilotSteps | null = null
122136
123137
$: void (name, property_values, initialized, update_warn_before_unload())
124138
@@ -255,63 +269,73 @@
255269
},
256270
]}
257271
>
258-
<FormContainer
259-
submit_label={has_kiln_copilot ? "Refine Spec with Copilot" : "Next"}
260-
on:submit={check_kiln_copilot_and_proceed}
261-
bind:error={next_error}
262-
bind:submitting
263-
{warn_before_unload}
264-
>
265-
<FormElement
266-
label="Spec Name"
267-
description="A short name for your own reference."
268-
id="spec_name"
269-
bind:value={name}
270-
/>
271-
272-
{#each field_configs as field (field.key)}
272+
{#if loading}
273+
<div class="w-full min-h-[50vh] flex justify-center items-center">
274+
<div class="loading loading-spinner loading-lg"></div>
275+
</div>
276+
{:else if loading_error}
277+
<div class="text-error text-sm">
278+
{loading_error.getMessage() || "An unknown error occurred"}
279+
</div>
280+
{:else}
281+
<FormContainer
282+
submit_label={has_kiln_copilot ? "Refine Spec with Copilot" : "Next"}
283+
on:submit={check_kiln_copilot_and_proceed}
284+
bind:error={next_error}
285+
bind:submitting
286+
{warn_before_unload}
287+
>
273288
<FormElement
274-
label={field.label}
275-
id={field.key}
276-
inputType="textarea"
277-
disabled={field.disabled || false}
278-
description={field.description}
279-
height={field.height || "base"}
280-
bind:value={property_values[field.key]}
281-
optional={!field.required}
282-
inline_action={initial_property_values[field.key]
283-
? {
284-
handler: () => reset_field(field.key),
285-
label: "Reset",
286-
}
287-
: undefined}
289+
label="Spec Name"
290+
description="A short name for your own reference."
291+
id="spec_name"
292+
bind:value={name}
288293
/>
289-
{/each}
290294

291-
{#if show_advanced_options}
292-
<Collapse title="Advanced Options">
295+
{#each field_configs as field (field.key)}
293296
<FormElement
294-
label="Include conversation history"
295-
id="evaluate_full_trace"
296-
inputType="checkbox"
297-
bind:value={evaluate_full_trace}
298-
disabled={full_trace_disabled}
299-
description="When enabled, this spec will be judged on the full conversation history including intermediate steps and tool calls. When disabled, only the final answer is evaluated."
300-
info_description={full_trace_disabled
301-
? "Tool use specs always evaluate the full conversation history to analyze tool calls."
302-
: "Enable this for specs that need to evaluate reasoning steps, tool usage, or intermediate outputs."}
297+
label={field.label}
298+
id={field.key}
299+
inputType="textarea"
300+
disabled={field.disabled || false}
301+
description={field.description}
302+
height={field.height || "base"}
303+
bind:value={property_values[field.key]}
304+
optional={!field.required}
305+
inline_action={initial_property_values[field.key]
306+
? {
307+
handler: () => reset_field(field.key),
308+
label: "Reset",
309+
}
310+
: undefined}
303311
/>
304-
</Collapse>
312+
{/each}
313+
314+
{#if show_advanced_options}
315+
<Collapse title="Advanced Options">
316+
<FormElement
317+
label="Include conversation history"
318+
id="evaluate_full_trace"
319+
inputType="checkbox"
320+
bind:value={evaluate_full_trace}
321+
disabled={full_trace_disabled}
322+
description="When enabled, this spec will be judged on the full conversation history including intermediate steps and tool calls. When disabled, only the final answer is evaluated."
323+
info_description={full_trace_disabled
324+
? "Tool use specs always evaluate the full conversation history to analyze tool calls."
325+
: "Enable this for specs that need to evaluate reasoning steps, tool usage, or intermediate outputs."}
326+
/>
327+
</Collapse>
328+
{/if}
329+
</FormContainer>
330+
{#if has_kiln_copilot}
331+
<div class="flex flex-row gap-1 mt-2 justify-end">
332+
<span class="text-xs text-gray-500">or</span>
333+
<button
334+
class="link underline text-xs text-gray-500"
335+
on:click={create_spec_from_form}>Create Spec Without Copilot</button
336+
>
337+
</div>
305338
{/if}
306-
</FormContainer>
307-
{#if has_kiln_copilot}
308-
<div class="flex flex-row gap-1 mt-2 justify-end">
309-
<span class="text-xs text-gray-500">or</span>
310-
<button
311-
class="link underline text-xs text-gray-500"
312-
on:click={create_spec_from_form}>Create Spec Without Copilot</button
313-
>
314-
</div>
315339
{/if}
316340
</AppPage>
317341
</div>
@@ -333,7 +357,6 @@
333357
{#if show_connect_kiln_steps}
334358
<div class="flex flex-col">
335359
<ConnectKilnCopilotSteps
336-
bind:this={connect_steps_component}
337360
showTitle={false}
338361
onSuccess={handle_connect_success}
339362
showCheckmark={has_kiln_copilot}

app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/create_spec/+page.ts renamed to app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/define_spec/+page.ts

File renamed without changes.

app/web_ui/src/routes/(app)/specs/[project_id]/[task_id]/select_template/+page.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
if (template_data.spec_type === "appropriate_tool_use") {
2727
tool_selection_dialog?.show()
2828
} else {
29-
go_to_create_spec(current_template_data)
29+
go_to_define_spec(current_template_data)
3030
}
3131
}
3232
}
3333
34-
async function go_to_create_spec(template_data: SpecTemplateData) {
34+
async function go_to_define_spec(template_data: SpecTemplateData) {
3535
current_params = new URLSearchParams()
3636
current_params.set("type", template_data.spec_type)
3737
if (template_data.spec_type === "appropriate_tool_use" && selected_tool) {
@@ -43,7 +43,7 @@
4343
current_params.set("tool_function_name", tool_function_name)
4444
}
4545
goto(
46-
`/specs/${project_id}/${task_id}/create_spec?${current_params.toString()}`,
46+
`/specs/${project_id}/${task_id}/define_spec?${current_params.toString()}`,
4747
)
4848
}
4949
@@ -92,7 +92,7 @@
9292
if (!current_template_data) {
9393
return false
9494
}
95-
await go_to_create_spec(current_template_data)
95+
await go_to_define_spec(current_template_data)
9696
return true
9797
},
9898
},

0 commit comments

Comments
 (0)