mirror of
https://github.com/aljazceru/AgentGPT.git
synced 2025-12-17 05:54:20 +01:00
🚀 Update input fields
This commit is contained in:
@@ -6,7 +6,7 @@ interface BadgeProps {
|
|||||||
|
|
||||||
const Badge = ({ children }: BadgeProps) => {
|
const Badge = ({ children }: BadgeProps) => {
|
||||||
return (
|
return (
|
||||||
<div className="text-md h-max rounded-full bg-[#1E88E5] px-5 py-2 font-semibold text-gray-100">
|
<div className="text-md h-max rounded-full bg-[#1E88E5] px-3 py-1 font-semibold text-gray-100">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const Button = forwardRef(
|
|||||||
disabled={loading || props.disabled}
|
disabled={loading || props.disabled}
|
||||||
className={
|
className={
|
||||||
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
||||||
"shadow-2xl transition-all " + props.className
|
"transition-all hover:shadow-2xl " + props.className
|
||||||
}
|
}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -5,11 +5,17 @@ import React from "react";
|
|||||||
|
|
||||||
interface ChatWindowProps {
|
interface ChatWindowProps {
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
|
className: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ChatWindow = ({ children }: ChatWindowProps) => {
|
const ChatWindow = ({ children, className }: ChatWindowProps) => {
|
||||||
return (
|
return (
|
||||||
<div className="border-translucent flex h-80 w-full max-w-screen-md flex-col rounded-3xl bg-black/50 text-white drop-shadow-lg">
|
<div
|
||||||
|
className={
|
||||||
|
"border-translucent flex h-80 w-full max-w-screen-md flex-col rounded-3xl bg-black/50 text-white drop-shadow-lg " +
|
||||||
|
className
|
||||||
|
}
|
||||||
|
>
|
||||||
<MacWindowHeader />
|
<MacWindowHeader />
|
||||||
<div className="overflow-y-scroll">{children}</div>
|
<div className="overflow-y-scroll">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -33,7 +39,7 @@ const ChatMessage = ({ message }: { message: Message }) => {
|
|||||||
<div className="mx-4 my-1 rounded-lg border-[1px] border-transparent bg-white/20 p-3 font-mono hover:border-[#1E88E5]">
|
<div className="mx-4 my-1 rounded-lg border-[1px] border-transparent bg-white/20 p-3 font-mono hover:border-[#1E88E5]">
|
||||||
<span>
|
<span>
|
||||||
{message.type === "goal" ? "🌟 Embarking on a new goal: " : ""}
|
{message.type === "goal" ? "🌟 Embarking on a new goal: " : ""}
|
||||||
{message.type === "task" ? "📝 Adding to task list: " : ""}
|
{message.type === "task" ? "📝 Adding task: " : ""}
|
||||||
</span>
|
</span>
|
||||||
<span className="font-black">{message.value}</span>
|
<span className="font-black">{message.value}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,18 +1,28 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
interface InputProps {
|
interface InputProps {
|
||||||
|
left: React.ReactNode;
|
||||||
value: string;
|
value: string;
|
||||||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
||||||
|
placeholder?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Input = ({ value, onChange }: InputProps) => {
|
const Input = ({ placeholder, left, value, onChange }: InputProps) => {
|
||||||
return (
|
return (
|
||||||
<input
|
<div className="flex w-[60%] items-center rounded-xl bg-[#3a3a3a] font-mono text-lg text-white/75 shadow-2xl transition-all">
|
||||||
className="shadow-semibold border:black m-3 w-[60%] rounded-xl border-[2px] border-transparent bg-[#3a3a3a] px-2 py-5 font-mono text-lg tracking-wider text-white/75 outline-0 transition-all hover:border-[#1E88E5]/25 focus:border-[#1E88E5]"
|
{left != null ? (
|
||||||
type="text"
|
<div className="center flex h-full items-center rounded-xl rounded-r-none border-[2px] border-r-0 border-white/10 px-5 text-lg font-semibold tracking-wider">
|
||||||
value={value}
|
{left}
|
||||||
onChange={onChange}
|
</div>
|
||||||
/>
|
) : null}
|
||||||
|
<input
|
||||||
|
className="border:black w-full rounded-xl rounded-l-none border-[2px] border-white/10 bg-transparent px-2 py-5 tracking-wider outline-0 placeholder:text-white/20 hover:border-[#1E88E5]/25 focus:border-[#1E88E5]"
|
||||||
|
placeholder={placeholder}
|
||||||
|
type="text"
|
||||||
|
value={value}
|
||||||
|
onChange={onChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import axios from "axios";
|
|||||||
import Drawer from "../components/Drawer";
|
import Drawer from "../components/Drawer";
|
||||||
import Input from "../components/Input";
|
import Input from "../components/Input";
|
||||||
import Button from "../components/Button";
|
import Button from "../components/Button";
|
||||||
|
import { AiFillRobot } from "react-icons/Ai";
|
||||||
|
import { FaStar } from "react-icons/fa";
|
||||||
|
|
||||||
export interface Message {
|
export interface Message {
|
||||||
type: "goal" | "thinking" | "task" | "action";
|
type: "goal" | "thinking" | "task" | "action";
|
||||||
@@ -23,6 +25,7 @@ const TaskMessage = (task: string) => {
|
|||||||
|
|
||||||
const Home: NextPage = () => {
|
const Home: NextPage = () => {
|
||||||
const [loading, setLoading] = React.useState<boolean>(false);
|
const [loading, setLoading] = React.useState<boolean>(false);
|
||||||
|
const [name, setName] = React.useState<string>("");
|
||||||
const [goalInput, setGoalInput] = React.useState<string>("");
|
const [goalInput, setGoalInput] = React.useState<string>("");
|
||||||
const [messages, setMessages] = React.useState<Message[]>([]);
|
const [messages, setMessages] = React.useState<Message[]>([]);
|
||||||
const [goal, setGoal] = React.useState<string>("");
|
const [goal, setGoal] = React.useState<string>("");
|
||||||
@@ -50,16 +53,23 @@ const Home: NextPage = () => {
|
|||||||
<Drawer />
|
<Drawer />
|
||||||
<div
|
<div
|
||||||
id="content"
|
id="content"
|
||||||
className="flex h-screen w-full flex-col items-center justify-center gap-10"
|
className="flex h-screen w-full flex-col items-center justify-center gap-3"
|
||||||
>
|
>
|
||||||
<div id="title" className="flex items-center gap-4">
|
<div
|
||||||
<div className="font-mono text-6xl font-bold text-[#C0C0C0]">
|
id="title"
|
||||||
AgentGPT
|
className="flex flex-col items-center font-mono shadow-2xl"
|
||||||
|
>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<span className="text-6xl font-bold text-[#C0C0C0]">Agent</span>
|
||||||
|
<span className="mr-5 text-6xl font-bold text-white">GPT</span>
|
||||||
|
<Badge>Beta 🚀</Badge>
|
||||||
|
</div>
|
||||||
|
<div className="font-mono text-[0.8em] font-bold text-white">
|
||||||
|
Autonomous AI Agents in your browser
|
||||||
</div>
|
</div>
|
||||||
<Badge>Beta 🚀</Badge>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ChatWindow>
|
<ChatWindow className="m-10">
|
||||||
{messages.map((message, index) => (
|
{messages.map((message, index) => (
|
||||||
<ChatMessage key={`${index}-${message.type}`} message={message} />
|
<ChatMessage key={`${index}-${message.type}`} message={message} />
|
||||||
))}
|
))}
|
||||||
@@ -67,9 +77,29 @@ const Home: NextPage = () => {
|
|||||||
</ChatWindow>
|
</ChatWindow>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
|
left={
|
||||||
|
<>
|
||||||
|
<AiFillRobot />
|
||||||
|
<span className="ml-2">Name:</span>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
value={name}
|
||||||
|
onChange={(e) => setName(e.target.value)}
|
||||||
|
placeholder="AgentGPT (Note: this field doesn't do anything right now)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Input
|
||||||
|
left={
|
||||||
|
<>
|
||||||
|
<FaStar />
|
||||||
|
<span className="ml-2">Goal:</span>
|
||||||
|
</>
|
||||||
|
}
|
||||||
value={goalInput}
|
value={goalInput}
|
||||||
onChange={(e) => setGoalInput(e.target.value)}
|
onChange={(e) => setGoalInput(e.target.value)}
|
||||||
|
placeholder="Make the world a better place."
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* eslint-disable-next-line @typescript-eslint/no-misused-promises */}
|
{/* eslint-disable-next-line @typescript-eslint/no-misused-promises */}
|
||||||
<Button
|
<Button
|
||||||
onClick={() => void handleNewGoal()}
|
onClick={() => void handleNewGoal()}
|
||||||
@@ -77,6 +107,13 @@ const Home: NextPage = () => {
|
|||||||
>
|
>
|
||||||
Deploy Agent
|
Deploy Agent
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
onClick={() => void handleNewGoal()}
|
||||||
|
className="font-bolder text-gray/50 rounded-lg bg-[#1E88E5]/70 px-10 py-5 font-bold text-black/60 hover:bg-[#0084f7] hover:text-white"
|
||||||
|
>
|
||||||
|
Next
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</DefaultLayout>
|
</DefaultLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user