From b4c3adde127931dc51f67fa11157c341a93e089a Mon Sep 17 00:00:00 2001 From: John Smith Date: Tue, 10 Dec 2024 12:40:57 +1030 Subject: [PATCH] chore: Include invocation result (#265) - Include invocation result in message endpoint - Remove `public` from run-configs --- .../configs/[promptId]/edit/page.tsx | 4 - .../clusters/[clusterId]/configs/new/page.tsx | 3 - app/client/contract.ts | 4 - app/components/chat/prompt-template-form.tsx | 34 - app/components/workflow.tsx | 4 +- control-plane/drizzle/0191_perfect_wasp.sql | 1 + control-plane/drizzle/meta/0191_snapshot.json | 1632 +++++++++++++++++ control-plane/drizzle/meta/_journal.json | 7 + control-plane/src/modules/contract.ts | 4 - control-plane/src/modules/data.ts | 1 - control-plane/src/modules/prompt-templates.ts | 11 +- control-plane/src/modules/router.ts | 4 - .../modules/workflows/workflow-messages.ts | 1 - 13 files changed, 1644 insertions(+), 66 deletions(-) create mode 100644 control-plane/drizzle/0191_perfect_wasp.sql create mode 100644 control-plane/drizzle/meta/0191_snapshot.json diff --git a/app/app/clusters/[clusterId]/configs/[promptId]/edit/page.tsx b/app/app/clusters/[clusterId]/configs/[promptId]/edit/page.tsx index 40ed8bde..50c60ba2 100644 --- a/app/app/clusters/[clusterId]/configs/[promptId]/edit/page.tsx +++ b/app/app/clusters/[clusterId]/configs/[promptId]/edit/page.tsx @@ -77,7 +77,6 @@ export default function EditPromptTemplate({ initialPrompt?: string; systemPrompt?: string; attachedFunctions: string; - public: boolean; resultSchema?: string; inputSchema?: string; }) => { @@ -90,7 +89,6 @@ export default function EditPromptTemplate({ systemPrompt: formData.systemPrompt === "" ? undefined : formData.systemPrompt, name: formData.name === "" ? undefined : formData.name, - public: formData.public, resultSchema: formData.resultSchema ? JSON.parse(formData.resultSchema) : undefined, @@ -195,7 +193,6 @@ export default function EditPromptTemplate({ attachedFunctions: version.attachedFunctions, resultSchema: version.resultSchema, inputSchema: version.inputSchema, - public: version.public, }); setSelectedVersion(version.version); toast.success( @@ -231,7 +228,6 @@ export default function EditPromptTemplate({ initialPrompt: promptTemplate.initialPrompt ?? undefined, systemPrompt: promptTemplate.systemPrompt ?? undefined, attachedFunctions: promptTemplate.attachedFunctions, - public: promptTemplate.public, resultSchema: promptTemplate.resultSchema ? promptTemplate.resultSchema : undefined, diff --git a/app/app/clusters/[clusterId]/configs/new/page.tsx b/app/app/clusters/[clusterId]/configs/new/page.tsx index 0a86f5ab..0f3c8e4c 100644 --- a/app/app/clusters/[clusterId]/configs/new/page.tsx +++ b/app/app/clusters/[clusterId]/configs/new/page.tsx @@ -21,7 +21,6 @@ export default function NewPromptTemplate({ name: string; initialPrompt?: string; systemPrompt?: string; - public: boolean; attachedFunctions: string; resultSchema?: string; inputSchema?: string; @@ -41,7 +40,6 @@ export default function NewPromptTemplate({ formData.initialPrompt === "" ? undefined : formData.initialPrompt, systemPrompt: formData.systemPrompt === "" ? undefined : formData.systemPrompt, - public: formData.public, resultSchema: formData.resultSchema ? JSON.parse(formData.resultSchema) : undefined, @@ -94,7 +92,6 @@ export default function NewPromptTemplate({ initialData={{ name: "", initialPrompt: "", - public: false, attachedFunctions: [], }} onSubmit={handleSubmit} diff --git a/app/client/contract.ts b/app/client/contract.ts index f8d3410a..97757fe3 100644 --- a/app/client/contract.ts +++ b/app/client/contract.ts @@ -1092,7 +1092,6 @@ export const definition = { attachedFunctions: z.array(z.string()), resultSchema: anyObject.nullable(), inputSchema: anyObject.nullable(), - public: z.boolean(), createdAt: z.date(), updatedAt: z.date(), versions: z.array( @@ -1104,7 +1103,6 @@ export const definition = { attachedFunctions: z.array(z.string()), resultSchema: anyObject.nullable(), inputSchema: anyObject.nullable(), - public: z.boolean(), }), ), }), @@ -1133,7 +1131,6 @@ export const definition = { attachedFunctions: z.array(z.string()).optional(), resultSchema: anyObject.optional(), inputSchema: z.object({}).passthrough().optional().nullable(), - public: z.boolean(), }), responses: { 201: z.object({ id: z.string() }), @@ -1161,7 +1158,6 @@ export const definition = { attachedFunctions: z.array(z.string()).optional(), resultSchema: z.object({}).passthrough().optional().nullable(), inputSchema: z.object({}).passthrough().optional().nullable(), - public: z.boolean(), }), responses: { 200: z.object({ diff --git a/app/components/chat/prompt-template-form.tsx b/app/components/chat/prompt-template-form.tsx index b87dd118..507e6a3c 100644 --- a/app/components/chat/prompt-template-form.tsx +++ b/app/components/chat/prompt-template-form.tsx @@ -17,7 +17,6 @@ import { Button } from "../ui/button"; import { Input } from "../ui/input"; import { Textarea } from "../ui/textarea"; import { StructuredOutputEditor } from "./structured-output-editor"; -import { Switch } from "../ui/switch"; import Link from "next/link"; const formSchema = z.object({ @@ -27,7 +26,6 @@ const formSchema = z.object({ attachedFunctions: z.string(), resultSchema: z.string().optional(), inputSchema: z.string().optional(), - public: z.boolean().default(false), }); type PromptTemplateFormProps = { @@ -38,7 +36,6 @@ type PromptTemplateFormProps = { attachedFunctions: string[]; resultSchema?: unknown; inputSchema?: unknown; - public: boolean; }; onSubmit: (data: z.infer) => Promise; isLoading: boolean; @@ -58,7 +55,6 @@ export function PromptTemplateForm({ attachedFunctions: initialData.attachedFunctions?.join(", "), resultSchema: JSON.stringify(initialData.resultSchema, null, 2), inputSchema: JSON.stringify(initialData.inputSchema, null, 2), - public: initialData.public, }, }); @@ -252,36 +248,6 @@ export function PromptTemplateForm({ )} /> - ( - - Public (Front end usage) - - Should this Run Configuration be avilable for use from front end - applications. -
- Please see our{" "} - - docs - {" "} - for more information -
- - - - -
- )} - /> diff --git a/app/components/workflow.tsx b/app/components/workflow.tsx index b3e28398..5df347f6 100644 --- a/app/components/workflow.tsx +++ b/app/components/workflow.tsx @@ -269,7 +269,9 @@ export function Run({ })) || []; const eventElements = - runTimeline?.messages.map((m) => ({ + runTimeline?.messages + .filter((m) => ["human", "agent", "template"].includes(m.type)) + .map((m) => ({ element: (