Skip to content

Commit

Permalink
Merge pull request #190 from premAI-io/hotfix/stream-only-chat
Browse files Browse the repository at this point in the history
keeping stream version of chat
  • Loading branch information
filopedraz authored Jun 27, 2023
2 parents 0a7c690 + 0a5f8a1 commit 7945fd6
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 172 deletions.
9 changes: 1 addition & 8 deletions src/modules/prem-chat/components/PremChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ function PremChat() {
);
}

return (
<PremChatContainer
chatId={chatId}
serviceName={service?.name!}
serviceId={serviceId!}
isStreaming={service?.modelInfo.streaming!}
/>
);
return <PremChatContainer chatId={chatId} serviceName={service?.name!} serviceId={serviceId!} />;
}

export default PremChat;
11 changes: 3 additions & 8 deletions src/modules/prem-chat/components/PremChatContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useEffect, useRef, useState } from "react";
import UserReply from "shared/components/UserReply";
import BotReply from "shared/components/BotReply";
import usePremChat from "shared/hooks/usePremChat";
import InputBox from "./InputBox";
import PremChatSidebar from "./PremChatSidebar";
import RegenerateButton from "./RegenerateButton";
Expand All @@ -11,13 +10,9 @@ import { Message, PremChatContainerProps } from "../types";
import clsx from "clsx";
import { useMediaQuery, useWindowSize } from "usehooks-ts";
import useBodyLock from "shared/hooks/useBodyLock";
import usePremChatStream from "shared/hooks/usePremChatStream";

const PremChatContainer = ({
chatId,
isStreaming,
serviceId,
serviceName,
}: PremChatContainerProps) => {
const PremChatContainer = ({ chatId, serviceId, serviceName }: PremChatContainerProps) => {
const model = serviceId;
const [rightSidebar, setRightSidebar] = useState(false);
const [hamburgerMenuOpen, setHamburgerMenu] = useState<boolean>(true);
Expand All @@ -27,7 +22,7 @@ const PremChatContainer = ({
const responsiveMatches = useMediaQuery("(min-width: 768px)");

const { chatMessages, onSubmit, question, setQuestion, isLoading, isError, onRegenerate } =
usePremChat(isStreaming, serviceId!, chatId || null);
usePremChatStream(serviceId, chatId || null);

const { bodyLocked, setBodyLocked } = useBodyLock();
const hamburgerMenuToggle = () => {
Expand Down
1 change: 0 additions & 1 deletion src/modules/prem-chat/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export type HamburgerMenuProps = {

export type PremChatContainerProps = {
chatId: string | undefined;
isStreaming: boolean;
serviceId: string;
serviceName: string;
};
15 changes: 0 additions & 15 deletions src/shared/hooks/usePremChat.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/shared/hooks/usePremChatStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const usePremChatStream = (serviceId: string, chatId: string | null): PremChatRe
backendUrl.port = `${service?.runningPort!}`;

try {
fetchEventSource(`${backendUrl}api/v1/chat/completions`, {
fetchEventSource(`${backendUrl}v1/chat/completions`, {
method: "POST",
openWhenHidden: true,
headers: {
Expand Down
139 changes: 0 additions & 139 deletions src/shared/hooks/usePremChatWithoutStream.ts

This file was deleted.

0 comments on commit 7945fd6

Please sign in to comment.