Skip to content

Commit

Permalink
Merge branch 'LAION-AI:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
RainRat authored Nov 26, 2023
2 parents 2a6bd34 + e1769c1 commit dceac8b
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy-to-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
BACKEND_CORS_ORIGINS: ${{ vars.BACKEND_CORS_ORIGINS }}
WEB_INFERENCE_SERVER_HOST: ${{ vars.WEB_INFERENCE_SERVER_HOST }}
WEB_ENABLE_CHAT: ${{ vars.WEB_ENABLE_CHAT }}
WEB_BYE: ${{ vars.WEB_BYE }}
WEB_ENABLE_DRAFTS_WITH_PLUGINS: ${{ vars.WEB_ENABLE_DRAFTS_WITH_PLUGINS }}
WEB_NUM_GENERATED_DRAFTS: ${{ vars.WEB_NUM_GENERATED_DRAFTS }}
WEB_CURRENT_ANNOUNCEMENT: ${{ vars.WEB_CURRENT_ANNOUNCEMENT }}
Expand Down
1 change: 1 addition & 0 deletions ansible/deploy-to-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
INFERENCE_SERVER_API_KEY:
"{{ lookup('ansible.builtin.env', 'WEB_INFERENCE_SERVER_API_KEY') }}"
ENABLE_CHAT: "{{ lookup('ansible.builtin.env', 'WEB_ENABLE_CHAT') }}"
BYE: "{{ lookup('ansible.builtin.env', 'WEB_BYE') }}"
ENABLE_DRAFTS_WITH_PLUGINS:
"{{ lookup('ansible.builtin.env',
'WEB_ENABLE_DRAFTS_WITH_PLUGINS')}}"
Expand Down
1 change: 1 addition & 0 deletions website/src/hooks/env/BrowserEnv.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createContext, useContext } from "react";

export interface BrowserConfig {
BYE: boolean;
ENABLE_CHAT: boolean;
ENABLE_DRAFTS_WITH_PLUGINS: boolean;
NUM_GENERATED_DRAFTS: number;
Expand Down
1 change: 1 addition & 0 deletions website/src/pages/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BrowserConfig } from "src/types/Config";

