Skip to content

Commit

Permalink
Merge branch 'main' into level-modes
Browse files Browse the repository at this point in the history
  • Loading branch information
FraserLee committed Jul 12, 2023
2 parents 7558dbb + 64a48c6 commit 4792b63
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
15 changes: 8 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ In general, the Stampy project serves users at 3 levels of understanding:

Given the disparate backgrounds of users, for both the website and chatbot, we should consider having users identify their starting level (new, moderate, knowledgeable). On the website, the list of starter and recommended questions would be tuned to the user’s level. Similarly, the chatbot's usage of technical terminology could be adjusted to their level.




## Usage

### Environment Setup
Expand Down Expand Up @@ -58,10 +55,14 @@ npm run dev
In the second window, a URL will be printed. Probably `http://localhost:3000`.
Paste this into your browser to see the app.

### Accessing Dataset




If you'll be loading data alignment research dataset to be embedded and stored in pinecone,
you'll need to access to our [private version of the dataset](https://huggingface.co/datasets/StampyAI/ard-private).
1. Create a free [HuggingFace account](https://huggingface.co/join).
2. Give admin your account name to be added to the organization. DM ccstan on Discord.
3. Create an [access token](https://huggingface.co/settings/tokens).
4. Follow [login instructions](https://huggingface.co/docs/huggingface_hub/quick-start) to access private datasets.

## Original Prototypes

Expand All @@ -70,6 +71,6 @@ The teams collaborated and key features were combined into one project.

Name | Demo App | Code Notes
-- | -- | --
McGill's AlignmentSearch | https://alignmentsearch.up.railway.app/ | https://github.com/FraserLee/AlignmentSearch<br>https://tinyurl.com/alignmentsearchgdocs
McGill's AlignmentSearch | https://alignmentsearch.up.railway.app/ | https://github.com/FraserLee/AlignmentSearch<br>https://www.lesswrong.com/posts/bGn9ZjeuJCg7HkKBj/introducing-alignmentsearch-an-ai-alignment-informed
Craig's AlignmentGPT | http://tidblitz.com/ | https://github.com/cvarrichio/alignmentchat
Stampy's Chat | http://chat.stampy.ai/ | https://github.com/ccstan99/stampy-chat<br>https://github.com/stampyAI/stampy-nlp/
11 changes: 6 additions & 5 deletions web/src/header.tsx
Original file line number Diff line number Diff line change
@@ -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>
</>);
Expand Down
15 changes: 10 additions & 5 deletions web/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -474,7 +480,7 @@ const Home: NextPage = () => {
return (
<>
<Head>
<title>Alignment Search</title>
<title>AI Safety Info</title>
</Head>
<main>
<Header page="index" />
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/semantic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => (
Expand Down

0 comments on commit 4792b63

Please sign in to comment.