Added ability to resume previous chat on copilot
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
formatToMessage,
|
||||
getRecentChatFromCopilot
|
||||
} from "@/db"
|
||||
import { copilotResumeLastChat } from "@/services/app"
|
||||
import React from "react"
|
||||
import { SidePanelBody } from "~/components/Sidepanel/Chat/body"
|
||||
import { SidepanelForm } from "~/components/Sidepanel/Chat/form"
|
||||
@@ -19,6 +20,11 @@ const SidepanelChat = () => {
|
||||
useMessage()
|
||||
|
||||
const setRecentMessagesOnLoad = async () => {
|
||||
|
||||
const isEnabled = await copilotResumeLastChat();
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
if (messages.length === 0) {
|
||||
const recentChat = await getRecentChatFromCopilot()
|
||||
if (recentChat) {
|
||||
@@ -86,6 +92,11 @@ const SidepanelChat = () => {
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
React.useEffect(() => {
|
||||
setRecentMessagesOnLoad()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={drop}
|
||||
|
||||
Reference in New Issue
Block a user