Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
emrgnt-cmplxty committed Sep 23, 2024
1 parent 926241c commit 1f6afc7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
4 changes: 3 additions & 1 deletion templates/ycombinator_graphrag/web-app/components/Answer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useState, useEffect } from 'react';
import { FC } from 'react';
import Markdown from 'react-markdown';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Info, X } from 'lucide-react';

import {
Popover,
Expand Down Expand Up @@ -239,7 +241,7 @@ export const Answer: FC<{
<AccordionTrigger className="py-2 text-lg font-bold text-zinc-200 hover:no-underline text-black">
<SourceInfo
isSearching={isSearching}
sourcesCount={parsedVectorSources.length}
sourcesCount={parsedVectorSources.length+parsedEntities.length+parsedCommunities.length}
/>
</AccordionTrigger>
<AccordionContent>
Expand Down
15 changes: 8 additions & 7 deletions templates/ycombinator_graphrag/web-app/components/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const ChatWindow: FC<ChatWindowProps> = ({
const [error, setError] = useState<string | null>(null);
const messagesEndRef = useRef<HTMLDivElement>(null);
const [showInfoAlert, setShowInfoAlert] = useState(true);
const [showInfoAlertDesc, setShowInfoAlertDesc] = useState(true);

const scrollToBottom = useCallback(() => {
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
Expand Down Expand Up @@ -88,8 +89,8 @@ export const ChatWindow: FC<ChatWindowProps> = ({
return;
}

setShowInfoAlert(false);

// setShowInfoAlert(false);
setShowInfoAlertDesc(false);
const parseStreaming = async () => {
setIsStreaming(true);
setIsSearching(true);
Expand Down Expand Up @@ -238,13 +239,13 @@ export const ChatWindow: FC<ChatWindowProps> = ({
</a>
</AlertTitle>
</div>
<AlertDescription className="text-sm text-left mb-2">
{showInfoAlertDesc && <AlertDescription className="text-sm text-left mb-2">
GraphRAG excels at answering complex questions that other methods of
search struggle with. By developing deep understanding of complex
datasets and their relationships, GraphRAG can provide more accurate
and informative answers to your users.
<br /> <br />
Learn more about GraphRAG from &nbsp;
Learn more about GraphRAG from&nbsp;
<a
href="https://microsoft.github.io/graphrag/"
target="_blank"
Expand All @@ -253,21 +254,21 @@ export const ChatWindow: FC<ChatWindowProps> = ({
>
Microsoft&apos;s research
</a>
&nbsp; or from our blog post on &nbsp;
&nbsp;or from our blog post on&nbsp;
<a
href="https://www.sciphi.ai/blog/graphrag"
target="_blank"
rel="noopener noreferrer"
className="text-blue-500"
>
production ready GrapRAG
production ready GrapRAG.
</a>
<br /> <br />
Here, we&apos;ve connected to am R2R server and built a knowledge
graph over the profiles of the YC S24 companies. Feel free to ask
any questions you have about the companies, their founders, or
anything else you&apos;d like to know!
</AlertDescription>
</AlertDescription> }
<button
className="absolute top-2 right-2 text-gray-400 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 rounded-full"
onClick={() => setShowInfoAlert(false)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export const DefaultQueries: FC<DefaultQueriesProps> = ({ setQuery }) => {
},
{
query:
'What companies are leveraging AI agents in unique and interesting ways?',
'How is AI being used across the batch?',
icon: <FlaskConical className="h-6 w-6 text-purple-400" />,
},
{
query: 'What challenges are S24 companies facing?',
icon: <Flame className="h-6 w-6 text-red-400" />,
},
{
query: "Which companies might R2R's graphrag help? And how?",
query: "Which companies might R2R's graphrag help?",
icon: <Earth className="h-6 w-6 text-green-400" />,
},
];
Expand Down
4 changes: 2 additions & 2 deletions templates/ycombinator_graphrag/web-app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const Header: React.FC<HeaderProps> = ({ onLogoClick }) => {
<>
<header className="fixed top-0 left-0 right-0 h-16 bg-header border-b border-header-border flex items-center justify-between px-4 z-10">
<div className="flex items-center">
<Logo width={75} height={75} onClick={onLogoClick} />
<Logo width={60} height={60} onClick={onLogoClick} />
<Link href="/" passHref>
<h1
className="ml-2 text-2xl font-semibold text-header-text cursor-pointer"
onClick={onLogoClick}
>
SciPhi - YC S24 GraphRAG Agent
R2R - YC S24 GraphRAG Agent
</h1>
</Link>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,18 @@ interface SearchResultsProps {
communities: KGSearchResult[];
}

const ResultCarousel: FC<{ items: any[]; ItemComponent: FC<any> }> = ({
const ResultCarousel: FC<{ items: any[]; ItemComponent: FC<any> , offset: number}> = ({
items,
ItemComponent,
offset = 0,
}) => (
<Carousel>
<CarouselContent>
{items.map((item, index) => (
<CarouselItem key={index}>
<Card className="h-48 overflow-y-auto">
<CardContent>
<ItemComponent {...item} index={index + 1} />
<ItemComponent {...item} index={index + offset + 1} />
</CardContent>
</Card>
</CarouselItem>
Expand Down Expand Up @@ -150,13 +151,13 @@ export const SearchResults: React.FC<SearchResultsProps> = ({
return (
<div className="flex justify-center text-zinc-200 rounded-lg">
<Tabs
defaultValue="kgEntities"
defaultValue="kgCommunities"
className="text-zinc-900 w-full max-w-2xl"
>
<TabsList>
<TabsTrigger value="kgCommunities">KG Communities</TabsTrigger>
<TabsTrigger value="vectorSearch">Vector Search</TabsTrigger>
<TabsTrigger value="kgEntities">KG Entities</TabsTrigger>
<TabsTrigger value="vectorSearch">Vector Search</TabsTrigger>
<TabsTrigger value="kgCommunities">KG Communities</TabsTrigger>
</TabsList>
<TabsContent value="vectorSearch">
<ResultCarousel
Expand All @@ -165,18 +166,22 @@ export const SearchResults: React.FC<SearchResultsProps> = ({
onOpenPdfPreview: openPdfPreview,
}))}
ItemComponent={VectorSearchResultItem}
offset={0}
/>
</TabsContent>
<TabsContent value="kgEntities">
<ResultCarousel
items={entities.map((entity) => ({ entity }))}
ItemComponent={KGSearchResultItem}
offset={vectorSearchResults.length}
/>
</TabsContent>
<TabsContent value="kgCommunities">
<ResultCarousel
items={communities.map((entity) => ({ entity }))}
ItemComponent={KGSearchResultItem}
offset={vectorSearchResults.length + entities.length}

/>
</TabsContent>
</Tabs>
Expand Down

0 comments on commit 1f6afc7

Please sign in to comment.