Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
import { load_task_prompts } from "$lib/stores/prompts_store"
import { load_task_run_configs } from "$lib/stores/run_configs_store"

export const prerender = false

// Runs on every navigation (including same-route param changes), so the stores
// are always fresh when the component reads them — fixes stale-data bug when
// navigating between detail pages for entities created mid-session.
export async function load({
params,
}: {
params: { project_id: string; task_id: string }
}) {
await Promise.all([
load_task_run_configs(params.project_id, params.task_id, true),
load_task_prompts(params.project_id, params.task_id, true),
])
}
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
import { load_task_prompts } from "$lib/stores/prompts_store"

export const prerender = false

// Runs on every navigation (including same-route param changes), so the store
// is always fresh when the component reads it — fixes stale-data bug when
// navigating between detail pages for entities created mid-session.
export async function load({
params,
}: {
params: { project_id: string; task_id: string }
}) {
await load_task_prompts(params.project_id, params.task_id, true)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { page } from "$app/stores"
import { current_task, current_task_prompts } from "$lib/stores"
import { get_task_composite_id } from "$lib/stores"
import { prompts_by_task_composite_id } from "$lib/stores/prompts_store"
import AppPage from "../../../../../app_page.svelte"
import Output from "$lib/ui/output.svelte"
import { formatDate } from "$lib/utils/formatters"
Expand All @@ -15,9 +16,10 @@
description: `Saved prompt detail for prompt ID ${prompt_id} in project ID ${project_id}, task ID ${task_id}. Prompt name: ${prompt_model?.name ?? "[loading]"}. Shows prompt content, version history, and options to clone or edit.`,
})

$: prompt_model = $current_task_prompts?.prompts.find(
(prompt) => prompt.id === prompt_id,
)
$: prompt_model =
$prompts_by_task_composite_id[
get_task_composite_id(project_id, task_id)
]?.prompts.find((p) => p.id === prompt_id) ?? null

let prompt_props: Record<string, string | undefined | null> = {}
$: {
Expand Down Expand Up @@ -72,17 +74,7 @@
: []),
]}
>
{#if !$current_task_prompts}
<div class="w-full min-h-[50vh] flex justify-center items-center">
<div class="loading loading-spinner loading-lg"></div>
</div>
{:else if $current_task?.id != task_id}
<div class="text-error">
This link is to another task's prompt. Either select that task in the
sidebar, or click 'Prompts' in the sidebar to load the current task's
prompts.
</div>
{:else if prompt_model}
{#if prompt_model}
<div class="flex flex-col xl:flex-row gap-8 xl:gap-16 mb-8">
<div class="grow">
<div class="text-xl font-bold mb-2">Prompt</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
import { load_task_prompts } from "$lib/stores/prompts_store"

export const prerender = false

// Runs on every navigation (including same-route param changes), so the store
// is always fresh when the component reads it — fixes stale-data bug when
// navigating between detail pages for entities created mid-session.
export async function load({
params,
}: {
params: { project_id: string; task_id: string }
}) {
await load_task_prompts(params.project_id, params.task_id, true)
}
Loading