|
1 | | -import { Header } from "../components/header"; |
2 | 1 | import Link from "next/link"; |
3 | | -import Image from "next/image"; |
4 | 2 | import { NavigationMenu } from "../components/navigationMenu"; |
5 | | -import { FaRobot, FaCogs } from "react-icons/fa"; |
| 3 | +import { FaCogs } from "react-icons/fa"; |
6 | 4 | import { MdRocketLaunch } from "react-icons/md"; |
| 5 | +import { env } from "@/env.mjs"; |
7 | 6 |
|
8 | 7 | const agents = [ |
9 | 8 | { |
10 | 9 | id: "review-agent", |
11 | 10 | name: "Review Agent", |
12 | 11 | 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" |
15 | 14 | }, |
16 | | - // Add more agents here as needed |
17 | 15 | ]; |
18 | 16 |
|
19 | 17 | export default function AgentsPage({ params: { domain } }: { params: { domain: string } }) { |
@@ -47,19 +45,21 @@ export default function AgentsPage({ params: { domain } }: { params: { domain: s |
47 | 45 | </p> |
48 | 46 | </div> |
49 | 47 | {/* 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 | + )} |
63 | 63 | </div> |
64 | 64 | </div> |
65 | 65 | ))} |
|
0 commit comments