🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(prompts): render all prompt types correctly and fallback on json (#1625)
Marc Klingen0eead0360e74
diff --git a/web/src/features/prompts/components/NewPromptForm/index.tsx b/web/src/features/prompts/components/NewPromptForm/index.tsxindex c544972a5d..bed764c1d1 100644--- a/web/src/features/prompts/components/NewPromptForm/index.tsx+++ b/web/src/features/prompts/components/NewPromptForm/index.tsx@@ -209,7 +209,6 @@ export const NewPromptForm: React.FC<NewPromptFormProps> = (props) => {onValueChange={(e) => {form.setValue("type", e as PromptType);}}- className="min-h-[240px]">{!initialPrompt ? (<TabsList className="flex w-full">@@ -244,7 +243,7 @@ export const NewPromptForm: React.FC<NewPromptFormProps> = (props) => {<FormControl><Textarea{...field}- className="min-h-[150px] flex-1 font-mono text-xs"+ className="min-h-[200px] flex-1 font-mono text-xs"/></FormControl><FormMessage />diff --git a/web/src/features/prompts/components/prompt-detail.tsx b/web/src/features/prompts/components/prompt-detail.tsxindex f0efd32b5a..4c41b896bf 100644--- a/web/src/features/prompts/components/prompt-detail.tsx+++ b/web/src/features/prompts/components/prompt-detail.tsx@@ -44,8 +44,9 @@ export const PromptDetail = () => {): promptHistory.data?.[0];- const promptString = JSON.stringify(prompt?.prompt?.valueOf(), null, 2);- const extractedVariables = prompt ? extractVariables(promptString) : [];+ const extractedVariables = prompt+ ? extractVariables(JSON.stringify(prompt.prompt))+ : [];let chatMessages: z.infer<typeof ChatMlArraySchema> | null = null;try {@@ -129,8 +130,10 @@ export const PromptDetail = () => {<div className="col-span-2 md:h-full">{prompt.type === PromptType.Chat && chatMessages ? (<OpenAiMessageView title="Chat prompt" messages={chatMessages} />+ ) : typeof prompt.prompt === "string" ? (+ <CodeView content={prompt.prompt} title="Text prompt" />) : (- <CodeView content={promptString} title="Text prompt" />+ <JSONView json={prompt.prompt} title="Prompt" />)}<div className="mx-auto mt-5 w-full rounded-lg border text-base leading-7"><div className="border-b px-3 py-1 text-xs font-medium">