Skip to content

Commit

Permalink
fix chat agent delete
Browse files Browse the repository at this point in the history
  • Loading branch information
an-lee committed Aug 15, 2024
1 parent 75faa44 commit 94639b3
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions enjoy/src/renderer/components/chats/chat-agent-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
SelectValue,
Slider,
Textarea,
toast,
} from "@renderer/components/ui";
import { t } from "i18next";
import { LANGUAGES } from "@/constants";
Expand All @@ -50,7 +49,7 @@ export const ChatAgentForm = (props: {
onDestroy: () => void;
}) => {
const { agent, onSave, onDestroy } = props;
const { learningLanguage, webApi, EnjoyApp } = useContext(
const { learningLanguage, webApi } = useContext(
AppSettingsProviderContext
);
const { openai } = useContext(AISettingsProviderContext);
Expand Down Expand Up @@ -127,15 +126,6 @@ export const ChatAgentForm = (props: {
setGptProviders({ ...providers });
};

const destroyChatAgent = async () => {
EnjoyApp.chatAgents
.destroy(agent.id)
.then(() => onDestroy())
.catch((e) => {
toast.error(t(e.message));
});
};

const refreshTtsProviders = async () => {
let providers = TTS_PROVIDERS;

Expand Down Expand Up @@ -455,7 +445,7 @@ export const ChatAgentForm = (props: {
<AlertDialogCancel>{t("cancel")}</AlertDialogCancel>
<AlertDialogAction
className="bg-destructive hover:bg-destructive-hover"
onClick={destroyChatAgent}
onClick={onDestroy}
>
{t("delete")}
</AlertDialogAction>
Expand Down

0 comments on commit 94639b3

Please sign in to comment.