mirror of
https://github.com/coaidev/coai.git
synced 2025-05-31 19:00:22 +09:00
fix: fix midjourney virtual message life cycle
This commit is contained in:
parent
e0b89817d4
commit
19c09aba62
@ -46,9 +46,9 @@ import {
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog.tsx";
|
||||
import { DialogClose } from "@radix-ui/react-dialog";
|
||||
import { posterEvent } from "@/events/poster.ts";
|
||||
import { appLogo } from "@/conf/env.ts";
|
||||
import { subscriptionDataSelector } from "@/store/globals.ts";
|
||||
import { useMessageActions } from "@/store/chat.ts";
|
||||
|
||||
type MarkdownProps = {
|
||||
children: string;
|
||||
@ -116,6 +116,7 @@ function MarkdownContent({
|
||||
const dispatch = useDispatch();
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
const { send: sendAction } = useMessageActions();
|
||||
|
||||
const subscription = useSelector(subscriptionDataSelector);
|
||||
|
||||
@ -221,7 +222,6 @@ function MarkdownContent({
|
||||
if (url.startsWith("https://chatnio.virtual")) {
|
||||
const message = url.slice(23).replace(/-/g, " ");
|
||||
const prefix = message.split(" ")[0];
|
||||
const send = () => posterEvent.emit(message);
|
||||
|
||||
return (
|
||||
<Dialog>
|
||||
@ -246,7 +246,7 @@ function MarkdownContent({
|
||||
<DialogClose asChild>
|
||||
<Button variant={`outline`}>{t("cancel")}</Button>
|
||||
</DialogClose>
|
||||
<DialogClose onClick={send} asChild>
|
||||
<DialogClose onClick={async () => await sendAction(message)} asChild>
|
||||
<Button variant={`default`}>{t("confirm")}</Button>
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
|
@ -35,7 +35,6 @@ import ScrollAction from "@/components/home/assemblies/ScrollAction.tsx";
|
||||
import { cn } from "@/components/ui/lib/utils.ts";
|
||||
import { goAuth } from "@/utils/app.ts";
|
||||
import { getModelFromId } from "@/conf/model.ts";
|
||||
import { posterEvent } from "@/events/poster.ts";
|
||||
|
||||
type InterfaceProps = {
|
||||
scrollable: boolean;
|
||||
@ -116,10 +115,6 @@ function ChatWrapper() {
|
||||
process({ id: current, event: "stop" });
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
posterEvent.bind((data) => processSend(data, true));
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener("load", () => {
|
||||
const el = document.getElementById("input");
|
||||
|
@ -1,5 +0,0 @@
|
||||
import { EventCommitter } from "@/events/struct.ts";
|
||||
|
||||
export const posterEvent = new EventCommitter<string>({
|
||||
name: "poster",
|
||||
});
|
Loading…
Reference in New Issue
Block a user