button to delete all chatstore

This commit is contained in:
2023-10-25 14:32:56 +08:00
parent 695221d912
commit abeccd6aa9

View File

@@ -306,6 +306,29 @@ export function App() {
> >
{Tr("DEL")} {Tr("DEL")}
</button> </button>
{chatStore.develop_mode && (
<button
className="rounded bg-rose-800 p-1 my-1 w-full text-white"
onClick={() => {
if (
!confirm(
"Are you sure you want to delete **ALL** chat history?"
)
)
return;
for (const i of allChatStoreIndexes) {
console.log("remove item", `${STORAGE_NAME}-${i}`);
localStorage.removeItem(`${STORAGE_NAME}-${i}`);
}
setAllChatStoreIndexes([]);
setSelectedChatIndex(0);
// reload page
window.location.reload();
}}
>
{Tr("CLS")}
</button>
)}
</div> </div>
<ChatBOX <ChatBOX
chatStore={chatStore} chatStore={chatStore}