Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(prompts): trim prompt names (#6145)

Marc Klingen909445ce5bd1
diff --git a/web/src/features/prompts/server/utils/validation.ts b/web/src/features/prompts/server/utils/validation.ts
index a5c1298f7e..e5467850b9 100644
--- a/web/src/features/prompts/server/utils/validation.ts
+++ b/web/src/features/prompts/server/utils/validation.ts
@@ -25,7 +25,9 @@ export const PromptLabelSchema = z
export const PromptNameSchema = z
.string()
.min(1)
- .regex(/^[^|]*$/, "Name cannot contain '|' character");
+ .regex(/^[^|]*$/, "Name cannot contain '|' character")
+ .transform((s) => s.trim())
+ .refine((s) => s.length > 0, "Name cannot be empty");
const BaseCreateTextPromptSchema = z.object({
name: PromptNameSchema,