Skip to content

Let's use AI to Earn!

fix: 修复chat报错的问题

gaoSird294fbcf1202
diff --git a/src/app/[lng]/appChat/AppChatCore.tsx b/src/app/[lng]/appChat/AppChatCore.tsx
new file mode 100644
index 00000000..930da503
--- /dev/null
+++ b/src/app/[lng]/appChat/AppChatCore.tsx
@@ -0,0 +1,20 @@
+"use client";
+
+import * as React from "react";
+import { useEffect, useState } from "react";
+
+export const AppChatCore = () => {
+ const [iframeUrl, setIframeUrl] = useState("");
+
+ useEffect(() => {
+ setIframeUrl(
+ `${
+ location.origin.includes("localhost")
+ ? "https://dev.aitoearn.ai"
+ : location.origin
+ }/chat`,
+ );
+ }, []);
+
+ return <iframe src={iframeUrl} style={{ height: "100%", border: "none" }} />;
+};
diff --git a/src/app/[lng]/appChat/page.tsx b/src/app/[lng]/appChat/page.tsx
index 6d6a88df..ca3fa1d9 100644
--- a/src/app/[lng]/appChat/page.tsx
+++ b/src/app/[lng]/appChat/page.tsx
@@ -1,6 +1,7 @@
import { PageParams } from "@/app/globals";
import * as React from "react";
import { getMetadata } from "@/utils/general";
+import { AppChatCore } from "@/app/[lng]/appChat/AppChatCore";
export async function generateMetadata({ params }: PageParams) {
return await getMetadata(
@@ -12,14 +13,5 @@ export async function generateMetadata({ params }: PageParams) {
}
export default function Page({ params }: PageParams) {
- return (
- <iframe
- src={`${
- location.origin.includes("localhost")
- ? "https://dev.aitoearn.ai"
- : location.origin
- }/chat`}
- style={{ height: "100%", border: "none" }}
- />
- );
+ return <AppChatCore />;
}