Skip to content

Commit 2d0977e

Browse files
committed
configure agent ui in app
1 parent 944aeb5 commit 2d0977e

File tree

1 file changed

+19
-19
lines changed
  • packages/web/src/app/[domain]/agents

1 file changed

+19
-19
lines changed

packages/web/src/app/[domain]/agents/page.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
import { Header } from "../components/header";
21
import Link from "next/link";
3-
import Image from "next/image";
42
import { NavigationMenu } from "../components/navigationMenu";
5-
import { FaRobot, FaCogs } from "react-icons/fa";
3+
import { FaCogs } from "react-icons/fa";
64
import { MdRocketLaunch } from "react-icons/md";
5+
import { env } from "@/env.mjs";
76

87
const agents = [
98
{
109
id: "review-agent",
1110
name: "Review Agent",
1211
description: "An agent that reviews your PRs. Uses the code indexed on Sourcebot to provide codebase wide context.",
13-
deployUrl: "/agents/review-agent/deploy",
14-
configureUrl: "/agents/review-agent/configure",
12+
requiredEnvVars: ["GITHUB_APP_ID", "GITHUB_APP_WEBHOOK_SECRET", "GITHUB_APP_PRIVATE_KEY_PATH", "OPENAI_API_KEY"],
13+
configureUrl: "https://docs.sourcebot.dev/docs/agents/review-agent"
1514
},
16-
// Add more agents here as needed
1715
];
1816

1917
export default function AgentsPage({ params: { domain } }: { params: { domain: string } }) {
@@ -47,19 +45,21 @@ export default function AgentsPage({ params: { domain } }: { params: { domain: s
4745
</p>
4846
</div>
4947
{/* Actions */}
50-
<div className="flex flex-row gap-4 justify-center w-full mt-2">
51-
<Link
52-
href={agent.deployUrl}
53-
className="flex items-center justify-center gap-2 px-5 py-2.5 rounded-md bg-primary text-primary-foreground font-mono font-semibold text-base border border-primary shadow-sm hover:bg-primary/80 focus:outline-none focus:ring-2 focus:ring-primary/60 transition w-1/2"
54-
>
55-
<MdRocketLaunch className="text-lg" /> Deploy
56-
</Link>
57-
<Link
58-
href={agent.configureUrl}
59-
className="flex items-center justify-center gap-2 px-5 py-2.5 rounded-md bg-muted text-foreground font-mono font-semibold text-base border border-border shadow-sm hover:bg-card/80 focus:outline-none focus:ring-2 focus:ring-border/60 transition w-1/2"
60-
>
61-
<FaCogs className="text-lg" /> Configure
62-
</Link>
48+
<div className="flex flex-col items-center w-full mt-2">
49+
{agent.requiredEnvVars.every(envVar => envVar in env && env[envVar as keyof typeof env] !== undefined) ? (
50+
<div className="text-green-500 font-semibold">
51+
Agent is configured and accepting requests on /api/webhook
52+
</div>
53+
) : (
54+
<Link
55+
href={agent.configureUrl}
56+
target="_blank"
57+
rel="noopener noreferrer"
58+
className="flex items-center justify-center gap-2 px-5 py-2.5 rounded-md bg-primary text-primary-foreground font-mono font-semibold text-base border border-primary shadow-sm hover:bg-primary/80 focus:outline-none focus:ring-2 focus:ring-primary/60 transition w-1/2"
59+
>
60+
<FaCogs className="text-lg" /> Configure
61+
</Link>
62+
)}
6363
</div>
6464
</div>
6565
))}

0 commit comments

Comments
 (0)