clean function implemented on front
This commit is contained in:
parent
4cc2babcf1
commit
101044946d
4 changed files with 16 additions and 11 deletions
|
|
@ -61,5 +61,5 @@
|
|||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"proxy": "http://backend:7860"
|
||||
"proxy": "http://127.0.0.1:5003"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ export default function ChatMessage({ chat }: { chat: ChatMessageType }) {
|
|||
>
|
||||
<div
|
||||
className={classNames(
|
||||
"rounded-full w-9 h-9 flex items-center my-3 justify-center",
|
||||
chat.isSend ? "bg-gray-200" : "bg-gray-200"
|
||||
"rounded-full w-8 h-8 flex items-center my-3 justify-center",
|
||||
chat.isSend ? "bg-gray-900" : "bg-gray-200"
|
||||
)}
|
||||
>
|
||||
{!chat.isSend && <img className="scale-150" src={AiIcon} />}
|
||||
{chat.isSend && <UserIcon />}
|
||||
{chat.isSend && <UserIcon className="w-6 h-6 -mb-1 text-gray-200" />}
|
||||
</div>
|
||||
{!chat.isSend ? (
|
||||
<div className="w-full text-start flex items-center">
|
||||
|
|
@ -49,7 +49,7 @@ export default function ChatMessage({ chat }: { chat: ChatMessageType }) {
|
|||
)}
|
||||
{chat.thought && chat.thought !== "" && !hidden && <br></br>}
|
||||
<div className="w-full px-4 pb-3 pt-3 pr-8">
|
||||
{chat.file ? (
|
||||
{chat.files ? (
|
||||
<div></div>
|
||||
) : (
|
||||
<span>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export default function ChatModal({
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
const newWs = new WebSocket(`ws://localhost:7860/chat/${flow.id}`);
|
||||
const newWs = new WebSocket(`ws://127.0.0.1:5003/chat/${flow.id}`);
|
||||
newWs.onopen = () => {
|
||||
console.log("WebSocket connection established!");
|
||||
};
|
||||
|
|
@ -78,7 +78,6 @@ export default function ChatModal({
|
|||
isSend: !chatItem.is_bot,
|
||||
message: chatItem.message,
|
||||
thought: chatItem.intermediate_steps,
|
||||
file:chatItem.data
|
||||
});
|
||||
}
|
||||
newChatHistory.push({
|
||||
|
|
@ -217,7 +216,8 @@ export default function ChatModal({
|
|||
}
|
||||
function clearChat() {
|
||||
setChatHistory([]);
|
||||
updateFlow({ ..._.cloneDeep(flow), chat: [] });
|
||||
ws.send(JSON.stringify({clear_history:true}))
|
||||
|
||||
}
|
||||
|
||||
const { closePopUp } = useContext(PopUpContext);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
import { ReactFlowInstance } from 'reactflow';
|
||||
import { ReactFlowInstance } from "reactflow";
|
||||
import { FlowType } from "../flow";
|
||||
|
||||
export type ChatType = {flow:FlowType,reactFlowInstance:ReactFlowInstance}
|
||||
export type ChatMessageType = { message: string; isSend: boolean, thought?:string,file?:string }
|
||||
export type ChatType = { flow: FlowType; reactFlowInstance: ReactFlowInstance };
|
||||
export type ChatMessageType = {
|
||||
message: string;
|
||||
isSend: boolean;
|
||||
thought?: string;
|
||||
files?: Array<{content:string,type:string}>;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue