Skip to content
Merged
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
15 changes: 13 additions & 2 deletions web/src/app/playground/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Link from "next/link";
import { Shell } from "@/components/Shell";
import {
PlaygroundComposer,
type Message,
type PlaygroundSessionOut,
type PromptOption,
} from "@/components/PlaygroundClient";
Expand Down Expand Up @@ -34,7 +35,10 @@ interface PromptRow {
interface PromptVersionRow {
id: string;
version: number;
template: string;
/** Plan B onwards; absent on very old api versions. */
template_messages?: Message[];
/** Legacy field; absent eventually. */
template?: string;
}

interface PromptVersionList {
Expand Down Expand Up @@ -85,7 +89,14 @@ export default async function PlaygroundPage() {
versions: (versions.data?.versions ?? []).map((v) => ({
id: v.id,
version: v.version,
template: v.template,
// Prefer the structured field; fall back to wrapping the legacy
// template (defensive — Plan B's api always sends both).
template_messages:
v.template_messages ??
(v.template != null
? [{ role: "human" as const, content: v.template }]
: []),
template: v.template ?? "",
})),
};
}),
Expand Down
Loading
Loading