// don't put sensitive information here
const config: BrowserConfig = {
BYE: boolean(process.env.BYE),
ENABLE_CHAT: boolean(process.env.ENABLE_CHAT),
ENABLE_DRAFTS_WITH_PLUGINS: boolean(process.env.ENABLE_DRAFTS_WITH_PLUGINS),
NUM_GENERATED_DRAFTS: Number(process.env.NUM_GENERATED_DRAFTS),
Expand Down
58 changes: 58 additions & 0 deletions website/src/pages/bye.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import Image from "next/image";
import Link from "next/link";
import { Container } from "src/components/Container";
export { getStaticProps } from "src/lib/defaultServerSideProps";

const ByePage = () => {
return (
<div>
<Container className="">
<div className="grid gap-16 items-center py-20 md:py-40 lg:grid-cols-2">
<div className="m-auto order-2 lg:order-1">
<Image src="/images/logos/logo.png" width={450} height={450} alt="temp-image" />
</div>
<div className="space-y-8 order-1 lg:order-2">
<div>
<h1 className="text-4xl mb-6">OpenAssistant has finished!</h1>
<p className="text-2xl">
OpenAssistant collected data from over 13&apos;000 humans and released it to the public. Data, models,
and code are publicly available.
</p>
<h2 className="text-2xl font-bold mt-4 mb-2">Links:</h2>
<ul className="text-2xl list-none text-blue-500">
<li>
<Link href="/contributors">List of contributors</Link>
</li>
<li>
<a href="https://ykilcher.com/oa-paper">Paper</a>
</li>
<li>
<a href="https://github.com/LAION-AI/Open-Assistant">GitHub</a>
</li>
<li>
<a href="https://huggingface.co/OpenAssistant">HuggingFace org</a>
</li>
<li>
<a href="https://youtu.be/gqtmUHhaplo">Yannic&apos;s conclusion video</a>
</li>
</ul>
<p className="text-2xl mt-4 mb-2">
If you&apos;re looking to support other open-data projects, check out these:
</p>
<ul className="text-2xl list-none text-blue-500">
<li>
<a href="https://chat.lmsys.org/">LMSYS Chatbot Arena</a>
</li>
<li>
<a href="https://laion.ai/blog/open-empathic/">Open Empathic</a>
</li>
</ul>
</div>
</div>
</div>
</Container>
</div>
);
};

export default ByePage;
3 changes: 2 additions & 1 deletion website/src/pages/chat/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export { getServerSideProps } from "src/lib/defaultServerSideProps";
import useSWRImmutable from "swr/immutable";

const Chat = () => {
const { query } = useRouter();
const router = useRouter();
const { query } = router;
const id = query.id as string;
const { t } = useTranslation(["common", "chat"]);
const { data: modelInfos } = useSWRImmutable<ModelInfo[]>("/api/chat/models", get, {
Expand Down
10 changes: 10 additions & 0 deletions website/src/pages/chat/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import Head from "next/head";
import { useRouter } from "next/router";
import { useTranslation } from "next-i18next";
import React from "react";
import { ChatListBase } from "src/components/Chat/ChatListBase";
import { DashboardLayout } from "src/components/Layout";
export { getStaticProps } from "src/lib/defaultServerSideProps";
import { useBrowserConfig } from "src/hooks/env/BrowserEnv";

const ChatList = () => {
const { t } = useTranslation();
const { BYE } = useBrowserConfig();
const router = useRouter();

React.useEffect(() => {
if (BYE) {
router.push("/bye");
}
}, [router, BYE]);

return (
<>
Expand Down
13 changes: 13 additions & 0 deletions website/src/pages/contributors.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useRouter } from "next/router";
import { useEffect } from "react";

const ContributorsPage = () => {
const router = useRouter();
useEffect(() => {
router.push("https://ykilcher.com/oa-contributors");
}, [router]);

return null;
};

export default ContributorsPage;
12 changes: 10 additions & 2 deletions website/src/pages/dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Button, Card, CardBody, Flex, Heading } from "@chakra-ui/react";
import Head from "next/head";
import { useRouter } from "next/router";
import { useTranslation } from "next-i18next";
import { useMemo } from "react";
import { useEffect, useMemo } from "react";
import { LeaderboardWidget, TaskOption, WelcomeCard } from "src/components/Dashboard";
import { DashboardLayout } from "src/components/Layout";
import { get } from "src/lib/api";
Expand All @@ -17,7 +18,8 @@ import useSWR from "swr";

const Dashboard = () => {
const { t } = useTranslation(["dashboard", "common", "tasks"]);
const { ENABLE_CHAT } = useBrowserConfig();
const { ENABLE_CHAT, BYE } = useBrowserConfig();
const router = useRouter();
const lang = useCurrentLocale();
const { data } = useSWR<AvailableTasks>(API_ROUTES.AVAILABLE_TASK({ lang }), get, {
refreshInterval: 2 * 60 * 1000, //2 minutes
Expand Down Expand Up @@ -55,6 +57,12 @@ const Dashboard = () => {
},
};

useEffect(() => {
if (BYE) {
router.push("/bye");
}
}, [BYE, router]);

return (
<>
<Head>
Expand Down
8 changes: 7 additions & 1 deletion website/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ import { CallToAction } from "src/components/CallToAction";
import { Faq } from "src/components/Faq";
import { Hero } from "src/components/Hero";
export { getDefaultServerSideProps as getStaticProps } from "src/lib/defaultServerSideProps";
import { useBrowserConfig } from "src/hooks/env/BrowserEnv";

const Home = () => {
const { BYE } = useBrowserConfig();
const router = useRouter();
const { status } = useSession();
const { t } = useTranslation();
useEffect(() => {
if (BYE) {
router.push("/bye");
}

if (status === "authenticated") {
router.push("/dashboard");
}
}, [router, status]);
}, [router, status, BYE]);

return (
<>
Expand Down
1 change: 1 addition & 0 deletions website/src/types/Config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface BrowserConfig {
BYE: boolean;
ENABLE_CHAT: boolean;
ENABLE_DRAFTS_WITH_PLUGINS: boolean; // Whether draft messages should be generated if plugins are in use
NUM_GENERATED_DRAFTS: number;
Expand Down
1 change: 1 addition & 0 deletions website/types/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare global {
ADMIN_USERS: string;
MODERATOR_USERS: string;
INFERENCE_SERVER_HOST: string;
BYE: boolean;
ENABLE_CHAT: boolean;
ENABLE_DRAFTS_WITH_PLUGINS: boolean;
NUM_GENERATED_DRAFTS: number;
Expand Down

0 comments on commit dceac8b

Please sign in to comment.