socket small changes
This commit is contained in:
parent
7f2ad60a35
commit
4fd659703f
4 changed files with 11 additions and 9 deletions
|
|
@ -26,7 +26,7 @@ export default function Chat({ flow }: ChatType) {
|
||||||
}, []);
|
}, []);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ChatModal flow={flow} open={open} setOpen={setOpen} />
|
<ChatModal key={flow.id} flow={flow} open={open} setOpen={setOpen} />
|
||||||
<ChatTrigger open={open} setOpen={setOpen} flow={flow} />
|
<ChatTrigger open={open} setOpen={setOpen} flow={flow} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
import {
|
import {
|
||||||
ChatBubbleLeftEllipsisIcon,
|
|
||||||
ChatBubbleOvalLeftEllipsisIcon,
|
ChatBubbleOvalLeftEllipsisIcon,
|
||||||
PlusSmallIcon,
|
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ChatMessageType } from "../../../types/chat";
|
import { ChatMessageType } from "../../../types/chat";
|
||||||
import { classNames } from "../../../utils";
|
import { classNames } from "../../../utils";
|
||||||
|
import AiIcon from "../../../assets/Gooey Ring-5s-271px.svg"
|
||||||
import { UserIcon } from "@heroicons/react/24/solid";
|
import { UserIcon } from "@heroicons/react/24/solid";
|
||||||
import {AiFillRobot} from "react-icons/ai"
|
|
||||||
var Convert = require("ansi-to-html");
|
var Convert = require("ansi-to-html");
|
||||||
var convert = new Convert({ newline: true });
|
var convert = new Convert({ newline: true });
|
||||||
|
|
||||||
|
|
@ -22,11 +20,11 @@ export default function ChatMessage({ chat }: { chat: ChatMessageType }) {
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"rounded-full w-8 h-8 flex items-center my-3 justify-center",chat.isSend?"bg-black":"bg-black"
|
"rounded-full w-9 h-9 flex items-center my-3 justify-center",chat.isSend?"bg-gray-200":"bg-gray-200"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{!chat.isSend && <object data={"../"}></object>}
|
{!chat.isSend && <img className="scale-150" src={AiIcon}/>}
|
||||||
{chat.isSend && <img src={"../../../assets/Gooey Ring-5s-271px.svg"}/>}
|
{chat.isSend && <UserIcon/>}
|
||||||
</div>
|
</div>
|
||||||
{!chat.isSend ? (
|
{!chat.isSend ? (
|
||||||
<div className="w-full text-start flex items-center">
|
<div className="w-full text-start flex items-center">
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ export default function ChatModal({ flow, open, setOpen }:{open:boolean,setOpen:
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newWs = new WebSocket(`ws://backend:7860/chat/${flow.id}`);
|
const newWs = new WebSocket(`ws://localhost:7860/chat/${flow.id}`);
|
||||||
newWs.onopen = () => {
|
newWs.onopen = () => {
|
||||||
console.log('WebSocket connection established!');
|
console.log('WebSocket connection established!');
|
||||||
};
|
};
|
||||||
|
|
@ -133,7 +133,6 @@ export default function ChatModal({ flow, open, setOpen }:{open:boolean,setOpen:
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateNodes() {
|
function validateNodes() {
|
||||||
console.log(reactFlowInstance);
|
|
||||||
return reactFlowInstance
|
return reactFlowInstance
|
||||||
.getNodes()
|
.getNodes()
|
||||||
.flatMap((n: NodeType) => validateNode(n));
|
.flatMap((n: NodeType) => validateNode(n));
|
||||||
|
|
|
||||||
5
src/frontend/src/svg.d.ts
vendored
Normal file
5
src/frontend/src/svg.d.ts
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
declare module '*.svg' {
|
||||||
|
const content: any;
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue