-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from elwood-software/feature/ai-assistant
updates to AI
- Loading branch information
Showing
45 changed files
with
2,217 additions
and
1,656 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
pnpm type-check --filter=./packages/* | ||
TURBO_UI=0 pnpm type-check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
'use client'; | ||
|
||
import {useEffect, useState} from 'react'; | ||
import {createMemoryRouter} from 'react-router-dom'; | ||
import { | ||
Router, | ||
ElwoodProvider, | ||
useAssistant, | ||
dashboardRoutes, | ||
Assistant, | ||
} from '@elwood/react'; | ||
import {Spinner} from '@elwood/ui'; | ||
import {type ElwoodClient, createClient, type User} from '@elwood/js'; | ||
|
||
export function Demo() { | ||
const [router] = useState(createMemoryRouter(dashboardRoutes)); | ||
const [client, setClient] = useState<ElwoodClient | null>(null); | ||
const [_user, setUser] = useState<User | null>(null); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
if (client) { | ||
return; | ||
} | ||
|
||
setLoading(true); | ||
const localClient = createClient( | ||
process.env.NEXT_PUBLIC_SUPABASE_URL!, | ||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, | ||
); | ||
|
||
localClient.auth.getSession().then(({data}) => { | ||
if (data.session) { | ||
setClient(localClient); | ||
setLoading(false); | ||
return; | ||
} | ||
|
||
return localClient.auth | ||
.signInWithPassword({ | ||
email: process.env.NEXT_PUBLIC_DEMO_USER_EMAIL!, | ||
password: process.env.NEXT_PUBLIC_DEMO_USER_PW!, | ||
}) | ||
.then(response => { | ||
setUser(response.data?.user ?? null); | ||
}) | ||
.catch(error => { | ||
console.log(error.message); | ||
}) | ||
.finally(() => { | ||
setClient(localClient); | ||
setLoading(false); | ||
}); | ||
}); | ||
}, []); | ||
|
||
const workspaceName = 'Dunder Mifflin'; | ||
|
||
const loadingComponent = ( | ||
<Assistant messages={[]}> | ||
<Spinner /> | ||
</Assistant> | ||
); | ||
|
||
if (!client || loading) { | ||
return loadingComponent; | ||
} | ||
|
||
return ( | ||
<ElwoodProvider | ||
loadingComponent={loadingComponent} | ||
workspaceName={workspaceName} | ||
client={client} | ||
onLogout={() => {}}> | ||
<AssistantDemo /> | ||
</ElwoodProvider> | ||
); | ||
} | ||
|
||
function AssistantDemo() { | ||
const assistant = useAssistant({}); | ||
|
||
return <>{assistant}</>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type {PropsWithChildren} from 'react'; | ||
|
||
import Link from 'next/link'; | ||
import {Logo, Button, StarIcon, FileIcon, ExternalLinkIcon} from '@elwood/ui'; | ||
import {type Metadata} from 'next'; | ||
import {Demo} from './demo'; | ||
|
||
import Grid from '@/components/grid'; | ||
|
||
export const metadata: Metadata = { | ||
title: 'Elwood AI', | ||
}; | ||
|
||
export default async function Page() { | ||
return ( | ||
<div className="w-full h-full flex flex-col"> | ||
<Grid className="z-0" /> | ||
<div className="container lg:max-w-[40vw] md:max-w-[60vw] size-full relative flex flex-col max-h-[80vh]"> | ||
<header className="w-full flex flex-col items-center pt-12 pb-3 text-center"> | ||
<div className="size-12 mb-6"> | ||
<Link href="/"> | ||
<Logo className="size-full fill-brand dark:fill-current" /> | ||
<span className="sr-only">Elwood</span> | ||
</Link> | ||
</div> | ||
<h1 className="text-5xl md:text-7xl font-extrabold relative z-10 mb-1.5"> | ||
Elwood AI | ||
</h1> | ||
<h2 className="text-xl font-thin text-foreground/80"> | ||
<strong>Talk to your files.</strong> With Elwood AI, you can go | ||
beyond simple search & filters. Your custom trained AI assistant can | ||
help you find, organize, understand, and act on all of your team's | ||
files. | ||
</h2> | ||
</header> | ||
<main className="flex-grow flex flex-col items-center relative z-10"> | ||
<div className="shadow-splash border rounded-md bg-background mt-6 size-full"> | ||
<Demo /> | ||
</div> | ||
</main> | ||
</div> | ||
<footer className="text-center text-muted-foreground/50 text-xs pb-2 pt-12"> | ||
© The Elwood Technology Company | ||
</footer> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.