Revert "Convert conversationId int to string before making api request to bulk update file filters"

This reverts commit c9665fb20b.

Revert "Fix handling for new conversation in agents page"

This reverts commit 3466f04992.

Revert "Add a unique_id field for identifiying conversations (#914)"

This reverts commit ece2ec2d90.
This commit is contained in:
sabaimran
2024-09-18 20:34:04 -07:00
parent bb2bd77a64
commit 0a568244fd
12 changed files with 29 additions and 178 deletions

View File

@@ -32,8 +32,7 @@ interface ChatBodyDataProps {
function ChatBodyData(props: ChatBodyDataProps) {
const searchParams = useSearchParams();
const conversationUniqueId = searchParams.get("v");
const [conversationId, setConversationId] = useState<string | null>("");
const conversationId = searchParams.get("conversationId");
const [message, setMessage] = useState("");
const [image, setImage] = useState<string | null>(null);
const [processingMessage, setProcessingMessage] = useState(false);
@@ -61,11 +60,6 @@ function ChatBodyData(props: ChatBodyDataProps) {
setProcessingMessage(true);
setQueryToProcess(storedMessage);
}
const conversationId = localStorage.getItem("conversationId");
if (conversationId) {
setConversationId(conversationId);
}
}, [setQueryToProcess]);
useEffect(() => {
@@ -75,30 +69,6 @@ function ChatBodyData(props: ChatBodyDataProps) {
}
}, [message, setQueryToProcess]);
useEffect(() => {
if (!conversationUniqueId) {
return;
}
fetch(
`/api/chat/metadata?conversation_unique_id=${encodeURIComponent(conversationUniqueId)}`,
)
.then((response) => {
if (!response.ok) {
throw new Error(response.statusText);
}
return response.json();
})
.then((data) => {
setConversationId(data.conversationId);
})
.catch((err) => {
console.error(err);
setConversationId(null);
return;
});
});
useEffect(() => {
if (conversationId) {
onConversationIdChange?.(conversationId);
@@ -117,15 +87,11 @@ function ChatBodyData(props: ChatBodyDataProps) {
}
}, [props.streamedMessages]);
if (!conversationUniqueId || conversationId === null) {
if (!conversationId) {
window.location.href = "/";
return;
}
if (!conversationId) {
return <Loading />;
}
return (
<>
<div className={false ? styles.chatBody : styles.chatBodyFull}>