Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app/chore: interactiveness improvements & enable GPU pipeline #84

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/deploy-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ jobs:
token: ${{ secrets.CHARLIE_XIAO_PAT }}
labels: app, ci/cd
title: "cd: updates of app deployment"
commit-message: "cd: updates of app deployment"
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
commit-message: |
cd: updates of app deployment

Co-authored-by: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
body: |
This PR was triggered by @${{ github.actor }} in ${{ github.workflow }}.

Check the workflow run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

- name: Enable auto-merge
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/deploy-chromadb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,15 @@ jobs:
token: ${{ secrets.CHARLIE_XIAO_PAT }}
labels: app, ci/cd
title: "cd: updates of chromadb deployment"
commit-message: "cd: updates of chromadb deployment"
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
commit-message: |
cd: updates of app deployment

Co-authored-by: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
body: |
This PR was triggered by @${{ github.actor }} in ${{ github.workflow }}.

Check the workflow run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

- name: Enable auto-merge
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/deploy-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ jobs:
token: ${{ secrets.CHARLIE_XIAO_PAT }}
labels: ci/cd
title: "cd: updates of pipeline deployment"
commit-message: "cd: updates of pipeline deployment"
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
commit-message: |
cd: updates of app deployment

Co-authored-by: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
body: |
This PR was triggered by @${{ github.actor }} in ${{ github.workflow }}.

Check the workflow run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

- name: Enable auto-merge
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const App = () => {
);
const [isSidebarPopoverVisible, setIsSidebarPopoverVisible] =
useState<boolean>(false);
const [model, setModel] = useState<ModelType>("6894888983713546240");
const [model, setModel] = useState<ModelType>("gemini-1.5-flash-001");
const [currentTab, setCurrentTab] = useState<string>("default");
const [messagesMapping, setMessagesMapping] = useState<
Map<string, ChatDisplay[]>
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/components/ChatInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file ChatInput.tsx
*
* TODO(!)
* The chat input box component.
*/

import { Box, Flex, TextArea } from "@radix-ui/themes";
Expand Down
14 changes: 12 additions & 2 deletions app/frontend/src/components/ChatPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { FCDeleteChatButton } from "./FCDeleteChatButton";
import { FCScrollButtons } from "./FCScrollButtons";
import { FCModelSelector } from "./FCModelSelector";
import { RadixMarkdown } from "./RadixMarkdown";
import { toast } from "sonner";

