|
1 | 1 | <script lang="ts"> |
2 | 2 | import { goto } from "$app/navigation" |
3 | 3 | import { page } from "$app/stores" |
| 4 | + import { onMount } from "svelte" |
4 | 5 | import AppPage from "../../../../app_page.svelte" |
| 6 | + import { load_task } from "$lib/stores" |
| 7 | + import { checkDefaultRunConfigHasTools } from "../spec_utils" |
| 8 | + import { createKilnError, type KilnError } from "$lib/utils/error_handlers" |
5 | 9 |
|
6 | 10 | $: project_id = $page.params.project_id |
7 | 11 | $: task_id = $page.params.task_id |
8 | 12 |
|
| 13 | + let loading = true |
| 14 | + let default_run_config_has_tools = false |
| 15 | + let error: KilnError | null = null |
| 16 | +
|
| 17 | + onMount(async () => { |
| 18 | + try { |
| 19 | + const task = await load_task(project_id, task_id) |
| 20 | + if (!task) { |
| 21 | + throw new Error("Failed to load task") |
| 22 | + } |
| 23 | + default_run_config_has_tools = await checkDefaultRunConfigHasTools( |
| 24 | + project_id, |
| 25 | + task, |
| 26 | + ) |
| 27 | + } catch (e) { |
| 28 | + error = createKilnError(e) |
| 29 | + } finally { |
| 30 | + loading = false |
| 31 | + } |
| 32 | + }) |
| 33 | +
|
9 | 34 | function proceed_to_select_template() { |
10 | 35 | goto(`/specs/${project_id}/${task_id}/select_template`) |
11 | 36 | } |
|
24 | 49 | }, |
25 | 50 | ]} |
26 | 51 | > |
27 | | - <div class="my-4 max-w-[680px]"> |
28 | | - <div class="overflow-x-auto border-b"> |
29 | | - <table class="table table-fixed w-full"> |
| 52 | + {#if loading} |
| 53 | + <div class="w-full min-h-[50vh] flex justify-center items-center"> |
| 54 | + <div class="loading loading-spinner loading-lg"></div> |
| 55 | + </div> |
| 56 | + {:else if error} |
| 57 | + <div class="text-error text-sm"> |
| 58 | + {error.getMessage() || "An unknown error occurred"} |
| 59 | + </div> |
| 60 | + {:else} |
| 61 | + <div class="my-4 max-w-[680px]"> |
| 62 | + <div class="overflow-x-auto border-b"> |
| 63 | + <table class="table table-fixed w-full"> |
| 64 | + <colgroup> |
| 65 | + <col class="w-[240px]" /> |
| 66 | + <col /> |
| 67 | + <col /> |
| 68 | + </colgroup> |
| 69 | + <thead> |
| 70 | + <tr class="border-b-0"> |
| 71 | + <th></th> |
| 72 | + <th class="text-center text-lg">Manual</th> |
| 73 | + <th class="text-center text-lg"> |
| 74 | + <div class="flex items-center justify-center gap-2"> |
| 75 | + <img |
| 76 | + src="/images/animated_logo.svg" |
| 77 | + alt="Kiln Copilot" |
| 78 | + class="size-4" |
| 79 | + /> |
| 80 | + <span>Kiln Copilot</span> |
| 81 | + </div> |
| 82 | + </th> |
| 83 | + </tr> |
| 84 | + </thead> |
| 85 | + <tbody> |
| 86 | + <tr> |
| 87 | + <th class="font-bold text-xs text-gray-500" |
| 88 | + >Eval Judge Creation</th |
| 89 | + > |
| 90 | + <td class="text-center">Manual</td> |
| 91 | + <td class="text-center border-l">Automatic</td> |
| 92 | + </tr> |
| 93 | + <tr> |
| 94 | + <th class="font-bold text-xs text-gray-500" |
| 95 | + >Edge Case Discovery</th |
| 96 | + > |
| 97 | + <td class="text-center">Manual</td> |
| 98 | + <td class="text-center border-l">Automatic</td> |
| 99 | + </tr> |
| 100 | + <tr> |
| 101 | + <th class="font-bold text-xs text-gray-500" |
| 102 | + >Eval Data Creation</th |
| 103 | + > |
| 104 | + <td class="text-center">Manual</td> |
| 105 | + <td class="text-center border-l">Automatic</td> |
| 106 | + </tr> |
| 107 | + <tr> |
| 108 | + <th class="font-bold text-xs text-base-content/60" |
| 109 | + >Eval Accuracy</th |
| 110 | + > |
| 111 | + <td class="text-center">Varies</td> |
| 112 | + <td class="text-center border-l">High</td> |
| 113 | + </tr> |
| 114 | + <tr> |
| 115 | + <th class="font-bold text-xs text-gray-500">Approx. Effort</th> |
| 116 | + <td class="text-center">20 min</td> |
| 117 | + <td class="text-center border-l">3 min</td> |
| 118 | + </tr> |
| 119 | + <tr> |
| 120 | + <th class="font-bold text-xs text-base-content/60" |
| 121 | + >Kiln Account</th |
| 122 | + > |
| 123 | + <td class="text-center">Optional</td> |
| 124 | + <td class="text-center border-l">Required</td> |
| 125 | + </tr> |
| 126 | + </tbody> |
| 127 | + </table> |
| 128 | + </div> |
| 129 | + <table class="table-fixed w-full mt-4"> |
30 | 130 | <colgroup> |
31 | 131 | <col class="w-[240px]" /> |
32 | 132 | <col /> |
33 | 133 | <col /> |
34 | 134 | </colgroup> |
35 | | - <thead> |
36 | | - <tr class="border-b-0"> |
37 | | - <th></th> |
38 | | - <th class="text-center text-lg">Manual</th> |
39 | | - <th class="text-center text-lg"> |
40 | | - <div class="flex items-center justify-center gap-2"> |
41 | | - <img |
42 | | - src="/images/animated_logo.svg" |
43 | | - alt="Kiln Copilot" |
44 | | - class="size-4" |
45 | | - /> |
46 | | - <span>Kiln Copilot</span> |
47 | | - </div> |
48 | | - </th> |
49 | | - </tr> |
50 | | - </thead> |
51 | 135 | <tbody> |
52 | 136 | <tr> |
53 | | - <th class="font-bold text-xs text-gray-500" |
54 | | - >Eval Judge Creation</th |
55 | | - > |
56 | | - <td class="text-center">Manual</td> |
57 | | - <td class="text-center border-l">Automatic</td> |
58 | | - </tr> |
59 | | - <tr> |
60 | | - <th class="font-bold text-xs text-gray-500" |
61 | | - >Edge Case Discovery</th |
62 | | - > |
63 | | - <td class="text-center">Manual</td> |
64 | | - <td class="text-center border-l">Automatic</td> |
65 | | - </tr> |
66 | | - <tr> |
67 | | - <th class="font-bold text-xs text-gray-500">Eval Data Creation</th |
68 | | - > |
69 | | - <td class="text-center">Manual</td> |
70 | | - <td class="text-center border-l">Automatic</td> |
71 | | - </tr> |
72 | | - <tr> |
73 | | - <th class="font-bold text-xs text-base-content/60" |
74 | | - >Eval Accuracy</th |
75 | | - > |
76 | | - <td class="text-center">Varies</td> |
77 | | - <td class="text-center border-l">High</td> |
78 | | - </tr> |
79 | | - <tr> |
80 | | - <th class="font-bold text-xs text-gray-500">Approx. Effort</th> |
81 | | - <td class="text-center">20 min</td> |
82 | | - <td class="text-center border-l">3 min</td> |
83 | | - </tr> |
84 | | - <tr> |
85 | | - <th class="font-bold text-xs text-base-content/60" |
86 | | - >Kiln Account</th |
87 | | - > |
88 | | - <td class="text-center">Optional</td> |
89 | | - <td class="text-center border-l">Required</td> |
| 137 | + <td></td> |
| 138 | + <td class="text-center"> |
| 139 | + <button |
| 140 | + class="btn btn-outline btn-sm" |
| 141 | + on:click={proceed_to_select_template} |
| 142 | + > |
| 143 | + Create Manually |
| 144 | + </button> |
| 145 | + </td> |
| 146 | + <td class="text-center"> |
| 147 | + <div |
| 148 | + class="tooltip" |
| 149 | + data-tip={default_run_config_has_tools |
| 150 | + ? "Tool calling is not yet supported in Kiln Copilot. Please create the spec manually for now." |
| 151 | + : undefined} |
| 152 | + > |
| 153 | + <button |
| 154 | + class="btn btn-primary btn-sm" |
| 155 | + disabled={loading || default_run_config_has_tools} |
| 156 | + on:click={() => |
| 157 | + goto(`/specs/copilot_auth`, { |
| 158 | + replaceState: true, |
| 159 | + })} |
| 160 | + > |
| 161 | + Connect Kiln Copilot |
| 162 | + </button> |
| 163 | + </div> |
| 164 | + </td> |
90 | 165 | </tr> |
91 | 166 | </tbody> |
92 | 167 | </table> |
93 | 168 | </div> |
94 | | - <table class="table-fixed w-full mt-4"> |
95 | | - <colgroup> |
96 | | - <col class="w-[240px]" /> |
97 | | - <col /> |
98 | | - <col /> |
99 | | - </colgroup> |
100 | | - <tbody> |
101 | | - <tr> |
102 | | - <td></td> |
103 | | - <td class="text-center"> |
104 | | - <button |
105 | | - class="btn btn-outline btn-sm" |
106 | | - on:click={proceed_to_select_template} |
107 | | - > |
108 | | - Create Manually |
109 | | - </button> |
110 | | - </td> |
111 | | - <td class="text-center"> |
112 | | - <button |
113 | | - class="btn btn-primary btn-sm" |
114 | | - on:click={() => |
115 | | - goto(`/specs/copilot_auth`, { |
116 | | - replaceState: true, |
117 | | - })} |
118 | | - > |
119 | | - Connect Kiln Copilot |
120 | | - </button> |
121 | | - </td> |
122 | | - </tr> |
123 | | - </tbody> |
124 | | - </table> |
125 | | - </div> |
| 169 | + {/if} |
126 | 170 | </AppPage> |
127 | 171 | </div> |
0 commit comments