Merge branch 'main' into level-modes

This commit is contained in:
FraserLee
2023-07-11 23:33:59 -04:00
committed by GitHub
4 changed files with 26 additions and 19 deletions
+6 -5
View File
@@ -1,22 +1,23 @@
import React from "react";
import Link from "next/link";
import Image from 'next/image';
import logo from "./logo.svg"
const Header: React.FC<{page: "index" | "semantic"}> = ({page}) => {
const sidebar = page === "index" ? (
<span className="flex flex-col font-semibold flex-1 justify-start text-right">
<p className="my-0">Conversational Agent</p>
<Link href="/semantic">Semantic Search</Link>
<Link href="/semantic">Show Sources</Link>
</span>
) : (
<span className="flex flex-col font-semibold flex-1 justify-start text-right">
<Link href="/">Conversational Agent</Link>
<p className="my-0">Semantic Search</p>
<Link href="/">Go Chat</Link>
</span>
);
return (<>
<div className="flex my-4">
<h1 className="flex-1 my-0">AlignmentSearch</h1>
<Image src={logo} alt="aisafety.info logo" width={36}/>
<h1 className="flex-1 my-0">AI Safety Chatbot</h1>
{sidebar}
</div>
</>);
+10 -5
View File
@@ -4,6 +4,7 @@ import Head from "next/head";
import React from "react";
import { type NextPage } from "next";
import { useState, useEffect } from "react";
import Link from "next/link";
import Image from 'next/image';
import Header from "../header";
@@ -72,9 +73,14 @@ const ShowCitation: React.FC<{citation: Citation, i: number}> = ({citation, i})
if (citation.date && citation.date !== "")
c_str += " - " + citation.date;
// if we don't have a url, link to a duckduckgo search for the title instead
const url = citation.url && citation.url !== ""
? citation.url
: `https://duckduckgo.com/?q=${encodeURIComponent(citation.title)}`;
return (
<A className={Colours[i % Colours.length] + " border-2 flex items-center rounded my-2 text-sm no-underline w-fit"}
href={citation.url}>
href={url}>
<span className="mx-1"> [{i + 1}] </span>
<p className="mx-1 my-0"> {c_str} </p>
</A>
@@ -474,7 +480,7 @@ const Home: NextPage = () => {
return (
<>
<Head>
<title>Alignment Search</title>
<title>AI Safety Info</title>
</Head>
<main>
<Header page="index" />
@@ -507,10 +513,9 @@ const Home: NextPage = () => {
</div>
<h2 className="bg-red-100 text-red-800"><b>WARNING</b>: This is a very <b>early prototype</b> using data through June 2022. <Link href="http://bit.ly/stampy-chat-issues" target="_blank">Feedback</Link> welcomed.</h2>
<ul>
{entries.map((entry, i) => {
switch (entry.role) {
+2 -2
View File
@@ -41,11 +41,11 @@ const Semantic: NextPage = () => {
return (
<>
<Head>
<title>Alignment Search</title>
<title>AI Safety Info</title>
</Head>
<main>
<Header page="semantic" />
<h2>See the raw results of a semantic search</h2>
<h2>Retrieve relevant data sources from alignment research</h2>
<SearchBox search={semantic_search} />
<ul>
{results.map((entry, i) => (