interface ChatPanelProps {
tab: string;
Expand Down Expand Up @@ -117,9 +118,18 @@ export const ChatPanel = ({
<FCClearHistoryButton
key="clear-history-button"
disabled={messages.length === 0 || loading}
onClick={() => setMessages(() => [])}
onClick={() => {
setMessages(() => []);
toast.success("Chat history cleared");
}}
/>,
<FCDeleteChatButton
key="delete-chat-button"
onClick={() => {
deleteTab();
toast.success(`Chat deleted: ${tab}`);
}}
/>,
<FCDeleteChatButton key="delete-chat-button" onClick={deleteTab} />,
<FCScrollButtons key="scroll-buttons" containerRef={chatPortRef} />,
];

Expand Down
6 changes: 3 additions & 3 deletions app/frontend/src/components/FCModelSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export const FCModelSelector = ({ model, setModel }: FCModelSelectorProps) => {
css={{ margin: "0 var(--space-1)" }}
></Select.Trigger>
<Select.Content position="popper" sideOffset={5}>
<Select.Item key="6894888983713546240" value="6894888983713546240">
VeritasTrial
</Select.Item>
<Select.Item key="gemini-1.5-flash-001" value="gemini-1.5-flash-001">
Gemini 1.5 Flash
</Select.Item>
<Select.Item key="6894888983713546240" value="6894888983713546240">
6894888983713546240
</Select.Item>
</Select.Content>
</Select.Root>
);
Expand Down
15 changes: 13 additions & 2 deletions app/frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
* The header component in the body.
*/

import { Box, Flex, Heading, IconButton, Tooltip } from "@radix-ui/themes";
import {
Box,
Flex,
Heading,
IconButton,
Link,
Tooltip,
} from "@radix-ui/themes";
import { Dispatch, SetStateAction } from "react";
import { MdDarkMode, MdLightMode, MdMenu, MdMenuOpen } from "react-icons/md";
import { FaGithub, FaUniversity } from "react-icons/fa";
Expand Down Expand Up @@ -38,7 +45,11 @@ export const Header = ({
return (
<Flex justify="between" align="center" pr="3">
<Box ml="2">
<Heading size="4">VeritasTrial</Heading>
<Heading size="4">
<Link href="/" color="gray" highContrast>
VeritasTrial
</Link>
</Heading>
</Box>
<Flex align="center" gap="4">
{!isSidebarVisible && (
Expand Down
6 changes: 5 additions & 1 deletion app/frontend/src/components/MessageRetrieved.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ExternalLink } from "./ExternalLink";
import { MdChat } from "react-icons/md";
import { CTGOV_URL } from "../consts";
import { MetaInfo } from "../types";
import { toast } from "sonner";

interface MessageRetrievedProps {
ids: string[];
Expand Down Expand Up @@ -41,7 +42,10 @@ export const MessageRetrieved = ({
<IconButton
size="1"
variant="ghost"
onClick={() => switchTab(id, { title: titles[index] })}
onClick={() => {
switchTab(id, { title: titles[index] });
toast.success(`Chat started: ${id}`);
}}
>
<MdChat />
</IconButton>
Expand Down
22 changes: 20 additions & 2 deletions app/frontend/src/components/RetrievePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* calling backend API), and displaying the results.
*/

import { Flex } from "@radix-ui/themes";
import { Button, Flex } from "@radix-ui/themes";
import { Dispatch, SetStateAction, useEffect, useRef, useState } from "react";
import { MdFilterList } from "react-icons/md";
import { callRetrieve } from "../api";
Expand All @@ -28,6 +28,7 @@ import { FCTopKSelector } from "./FCTopKSelector";
import { FCScrollButtons } from "./FCScrollButtons";
import { RadixMarkdown } from "./RadixMarkdown";
import { RetrievePanelFilters } from "./RetrievePanelFilters";
import { toast } from "sonner";

interface RetrievalPanelProps {
messages: ChatDisplay[];
Expand Down Expand Up @@ -81,7 +82,10 @@ export const RetrievePanel = ({
<FCClearHistoryButton
key="clear-history-button"
disabled={messages.length === 0 || loading}
onClick={() => setMessages(() => [])}
onClick={() => {
setMessages(() => []);
toast.success("Retrieval history cleared");
}}
/>,
<FCScrollButtons key="scroll-buttons" containerRef={chatPortRef} />,
];
Expand Down Expand Up @@ -114,6 +118,20 @@ export const RetrievePanel = ({
onToggleHint={() => scrollToBottom(chatPortRef)}
hintText="Retrieval filters"
HintIcon={MdFilterList}
rightHintComponent={
<Button
size="1"
variant="ghost"
css={{ fontWeight: "var(--font-weight-medium)" }}
onClick={(e) => {
e.stopPropagation();
setFilters({});
toast.success("Retrieval filter reset");
}}
>
Reset filters
</Button>
}
>
<RetrievePanelFilters filters={filters} setFilters={setFilters} />
</ChatCollapsibleHint>
Expand Down
8 changes: 6 additions & 2 deletions app/frontend/src/components/RetrievePanelFilterAgeRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const RetrievePanelFilterAgeRange = ({
};

return (
<Flex align="center" gapX="3" pl="1">
<Flex align="center" gapX="3">
<Slider
min={0}
max={100}
Expand All @@ -36,7 +36,11 @@ export const RetrievePanelFilterAgeRange = ({
value={value}
onValueChange={handler}
orientation="horizontal"
css={{ width: "200px", opacity: 0.8 }}
css={{
width: "150px",
opacity: 0.8,
"& .rt-SliderThumb::after": { inset: 0 },
}}
/>
<Text size="2">
{value[0]}~{value[1]} years
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,9 @@ export const RetrievePanelFilterLastUpdateDatePosted = ({
lastUpdateDatePosted: [fromDate, toDate],
}));
};
const handleReset = () => {
setFilters((prevFilters) => ({
...prevFilters,
lastUpdateDatePosted: undefined,
}));
};

return (
<Flex direction="row" align="center" gap="4" width="100%">
<Flex align="center" gap="2">
<Popover.Root>
<Popover.Trigger>
<Flex gap="2" height="var(--line-height-2)" asChild>
Expand All @@ -75,12 +69,14 @@ export const RetrievePanelFilterLastUpdateDatePosted = ({
</Popover.Root>
<Button
size="1"
variant="ghost"
onClick={handleReset}
style={{
padding: "4px 12px",
borderRadius: "4px",
fontWeight: "bold",
variant="outline"
disabled={range === undefined}
css={{ height: "var(--line-height-2)", padding: "0 var(--space-2)" }}
onClick={() => {
setFilters((prevFilters) => ({
...prevFilters,
lastUpdateDatePosted: undefined,
}));
}}
>
Reset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,9 @@ export const RetrievePanelFilterResultsDatePosted = ({
resultsDatePosted: [fromDate, toDate],
}));
};
const handleReset = () => {
setFilters((prevFilters) => ({
...prevFilters,
resultsDatePosted: undefined,
}));
};

return (
<Flex direction="row" align="center" gap="4" width="100%">
<Flex align="center" gap="2">
<Popover.Root>
<Popover.Trigger>
<Flex gap="2" height="var(--line-height-2)" asChild>
Expand All @@ -75,12 +69,14 @@ export const RetrievePanelFilterResultsDatePosted = ({
</Popover.Root>
<Button
size="1"
variant="ghost"
onClick={handleReset}
style={{
padding: "4px 12px",
borderRadius: "4px",
fontWeight: "bold",
variant="outline"
disabled={range === undefined}
css={{ height: "var(--line-height-2)", padding: "0 var(--space-2)" }}
onClick={() => {
setFilters((prevFilters) => ({
...prevFilters,
resultsDatePosted: undefined,
}));
}}
>
Reset
Expand Down
7 changes: 4 additions & 3 deletions deploy/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ def embedding_model():
@dsl.pipeline
def pipeline():
data_pipeline_task = data_pipeline().set_display_name("Data pipeline")

# NOTE: This requires GPU quota for custom Vertex AI training jobs
embedding_model_task = (
embedding_model()
.set_display_name("Embedding model")
# TODO: Use GPU when quota is available
# .set_accelerator_type("NVIDIA_TESLA_T4")
# .set_accelerator_limit(1)
.set_accelerator_type("NVIDIA_TESLA_T4")
.set_accelerator_limit(1)
.after(data_pipeline_task)
)

Expand Down
Loading