Skip to content

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

Fix error on project creation form (#23)

Marc Klingen0eb734278a80
diff --git a/src/features/projects/components/NewProjectButton.tsx b/src/features/projects/components/NewProjectButton.tsx
index bae72c9808..f00a242fda 100644
--- a/src/features/projects/components/NewProjectButton.tsx
+++ b/src/features/projects/components/NewProjectButton.tsx
@@ -27,14 +27,7 @@ import { cn } from "@/src/utils/tailwind";
import { useState } from "react";
const formSchema = z.object({
- name: z
- .string()
- .min(3, "Must have at least 3 characters")
- .max(20, "Must have at most 20 characters")
- .regex(
- /^[a-z][-a-z0-9]{2,21}$/,
- "Must be lowercase, start with a letter, include hyphens)"
- ),
+ name: z.string().min(3, "Must have at least 3 characters"),
});
interface NewProjectButtonProps {
@@ -99,7 +92,7 @@ export function NewProjectButton({ size = "default" }: NewProjectButtonProps) {
<FormItem>
<FormLabel>Project name</FormLabel>
<FormControl>
- <Input placeholder="shadcn" {...field} />
+ <Input placeholder="my-llm-project" {...field} />
</FormControl>
<FormDescription>
This is your public display name.
@@ -108,16 +101,16 @@ export function NewProjectButton({ size = "default" }: NewProjectButtonProps) {
</FormItem>
)}
/>
+ <Button
+ type="submit"
+ loading={createProjectMutation.isLoading}
+ className="w-full"
+ >
+ Create
+ </Button>
</form>
</Form>
- <DialogFooter>
- <Button
- onClick={() => form.handleSubmit(onSubmit)}
- loading={createProjectMutation.isLoading}
- >
- Create
- </Button>
- </DialogFooter>
+ <DialogFooter></DialogFooter>
</DialogContent>
</Dialog>
);
diff --git a/src/features/projects/server/projectsRouter.ts b/src/features/projects/server/projectsRouter.ts
index 8b073952d3..f5b5d38e1a 100644
--- a/src/features/projects/server/projectsRouter.ts
+++ b/src/features/projects/server/projectsRouter.ts
@@ -1,5 +1,4 @@
import { createTRPCRouter, protectedProcedure } from "@/src/server/api/trpc";
-import { TRPCError } from "@trpc/server";
import * as z from "zod";
export const projectsRouter = createTRPCRouter({
@@ -27,19 +26,6 @@ export const projectsRouter = createTRPCRouter({
})
)
.mutation(async ({ input, ctx }) => {
- // check that no project with this name exists
- const existingProject = await ctx.prisma.project.findFirst({
- where: {
- name: input.name,
- },
- });
- if (existingProject) {
- throw new TRPCError({
- code: "PRECONDITION_FAILED",
- message: "A project with this name already exists",
- });
- }
-
const project = await ctx.prisma.project.create({
data: {
name: input.name,