Skip to content

Commit

Permalink
fix: fix midjourney virtual message life cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Mar 9, 2024
1 parent e0b8981 commit 19c09ab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app/src/components/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -116,6 +116,7 @@ function MarkdownContent({
const dispatch = useDispatch();
const { t } = useTranslation();
const { toast } = useToast();
const { send: sendAction } = useMessageActions();

const subscription = useSelector(subscriptionDataSelector);

Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down
5 changes: 0 additions & 5 deletions app/src/components/home/ChatWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
5 changes: 0 additions & 5 deletions app/src/events/poster.ts

This file was deleted.

0 comments on commit 19c09ab

Please sign in to comment.