Skip to content

Commit 9d1cac3

Browse files
authored
Improved the initial run experience for user (zabirauf#7)
* Added better first run experience * Added the license * Added website snapshot in README
1 parent ba7dd1b commit 9d1cac3

File tree

12 files changed

+260
-64
lines changed

12 files changed

+260
-64
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ node_modules
1010
/prisma/data.db-journal
1111

1212
/app/styles/tailwind.css
13+
.DS_Store

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Zohaib Rauf
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# AutoGPT.js
22

3+
Visit [AutoGPTjs.com](https://autogptjs.com)
4+
35
The Auto-GPT [commit: 4839a0d89b2ac6569ab0eeb07e72506c97385b47] inspired browser version to make it more accessible for people to run.
46

7+
![Website snapshot](docs/website-snapshot.png);
8+
59
## Development
610

711
1. Copy `.env.example` to `.env` and change as necessary.

app/components/AIStarterForms.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export function AIGoalsForm() {
157157
defaultValue={Config.smart_llm_model}
158158
ref={modelSelectorRef}
159159
>
160-
<option value={Config.fast_llm_model}>GPT 3.5</option>
160+
<option value={Config.fast_llm_model}>GPT 3.5-turbo</option>
161161
<option value={Config.smart_llm_model}>GPT 4</option>
162162
</select>
163163
</div>

app/components/AskFilePermission.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import { Fragment, useCallback, useRef, useState } from "react";
2-
import { Dialog, Transition } from "@headlessui/react";
3-
import { FolderIcon } from "@heroicons/react/24/outline";
1+
import GitHubMarkSvg from './github-mark.svg';
2+
import { Dialog, Transition } from '@headlessui/react';
3+
import { FolderIcon } from '@heroicons/react/24/outline';
4+
import {
5+
Fragment,
6+
useCallback,
7+
useRef,
8+
useState
9+
} from 'react';
410

511
export interface AskFilePermissionProps {
612
onUserApprovedPermission: () => Promise<void>;

app/components/GitHubBadge.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export function GitHubBadge() {
2+
return (
3+
<a href="https://github.com/zabirauf/AutoGPT.js" target="_blank">
4+
<svg width="34" height="34" xmlns="http://www.w3.org/2000/svg">
5+
<g transform="scale(0.35)">
6+
<path
7+
fill-rule="evenodd"
8+
clip-rule="evenodd"
9+
d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z"
10+
fill="#24292f"
11+
/>
12+
</g>
13+
</svg>
14+
</a>
15+
);
16+
}

app/components/Header.tsx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline';
2+
import { Dialog } from '@headlessui/react';
3+
import { GitHubBadge } from './GitHubBadge';
4+
import { useEffect, useState } from 'react';
5+
6+
export function Header() {
7+
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
8+
9+
return (
10+
<header className="bg-white">
11+
<nav
12+
className="mx-auto flex max-w-7xl items-center justify-between p-6 lg:px-8"
13+
aria-label="Global"
14+
>
15+
<a href="#" className="-m-1.5 p-1.5">
16+
<span className="h-8 w-auto text-xl font-semibold underline underline-offset-2">
17+
AutoGPT.js
18+
</span>
19+
</a>
20+
<div className="flex flex-1 justify-end">
21+
<GitHubBadge />
22+
</div>
23+
</nav>
24+
<Dialog
25+
as="div"
26+
className="lg:hidden"
27+
open={mobileMenuOpen}
28+
onClose={setMobileMenuOpen}
29+
>
30+
<div className="fixed inset-0 z-10" />
31+
<Dialog.Panel className="fixed inset-y-0 left-0 z-10 w-full overflow-y-auto bg-white px-6 py-6">
32+
<div className="flex items-center justify-between">
33+
<div className="flex flex-1">
34+
<button
35+
type="button"
36+
className="-m-2.5 rounded-md p-2.5 text-gray-700"
37+
onClick={() => setMobileMenuOpen(false)}
38+
>
39+
<span className="sr-only">Close menu</span>
40+
<XMarkIcon className="h-6 w-6" aria-hidden="true" />
41+
</button>
42+
</div>
43+
<a href="#" className="-m-1.5 p-1.5">
44+
<span className="h-8 w-auto text-xl font-semibold underline underline-offset-2">
45+
AutoGPT.js
46+
</span>
47+
</a>
48+
<div className="flex flex-1 justify-end">
49+
<GitHubBadge />
50+
</div>
51+
</div>
52+
</Dialog.Panel>
53+
</Dialog>
54+
</header>
55+
);
56+
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
import { getAPIKey, setAPIKey } from 'AutoGPT/utils/apiKey';
2+
import { useAIStateDispatcher } from './AIStateProvider';
3+
import { useCallback, useRef } from 'react';
4+
5+
export function HowToUseWithTokenRequest() {
6+
const { setupDispatcher } = useAIStateDispatcher();
7+
const tokenRef = useRef<HTMLInputElement>(null);
8+
const onSaveClicked = useCallback(() => {
9+
if (tokenRef.current?.value) {
10+
setAPIKey(tokenRef.current?.value);
11+
}
12+
13+
if (getAPIKey()) {
14+
// Only go to next stage if there is an API key present
15+
setupDispatcher("next_stage");
16+
}
17+
}, [setupDispatcher]);
18+
19+
return (
20+
<div className="bg-white shadow sm:rounded-lg">
21+
<div className="px-4 py-5 sm:p-6">
22+
<h3 className="text-base font-semibold leading-6 text-gray-900">
23+
Autonomous AI
24+
</h3>
25+
<div className="mt-2 max-w-xl text-sm text-gray-500">
26+
<p>
27+
Give your custom AI a name and set it on a mission to achieve any
28+
goal you can imagine – all running within your browser. Watch it
29+
generate tasks, execute them, and learn from the outcomes for
30+
optimal results 🚀
31+
</p>
32+
</div>
33+
<div className="mt-5 sm:flex sm:items-center">
34+
<PluginGrid />
35+
</div>
36+
<h3 className="mt-4 text-base font-semibold leading-6 text-gray-900">
37+
Token
38+
</h3>
39+
<div className="mt-2 max-w-xl text-sm text-gray-500">
40+
<p>
41+
AutoGPT uses OpenAI GPT directly from browser. The token is required
42+
to call those APIs and is only stored on your browser. You can go to{" "}
43+
<a
44+
href="https://platform.openai.com/account/api-keys"
45+
target="_blank"
46+
className="text-blue-600 underline underline-offset-1"
47+
>
48+
OpenAI
49+
</a>{" "}
50+
to create a new token.
51+
</p>
52+
</div>
53+
54+
<form className="mt-5 sm:flex sm:items-center">
55+
<div className="sm:w-full sm:max-w-2xl">
56+
<label htmlFor="token" className="sr-only">
57+
Token
58+
</label>
59+
<input
60+
ref={tokenRef}
61+
type="text"
62+
name="token"
63+
id="token"
64+
className="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
65+
placeholder={getAPIKey() ?? "sk-1234..."}
66+
/>
67+
</div>
68+
<button
69+
type="button"
70+
className="mt-3 inline-flex w-full items-center justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:ml-3 sm:mt-0 sm:w-auto"
71+
onClick={onSaveClicked}
72+
>
73+
Start
74+
</button>
75+
</form>
76+
</div>
77+
</div>
78+
);
79+
}
80+
81+
interface PluginGroupInfo {
82+
emoji: string;
83+
name: string;
84+
description: string;
85+
}
86+
87+
const PLUGIN_INFOS: PluginGroupInfo[] = [
88+
{
89+
emoji: "🌐",
90+
name: "Web Explorer",
91+
description: "Browse the internet effortlessly with this powerful tool.",
92+
},
93+
{
94+
emoji: "💻",
95+
name: "Code Crafter",
96+
description: "Generate code tailored to accomplish your goals",
97+
},
98+
{
99+
emoji: "🤖",
100+
name: "Agent Architect",
101+
description: "Design and delegate tasks to GPT-based agents.",
102+
},
103+
{
104+
emoji: "📁",
105+
name: "File Forge",
106+
description: "Create and edit files.",
107+
},
108+
];
109+
110+
function PluginGrid() {
111+
return (
112+
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
113+
{PLUGIN_INFOS.map((pluginInfo, index) => (
114+
<div
115+
key={index}
116+
className="relative flex cursor-pointer items-center space-x-3 rounded-lg border border-gray-300 bg-white px-6 py-5 shadow-sm focus-within:ring-2 focus-within:ring-indigo-500 focus-within:ring-offset-2 hover:border-gray-400 sm:max-w-xs"
117+
>
118+
<div className="flex-shrink-0 text-3xl">{pluginInfo.emoji}</div>
119+
<div className="min-w-0 flex-1">
120+
<a href="#" className="focus:outline-none">
121+
<span className="absolute inset-0" aria-hidden="true" />
122+
<p className="text-sm font-medium text-gray-900">
123+
{pluginInfo.name}
124+
</p>
125+
<div className="text-sm text-gray-500">
126+
{pluginInfo.description}
127+
</div>
128+
</a>
129+
</div>
130+
</div>
131+
))}
132+
</div>
133+
);
134+
}

app/components/TokenRequest.tsx

Lines changed: 0 additions & 56 deletions
This file was deleted.

app/root.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import tailwindStylesheetUrl from './styles/tailwind.css';
2+
import { Header } from './components/Header';
13
import type { LinksFunction } from "@remix-run/node";
24
import {
35
Links,
@@ -8,8 +10,6 @@ import {
810
ScrollRestoration,
911
} from "@remix-run/react";
1012

11-
import tailwindStylesheetUrl from "./styles/tailwind.css";
12-
1313
export const links: LinksFunction = () => {
1414
return [{ rel: "stylesheet", href: tailwindStylesheetUrl }];
1515
};
@@ -24,10 +24,24 @@ export default function App() {
2424
<Links />
2525
</head>
2626
<body className="h-full">
27+
<Header />
2728
<Outlet />
2829
<ScrollRestoration />
2930
<Scripts />
3031
<LiveReload />
32+
{/* 100% privacy friendly analytics */}
33+
<script
34+
async
35+
defer
36+
src="https://scripts.simpleanalyticscdn.com/latest.js"
37+
></script>
38+
<noscript>
39+
<img
40+
src="https://queue.simpleanalyticscdn.com/noscript.gif"
41+
alt=""
42+
referrerPolicy="no-referrer-when-downgrade"
43+
/>
44+
</noscript>
3145
</body>
3246
</html>
3347
);

0 commit comments

Comments
 (0)