mirror of
https://github.com/Mintplex-Labs/anything-llm
synced 2026-04-26 01:25:15 +02:00
* Init support of i18n and English and mandarin * Update common.js (#1320) * add General Appearance and Chat setting zh translate (#1414) * add config zh translate (#1461) * patch some translation pages * Update locality fixes * update: complete login page Mandarin translation. (#1709) update: complete Mandarin translation. * complete translation * update github to run validator * bump to test workflow failure * bump to fix tests * update workflow * refactor lang selector support * add Spanish and French * add dictionaries --------- Co-authored-by: GetOffer.help <13744916+getofferhelp@users.noreply.github.com> Co-authored-by: AIR <129256286+KochabStar@users.noreply.github.com> Co-authored-by: Ezio T <ezio5600@gmail.com>
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
import { useState } from "react";
|
|
import Workspace from "@/models/workspace";
|
|
import showToast from "@/utils/toast";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
export default function ResetDatabase({ workspace }) {
|
|
const [deleting, setDeleting] = useState(false);
|
|
const { t } = useTranslation();
|
|
const resetVectorDatabase = async () => {
|
|
if (!window.confirm(`${t("vector-workspace.reset.confirm")}`)) return false;
|
|
|
|
setDeleting(true);
|
|
const success = await Workspace.wipeVectorDb(workspace.slug);
|
|
if (!success) {
|
|
showToast(
|
|
t("vector-workspace.reset.error"),
|
|
t("vector-workspace.common.error"),
|
|
{
|
|
clear: true,
|
|
}
|
|
);
|
|
setDeleting(false);
|
|
return;
|
|
}
|
|
|
|
showToast(
|
|
t("vector-workspace.reset.success"),
|
|
t("vector-workspace.common.success"),
|
|
{
|
|
clear: true,
|
|
}
|
|
);
|
|
setDeleting(false);
|
|
};
|
|
|
|
return (
|
|
<button
|
|
disabled={deleting}
|
|
onClick={resetVectorDatabase}
|
|
type="button"
|
|
className="border-none w-fit transition-all duration-300 border border-transparent rounded-lg whitespace-nowrap text-sm px-5 py-2.5 focus:z-10 bg-red-500/25 text-red-200 hover:text-white hover:bg-red-600 disabled:bg-red-600 disabled:text-red-200 disabled:animate-pulse"
|
|
>
|
|
{deleting
|
|
? t("vector-workspace.reset.resetting")
|
|
: t("vector-workspace.reset.reset")}
|
|
</button>
|
|
);
|
|
}
|