Skip to content

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

Add /trace/[traceId] (#383)

Marc Klingen90132850dd74
diff --git a/src/pages/trace/[traceId].tsx b/src/pages/trace/[traceId].tsx
new file mode 100644
index 0000000000..686df043e2
--- /dev/null
+++ b/src/pages/trace/[traceId].tsx
@@ -0,0 +1,50 @@
+import { prisma } from "@/src/server/db";
+import { type GetServerSideProps } from "next";
+import { useRouter } from "next/router";
+
+export const getServerSideProps: GetServerSideProps = async (context) => {
+ if (!context.params) {
+ return {
+ notFound: true,
+ };
+ }
+
+ const traceId = context.params.traceId as string;
+
+ const trace = await prisma.trace.findUnique({
+ where: {
+ id: traceId,
+ },
+ select: {
+ project: {
+ select: {
+ id: true,
+ },
+ },
+ },
+ });
+
+ if (!trace) {
+ return {
+ notFound: true,
+ };
+ }
+
+ return {
+ redirect: {
+ destination: `/project/${trace.project.id}/traces/${traceId}`,
+ permanent: false,
+ },
+ };
+};
+
+const TracePage = () => {
+ const router = useRouter();
+ if (router.isFallback) {
+ return <div>Loading...</div>;
+ }
+
+ return <div>Redirecting...</div>;
+};
+
+export default TracePage;