Ensure only one handler for diff apply

This commit is contained in:
Luo Tim 2024-06-12 13:58:39 +08:00
parent 2bfcc6cc30
commit c9d42be9d4
2 changed files with 5 additions and 6 deletions

View File

@ -9,12 +9,12 @@ import {
useViewportSize,
} from "@mantine/hooks";
import messageUtil from "@/util/MessageUtil";
import APIUtil from "@/util/APIUtil";
import StopButton from "@/views/components/StopButton";
import RegenerationButton from "@/views/components/RegenerationButton";
import { observer } from "mobx-react-lite";
import { useMst } from "@/views/stores/RootStore";
import { Message } from "@/views/stores/ChatStore";
import type { Item } from "@/views/stores/InputStore";
import InputMessage from "@/views/components/InputMessage";
import MessageList from "@/views/components/MessageList";
@ -155,6 +155,10 @@ const chatPanel = observer(() => {
chat.updateFeatures(message.features);
}
);
messageUtil.registerHandler("codeDiffApply", (_: any) => {
const e = 'code_diff_apply'
APIUtil.createEvent({name: e, value: e})
})
messageUtil.sendMessage({ command: "regCommandList" });

View File

@ -3,7 +3,6 @@ import messageUtil from "@/util/MessageUtil";
import { ChatContext } from "@/views/stores/InputStore";
import yaml from "js-yaml";
import { RootInstance } from "./RootStore";
import { useTranslation } from "react-i18next";
import i18next from "i18next";
import APIUtil from "@/util/APIUtil";
@ -174,10 +173,6 @@ export const ChatStore = types
self.currentMessage = "";
const config = getParent<RootInstance>(self).config
const chatModel = config.getDefaultModel();
messageUtil.registerHandler("codeDiffApply", (_: any) => {
const e = 'code_diff_apply'
APIUtil.createEvent({name: e, value: e})
})
messageUtil.sendMessage({
command: "sendMessage",
text: text,