Skip to content

Commit

Permalink
Plutopulp/chat app integration (#420)
Browse files Browse the repository at this point in the history
* return pipeline extras field in pipeline container get route

* add all chat functionality to micro frontend

* build frontend

* restore notifications

* BPV

* define chat_model in llama-2 chat example
  • Loading branch information
plutopulp authored Mar 5, 2024
1 parent 364182b commit 5f15958
Show file tree
Hide file tree
Showing 21 changed files with 769 additions and 3 deletions.
3 changes: 2 additions & 1 deletion examples/text-to-text/llama2-13b-chat-vllm/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ pipeline_graph: new_pipeline:my_new_pipeline
pipeline_name: llama2-13b-chat-vllm
description: null
readme: null
extras: {}
extras:
model_type: "chat"
1 change: 1 addition & 0 deletions pipeline/cloud/schemas/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Pipeline(BaseModel):

input_variables: t.List[IOVariable]
output_variables: t.List[IOVariable]
extras: t.Optional[dict]


class PipelineGet(Pipeline):
Expand Down
37 changes: 37 additions & 0 deletions pipeline/container/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pipeline/container/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slider": "^1.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ import {
import { EmptyResourceCard } from "../ui/Cards/EmptyResourceCard";
import { PipelineRunOutput } from "./PipelineRunOutput";
import { Code } from "../ui/Code/Code";
import ChatApp from "./chat-app/ChatApp";
import { ButtonToggle } from "../ui/Buttons/ButtonToggle";
import { Button } from "../ui/Buttons/Button";

export default function PipelinePlayWrapper(): JSX.Element {
const [loading, setLoading] = useState<boolean>(false);
const [runOutputs, setRunOuputs] = useState<RunOutput[] | null>(null);
const [runErrors, setRunError] = useState<RunError | null>(null);
const [activeScreen, setActiveScreen] = useState<"form" | "example">("form");
const [chatAvailable, setChatAvailable] = useState<boolean>(false);

const { data: pipeline, isLoading: isPipelineLoading } = useGetPipeline();

Expand Down Expand Up @@ -51,6 +55,14 @@ export default function PipelinePlayWrapper(): JSX.Element {
handleErrorResult(null);
setLoading(false);
}
console.log(chatAvailable);
// Effects
React.useEffect(() => {
if (pipeline && pipeline?.extras?.model_type === "chat") {
setChatAvailable(true);
setActiveScreen("example");
}
}, [isPipelineLoading]);

// Loading skeleton
if (isPipelineLoading) {
Expand All @@ -68,7 +80,36 @@ export default function PipelinePlayWrapper(): JSX.Element {
return (
<div className="flex flex-col gap-8">
<div className="flex flex-col gap-6">
{chatAvailable ? (
<>
<ButtonToggle>
<Button
colorVariant={
activeScreen === "example" ? "secondary" : "muted"
}
active={activeScreen === "example"}
onClick={() => setActiveScreen("example")}
size="sm"
>
Chat mode
</Button>
<Button
colorVariant={activeScreen === "form" ? "secondary" : "muted"}
active={activeScreen === "form"}
onClick={() => setActiveScreen("form")}
size="sm"
>
Request builder
</Button>
</ButtonToggle>
</>
) : null}
<div className="flex flex-col gap-8 lg:flex-row max-w-full ">
{pipeline && activeScreen === "example" ? (
<div className="w-full vcol2:min-w-vcol2 vcol2:w-vcol2 max-w-full vcol2:max-w-vcol2">
<ChatApp pipeline={pipeline} />
</div>
) : null}
{activeScreen === "form" ? (
<div className="vcol-row vcol-row-2 shadow-sm">
<PipelinePlayColumn title="Inputs" className="vcol-col-first">
Expand Down
Loading

0 comments on commit 5f15958

Please sign in to comment.