Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.
TypeScript agent-harnessagent-harness-engineeringai-engineeringai-observabilityamd-gpuclaude-codeclickhousecodexcoding-agentcoding-agentscursorgenaigpu-monitoringllm-observabilityllmopsnvidia-smiobservabilityopen-sourceopenaiopentelemetry
[Fix]: New line unescaped from string in Prompt Hub (#536)
Aman Agarwal32a98abb0473
diff --git a/src/client/package-lock.json b/src/client/package-lock.jsonindex cf9a43b5..e9c69b8b 100644--- a/src/client/package-lock.json+++ b/src/client/package-lock.json@@ -1,12 +1,12 @@{"name": "openlit",- "version": "1.11.5",+ "version": "1.11.6","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "openlit",- "version": "1.11.5",+ "version": "1.11.6","dependencies": {"@anthropic-ai/sdk": "^0.21.1","@clickhouse/client": "^1.1.0",diff --git a/src/client/package.json b/src/client/package.jsonindex ef9d0aac..ec6dd50e 100644--- a/src/client/package.json+++ b/src/client/package.json@@ -1,6 +1,6 @@{"name": "openlit",- "version": "1.11.5",+ "version": "1.11.6","private": true,"scripts": {"dev": "next dev",diff --git a/src/client/src/app/(playground)/prompt-hub/[id]/page.tsx b/src/client/src/app/(playground)/prompt-hub/[id]/page.tsxindex 47944f16..df9f37db 100644--- a/src/client/src/app/(playground)/prompt-hub/[id]/page.tsx+++ b/src/client/src/app/(playground)/prompt-hub/[id]/page.tsx@@ -15,6 +15,7 @@ import { useRootStore } from "@/store";import useFetchWrapper from "@/utils/hooks/useFetchWrapper";import { jsonParse } from "@/utils/json";import { objectEntries } from "@/utils/object";+import { unescapeString } from "@/utils/string";import { format, formatDistance } from "date-fns";import { CalendarDays, CloudDownload, Rocket } from "lucide-react";import Link from "next/link";@@ -190,8 +191,8 @@ export default function PromptHub() {<h3 className="text-sm text-stone-500 mb-2 dark:text-stone-400">Prompt</h3>- <div className="flex bg-stone-100 dark:bg-stone-900 text-stone-500 dark:text-stone-300 p-4 gap-8">- {updatedData.prompt}+ <div className="flex bg-stone-100 dark:bg-stone-900 text-stone-500 dark:text-stone-300 p-4 gap-8 whitespace-pre-wrap">+ {unescapeString(updatedData.prompt)}</div></div>{metaPropertiesMap.length > 0 ? (diff --git a/src/client/src/components/(playground)/prompt-hub/form.tsx b/src/client/src/components/(playground)/prompt-hub/form.tsxindex 2cb5367f..1db88027 100644--- a/src/client/src/components/(playground)/prompt-hub/form.tsx+++ b/src/client/src/components/(playground)/prompt-hub/form.tsx@@ -15,6 +15,7 @@ import { PromptInput, PromptUpdate } from "@/constants/prompts";import useFetchWrapper from "@/utils/hooks/useFetchWrapper";import { jsonParse } from "@/utils/json";import { objectEntries } from "@/utils/object";+import { unescapeString } from "@/utils/string";import { useRouter } from "next/navigation";import { usePostHog } from "posthog-js/react";import { KeyboardEvent, useCallback, useState } from "react";@@ -209,7 +210,7 @@ export default function PromptForm({fieldTypeProps: {name: "prompt",placeholder: "How can I assist you?",- defaultValue: versionData?.prompt,+ defaultValue: unescapeString(versionData?.prompt || ""),},},{diff --git a/src/client/src/lib/platform/prompt/compiled.ts b/src/client/src/lib/platform/prompt/compiled.tsindex 9e7fe3ab..e316fcd2 100644--- a/src/client/src/lib/platform/prompt/compiled.ts+++ b/src/client/src/lib/platform/prompt/compiled.ts@@ -7,6 +7,7 @@ import { updateDownloadDetails } from "./version";import { jsonParse } from "@/utils/json";import { throwIfError } from "@/utils/error";import getMessage from "@/constants/messages";+import { unescapeString } from "@/utils/string";function compilePrompt(prompt: string,@@ -66,6 +67,7 @@ export async function getCompiledPrompt(promptObject.metaProperties = jsonParse(promptObject.metaProperties);promptObject.tags = jsonParse(promptObject.tags);+ promptObject.prompt = unescapeString(promptObject.prompt);if (promptCompiledInput.shouldCompile === false) {promptObject.compiledPrompt = promptObject.prompt;diff --git a/src/client/src/utils/string.ts b/src/client/src/utils/string.tsnew file mode 100644index 00000000..85d6c127--- /dev/null+++ b/src/client/src/utils/string.ts@@ -0,0 +1 @@+export const unescapeString = (str: string) => str.replace(/\\n/g, "\n");