Skip to content

Commit

Permalink
Merge pull request #18 from Dogtiti/feature/login
Browse files Browse the repository at this point in the history
feat: login
  • Loading branch information
Dogtiti authored Apr 23, 2023
2 parents 3e4f6ac + e649ae9 commit 6d3511b
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 15 deletions.
6 changes: 4 additions & 2 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"help": "Help",
"settings": "Settings",
"new-agent": "New Agent",
"sign-in": "Sign in to be able to save agents and manage your account!",
"sign-in-tips": "Sign in to be able to save agents and manage your account!",
"create-agent": "You need to create and save your first agent before anything shows up here!",
"my-agents": " My Agent(s)",
"close": "Close",
Expand All @@ -25,5 +25,7 @@
"back": "Back",
"image": "Image",
"delete": "Delete",
"share": "Share"
"share": "Share",
"sign-in": "Sign In",
"sign-out": "Sign Out"
}
6 changes: 4 additions & 2 deletions public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"help": "帮助",
"settings": "设置",
"new-agent": "新的代理",
"sign-in": "请登录以保存代理并管理您的帐户!",
"sign-in-tips": "请登录以保存代理并管理您的帐户!",
"create-agent": "在此处显示任何内容之前,您需要创建并保存您的第一个代理!",
"my-agents": " 我的代理",
"close": "关闭",
Expand All @@ -25,5 +25,7 @@
"back": "返回",
"image": "图片",
"delete": "删除",
"share": "分享"
"share": "分享",
"sign-in": "登录",
"sign-out": "登出"
}
158 changes: 157 additions & 1 deletion public/logo-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const Button = forwardRef(
try {
void Promise.resolve(props.onClick?.(e)).then();
} catch (e) {
console.error(e);
setLoading(false);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ const ChatMessage = ({ message }: { message: Message }) => {
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeHighlight]}
>
{message.value}
{t(message.value)}
</ReactMarkdown>
</div>
) : (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const Drawer = ({
/>
))}

{status === "unauthenticated" && <div>{t("sign-in")}</div>}
{status === "unauthenticated" && <div>{t("sign-in-tips")}</div>}
{status === "authenticated" && userAgents.length === 0 && (
<div>{t("create-agent")}</div>
)}
Expand Down Expand Up @@ -248,7 +248,7 @@ const AuthItem: React.FC<{
signOut: () => void;
}> = ({ signIn, signOut, session }) => {
const icon = session?.user ? <FaSignInAlt /> : <FaSignOutAlt />;
const text = session?.user ? "Sign Out" : "Sign In";
const text = session?.user ? "sign-out" : "sign-in";
const onClick = session?.user ? signOut : signIn;

return <DrawerItem icon={icon} text={text} onClick={onClick} />;
Expand Down
4 changes: 3 additions & 1 deletion src/components/TaskWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ import { FaListAlt } from "react-icons/fa";
import FadeIn from "./motions/FadeIn";
import Expand from "./motions/expand";
import type { Message } from "../types/agentTypes";
import { useTranslation } from "next-i18next";

type TaskWindowProps = {
tasks: Message[];
};
export const TaskWindow = ({ tasks }: TaskWindowProps) => {
const { t } = useTranslation();
return (
<Expand className="xl mx-2 mt-4 hidden w-[20rem] flex-col items-center rounded-2xl border-2 border-white/20 bg-zinc-900 px-1 font-mono shadow-2xl xl:flex">
<div className="sticky top-0 my-2 flex items-center justify-center gap-2 bg-zinc-900 p-2 text-gray-300 ">
<FaListAlt /> Current tasks
<FaListAlt /> <span>{t("current-tasks")}</span>
</div>
<div className="window-heights mb-2 w-full px-1 ">
<div className="flex flex-col gap-2 overflow-y-auto overflow-x-hidden">
Expand Down
1 change: 0 additions & 1 deletion src/env/schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const serverSchema = z.object({
process.env.VERCEL ? z.string() : z.string().url()
),
OPENAI_API_KEY: z.string(),

GOOGLE_CLIENT_ID: requiredAuthEnabledForProduction(),
GOOGLE_CLIENT_SECRET: requiredAuthEnabledForProduction(),
GITHUB_CLIENT_ID: requiredAuthEnabledForProduction(),
Expand Down
8 changes: 3 additions & 5 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { useTranslation } from "next-i18next";
import { useRouter } from "next/router";

const Home: NextPage = () => {
const { t, i18n } = useTranslation();
const { session, status } = useAuth();
const [name, setName] = useState<string>("");
const [goalInput, setGoalInput] = useState<string>("");
Expand All @@ -45,10 +46,7 @@ const Home: NextPage = () => {
const [showQQDialog, setShowQQDialog] = useState(false);
const [showKnowlegePlanetDialog, setShowKnowlegePlanetDialog] =
useState(false);
const { t, i18n } = useTranslation();
const [customLanguage, setCustomLanguage] = React.useState<string>(
i18n.language
);
const [customLanguage, setCustomLanguage] = useState<string>(i18n.language);

const router = useRouter();

Expand Down Expand Up @@ -298,7 +296,7 @@ const Home: NextPage = () => {
<span className="ml-2">{t("stopping")}</span>
</>
) : (
t("stop-agent")
<span>{t("stop-agent")}</span>
)}
</Button>
</Expand>
Expand Down

1 comment on commit 6d3511b

@vercel
Copy link

@vercel vercel bot commented on 6d3511b Apr 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

auto-gpt-next-web – ./

auto-gpt-next-web-git-main-dogtiti.vercel.app
auto-agentgpt.com
auto-gpt-next-web-dogtiti.vercel.app

Please sign in to comment.