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

Plutopulp/chat app integration #420

Merged
merged 6 commits into from
Mar 5, 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
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
Loading