|
| 1 | +import React from "react"; |
| 2 | +import { MacWindowInternal } from "../console/MacWindowHeader"; |
| 3 | +import clsx from "clsx"; |
| 4 | +import { FaGithub } from "react-icons/fa"; |
| 5 | +import PrimaryButton from "../PrimaryButton"; |
| 6 | + |
| 7 | +interface TerminalProps { |
| 8 | + className?: string; |
| 9 | + title?: string; |
| 10 | + children?: React.ReactNode; |
| 11 | +} |
| 12 | + |
| 13 | +const OpenSource = () => { |
| 14 | + return ( |
| 15 | + <div className="min-h-[50vh] w-full"> |
| 16 | + <div className="flex flex-row"> |
| 17 | + <div className="relative w-full"> |
| 18 | + <Terminal className="absolute" title="index.ts"> |
| 19 | + <pre className="overflow-hidden"> |
| 20 | + {"" + |
| 21 | + "<!DOCTYPE html>\n" + |
| 22 | + "<html>\n" + |
| 23 | + "<head>\n" + |
| 24 | + " <title>My AgentGPT Website</title>\n" + |
| 25 | + "</head>\n" + |
| 26 | + "<body>\n" + |
| 27 | + " <h1>Welcome to AgentGPT!</h1>\n" + |
| 28 | + " <p>Explore the power of autonomous AI agents.</p>\n" + |
| 29 | + ' <script src="https://agentgpt.reworkd.ai/agentgpt.js"></script>\n' + |
| 30 | + " <script>\n" + |
| 31 | + " // Connect to AgentGPT API\n" + |
| 32 | + " const agent = new AgentGPT();\n" + |
| 33 | + " agent.connect('YOUR_API_KEY');\n" + |
| 34 | + " \n" + |
| 35 | + " // Example code to interact with AgentGPT\n" + |
| 36 | + " agent.createAgent('MyAIAssistant');\n" + |
| 37 | + " agent.setGoal('Sort my emails');\n" + |
| 38 | + " agent.start();\n" + |
| 39 | + " </script>\n" + |
| 40 | + "</body>\n" + |
| 41 | + "</html>\n"} |
| 42 | + </pre> |
| 43 | + </Terminal> |
| 44 | + <Terminal className="absolute left-16 top-20 z-10" title="agent_service.py"> |
| 45 | + <pre> |
| 46 | + {"import requests\n" + |
| 47 | + "\n" + |
| 48 | + "# Define the API endpoint\n" + |
| 49 | + 'url = "https://api.agentgpt.example.com"\n' + |
| 50 | + "\n" + |
| 51 | + "# Make a GET request to retrieve data from the API\n" + |
| 52 | + "response = requests.get(url)\n" + |
| 53 | + "\n" + |
| 54 | + "# Process the response data\n" + |
| 55 | + "if response.status_code == 200:\n" + |
| 56 | + " data = response.json()\n" + |
| 57 | + " # Perform further actions with the data\n" + |
| 58 | + " print(data)\n" + |
| 59 | + "else:\n" + |
| 60 | + ' print("Error: Unable to fetch data from the API")\n'} |
| 61 | + </pre> |
| 62 | + </Terminal> |
| 63 | + </div> |
| 64 | + <div className="mt-28 w-full"> |
| 65 | + <div className="flex w-fit flex-row items-center gap-2 rounded-full bg-neutral-900 bg-gradient-to-bl from-neutral-800 to-transparent p-2 pr-4"> |
| 66 | + <FaGithub size={32} /> |
| 67 | + <div> |
| 68 | + 24.4 k<span className="text-gray-400"> stars</span> |
| 69 | + </div> |
| 70 | + </div> |
| 71 | + <h3 className="my-4 text-6xl font-medium tracking-tight">Proudly Open Source</h3> |
| 72 | + <p className="mb-8 font-extralight leading-7 text-gray-400"> |
| 73 | + We think the power of AI should be available to everyone and should be driven by |
| 74 | + community. This is why we are proudly open source. We'd love to hear your feedback at |
| 75 | + every step of the journey. |
| 76 | + </p> |
| 77 | + <a href="https://github.com/reworkd" target="_blank" className="mt-16"> |
| 78 | + <PrimaryButton>View on Github</PrimaryButton> |
| 79 | + </a> |
| 80 | + </div> |
| 81 | + </div> |
| 82 | + </div> |
| 83 | + ); |
| 84 | +}; |
| 85 | + |
| 86 | +const Terminal = (props: TerminalProps) => { |
| 87 | + return ( |
| 88 | + <div |
| 89 | + className={clsx("w-full max-w-md rounded-xl bg-neutral-800 drop-shadow-2xl", props.className)} |
| 90 | + > |
| 91 | + <MacWindowInternal>{props.title}</MacWindowInternal> |
| 92 | + <div className="h-72 overflow-hidden rounded-b-xl bg-neutral-900 p-4 text-[8pt] text-gray-400"> |
| 93 | + {props.children} |
| 94 | + </div> |
| 95 | + </div> |
| 96 | + ); |
| 97 | +}; |
| 98 | + |
| 99 | +export default OpenSource; |
0 commit comments