Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
434 changes: 431 additions & 3 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"fumadocs-mdx": "^11.6.10",
"fumadocs-ui": "^15.6.1",
"js-tiktoken": "^1.0.20",
"lodash.isequal": "^4.5.0",
"lodash.merge": "^4.6.2",
"lucide-react": "^0.468.0",
"next": "^15.1.6",
Expand All @@ -67,11 +68,13 @@
"prettier": "^3.3.3",
"prismjs": "^1.29.0",
"react": "19.0.0",
"react-day-picker": "^9.8.0",
"react-diff-viewer-continued-react19": "^1.0.0",
"react-dom": "19.0.0",
"react-hook-form": "^7.54.2",
"react-markdown": "^10.1.0",
"react-simple-code-editor": "^0.14.1",
"recharts": "^3.0.2",
"sonner": "^2.0.1",
"ts-morph": "^25.0.1",
"tsd": "^0.32.0",
Expand All @@ -81,6 +84,7 @@
"devDependencies": {
"@tailwindcss/postcss": "^4.0.9",
"@types/jest": "^29.5.14",
"@types/lodash.isequal": "^4.5.8",
"@types/lodash.merge": "^4.6.9",
"@types/node": "22.10.2",
"@types/prismjs": "^1.26.5",
Expand Down
65 changes: 65 additions & 0 deletions src/app/__generated__/supabase.types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 19 additions & 19 deletions src/app/actions/auth.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// 'use server';
'use server';

// import { encodedRedirect } from '@/utils/utils';
// import { createClient } from '@/lib/supabase/server';
// import { headers } from 'next/headers';
// import { redirect } from 'next/navigation';
// import { routes } from '@/utils/routes';
import { encodedRedirect } from '@/utils/utils';
import { createClient } from '@/lib/supabase/server';
import { headers } from 'next/headers';
import { redirect } from 'next/navigation';
import { routes } from '@/utils/routes';

// export const signUpAction = async (formData: FormData) => {
// const email = formData.get('email')?.toString();
Expand Down Expand Up @@ -36,22 +36,22 @@
// }
// };

// export const signInAction = async (formData: FormData) => {
// const email = formData.get('email') as string;
// const password = formData.get('password') as string;
// const supabase = await createClient();
export const signInAction = async (formData: FormData) => {
const email = formData.get('email') as string;
const password = formData.get('password') as string;
const supabase = await createClient();

// const { error } = await supabase.auth.signInWithPassword({
// email,
// password,
// });
const { error } = await supabase.auth.signInWithPassword({
email,
password,
});

// if (error) {
// return encodedRedirect('error', routes.auth.signIn, error.message);
// }
if (error) {
return encodedRedirect('error', routes.auth.signIn, error.message);
}

// return redirect(routes.studio.home);
// };
return redirect(routes.studio.home);
};

// export const forgotPasswordAction = async (formData: FormData) => {
// const email = formData.get('email')?.toString();
Expand Down
7 changes: 4 additions & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { ThemeProvider } from 'next-themes';
import { GoogleAnalytics } from '@next/third-parties/google';
import { Toaster } from '@/components/ui/sonner';
import { PostHogProvider } from '@/providers/posthog';
import { isDev, isProd } from '@/utils/is-env';

const defaultUrl =
process.env.VERCEL_ENV === 'production' && process.env.NEXT_PUBLIC_SITE_URL
isProd && process.env.NEXT_PUBLIC_SITE_URL
? process.env.NEXT_PUBLIC_SITE_URL
: process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
Expand All @@ -33,11 +34,11 @@ export default function RootLayout(props: RootLayoutProps) {

return (
<html lang="en" className={ibmPlexMono.className} suppressHydrationWarning>
{/* {!process.env.VERCEL_ENV && (
{isDev && (
<head>
<script src="https://unpkg.com/react-scan/dist/auto.global.js" />
</head>
)} */}
)}
<PostHogProvider>
<GoogleAnalytics gaId="G-PZG86YG9ZZ" />
<body className="bg-background text-foreground">
Expand Down
3 changes: 2 additions & 1 deletion src/app/robots.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { MetadataRoute } from 'next';
import { isProd } from '@/utils/is-env';

export default function robots(): MetadataRoute.Robots {
if (process.env.VERCEL_ENV === 'production') {
if (isProd) {
return {
rules: {
userAgent: '*',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LogsPageSkeleton } from '@/page-components/LogsPage';
import { LogsPageSkeleton } from '@/page-components/LogsPage/LogsPage';

export default function Loading() {
return <LogsPageSkeleton />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { AgentsmithServices } from '@/lib/AgentsmithServices';
import { createClient } from '@/lib/supabase/server';
import { LogsPage } from '@/page-components/LogsPage';
import { LogsPage } from '@/page-components/LogsPage/LogsPage';
import { routes } from '@/utils/routes';
import { redirect } from 'next/navigation';

type LogsProps = {
params: Promise<{ projectUuid: string }>;
Expand All @@ -13,11 +15,23 @@ export default async function Logs(props: LogsProps) {

const agentsmith = new AgentsmithServices({ supabase });

// Get the first project
// Get the project data
const project = await agentsmith.services.projects.getProjectDataByUuid(projectUuid);

// If no project exists, pass empty logs array
const logs = project ? await agentsmith.services.llmLogs.getLogsByProjectId(project.id) : [];
if (!project) {
redirect(routes.error('Project not found, cannot load logs.'));
}

return <LogsPage project={project} logs={logs} />;
// Get available filters for the last 30 days
const endDate = new Date();
const startDate = new Date();
startDate.setDate(endDate.getDate() - 30);

const availableFilters = await agentsmith.services.metrics.getAvailableFilters(
project.id,
startDate,
endDate,
);

return <LogsPage project={project} availableFilters={availableFilters} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { MetricsPageSkeleton } from '@/page-components/MetricsPage/MetricsPage';

export default function Loading() {
return <MetricsPageSkeleton />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { AgentsmithServices } from '@/lib/AgentsmithServices';
import { createClient } from '@/lib/supabase/server';
import { MetricsPage } from '@/page-components/MetricsPage/MetricsPage';
import { routes } from '@/utils/routes';
import { redirect } from 'next/navigation';

type MetricsProps = {
params: Promise<{ projectUuid: string }>;
};

export default async function Metrics(props: MetricsProps) {
const { projectUuid } = await props.params;

const supabase = await createClient();

const agentsmith = new AgentsmithServices({ supabase });

// Get the project data
const project = await agentsmith.services.projects.getProjectDataByUuid(projectUuid);

if (!project) {
redirect(routes.error('Project not found, cannot load metrics.'));
}

return <MetricsPage project={project} />;
}
Loading