diff --git a/datacenter/.eslintrc.json b/datacenter/.eslintrc.json
index fb3c42820..bffb357a7 100644
--- a/datacenter/.eslintrc.json
+++ b/datacenter/.eslintrc.json
@@ -1,8 +1,3 @@
{
- "extends": "next/core-web-vitals",
- "rules": {
- "indent": ["warning", 2, {
- "SwitchCase": 1
- }]
- }
+ "extends": "next/core-web-vitals"
}
diff --git a/datacenter/app/agents/[agentId]/page.tsx b/datacenter/app/agents/[agentId]/page.tsx
index 61a99ee10..1734d0727 100644
--- a/datacenter/app/agents/[agentId]/page.tsx
+++ b/datacenter/app/agents/[agentId]/page.tsx
@@ -1,44 +1,14 @@
"use client"
-import { useRequest } from 'ahooks';
-import { sendGetRequest, sendPostRequest } from '@/utils/request';
-import useAgentChat from '@/hooks/useAgentChat';
-import ChatBoxComp from '@/components/chatBox';
-import { useDialogueContext } from '@/app/context/dialogue';
+import dynamic from 'next/dynamic'
-const AgentPage = (props) => {
- const { refreshDialogList } = useDialogueContext();
-
- const { data: historyList } = useRequest(async () => await sendGetRequest('/v1/chat/dialogue/messages/history', {
- con_uid: props.params?.agentId
- }), {
- ready: !!props.params?.agentId
- });
-
- const { data: paramsList } = useRequest(async () => await sendPostRequest(`/v1/chat/mode/params/list?chat_mode=${props.searchParams?.scene}`), {
- ready: !!props.searchParams?.scene
- });
-
- const { history, handleChatSubmit } = useAgentChat({
- queryAgentURL: `http://30.183.154.8:5000/v1/chat/completions`,
- queryBody: {
- conv_uid: props.params?.agentId,
- chat_mode: props.searchParams?.scene || 'chat_normal',
- },
- initHistory: historyList?.data
- });
+const DynamicWrapper = dynamic(() => import ('@/components/agentPage'), {
+ loading: () =>
Loading...
,
+ ssr: false,
+});
+const DynamicAgentPage = (props: any) => {
return (
-
- {
- await refreshDialogList();
- }}
- messages={history || []}
- onSubmit={handleChatSubmit}
- paramsList={paramsList?.data}
- />
-
+
)
}
-export default AgentPage;
\ No newline at end of file
+export default DynamicAgentPage;
\ No newline at end of file
diff --git a/datacenter/app/agents/page.tsx b/datacenter/app/agents/page.tsx
index d808b340d..814e03efe 100644
--- a/datacenter/app/agents/page.tsx
+++ b/datacenter/app/agents/page.tsx
@@ -16,7 +16,7 @@ const Item = styled(Sheet)(({ theme }) => ({
const Agents = () => {
const { handleChatSubmit, history } = useAgentChat({
- queryAgentURL: `http://30.183.154.8:5000/v1/chat/completions`,
+ queryAgentURL: `http://30.183.153.109:5000/v1/chat/completions`,
});
const data = [
@@ -119,10 +119,10 @@ const Agents = () => {
-
+
{item.label}
-
+
{item.value}
@@ -134,7 +134,7 @@ const Agents = () => {
-
-
+
Revenue Won by Month
@@ -156,7 +156,7 @@ const Agents = () => {
-
+
Close % by Month
@@ -171,7 +171,7 @@ const Agents = () => {
-
+
Close % by Month
@@ -186,7 +186,7 @@ const Agents = () => {
-
+
Close % by Month
diff --git a/datacenter/app/context/dialogue.tsx b/datacenter/app/context/dialogue.tsx
index 208409aff..8629ff403 100644
--- a/datacenter/app/context/dialogue.tsx
+++ b/datacenter/app/context/dialogue.tsx
@@ -10,7 +10,7 @@ export const [useDialogueContext, DialogueProvider] = createCtx<{
refreshDialogList: () => void;
}>();
-export default ({ children }: {
+const DialogueContext = ({ children }: {
children: React.ReactElement
}) => {
const {
@@ -32,4 +32,6 @@ export default ({ children }: {
{children}
)
-}
\ No newline at end of file
+}
+
+export default DialogueContext;
\ No newline at end of file
diff --git a/datacenter/app/layout.tsx b/datacenter/app/layout.tsx
index 35e2ac81d..a4a9a8811 100644
--- a/datacenter/app/layout.tsx
+++ b/datacenter/app/layout.tsx
@@ -1,9 +1,9 @@
"use client"
import './globals.css'
-import './nprogress.css';
+import '@/nprogress.css';
import LeftSider from '@/components/leftSider';
import { CssVarsProvider, ThemeProvider } from '@mui/joy/styles';
-import { joyTheme } from './defaultTheme';
+import { joyTheme } from '@/defaultTheme';
import TopProgressBar from '@/components/topProgressBar';
import DialogueContext from './context/dialogue';
diff --git a/datacenter/app/page.tsx b/datacenter/app/page.tsx
index 6c43b4e03..61384178f 100644
--- a/datacenter/app/page.tsx
+++ b/datacenter/app/page.tsx
@@ -39,7 +39,7 @@ export default function Home() {
return (
<>
-
+
diff --git a/datacenter/components/agentPage.tsx b/datacenter/components/agentPage.tsx
new file mode 100644
index 000000000..9caffbeaa
--- /dev/null
+++ b/datacenter/components/agentPage.tsx
@@ -0,0 +1,53 @@
+"use client"
+import { useRequest } from 'ahooks';
+import { sendGetRequest, sendPostRequest } from '@/utils/request';
+import useAgentChat from '@/hooks/useAgentChat';
+import ChatBoxComp from '@/components/chatBox';
+import { useDialogueContext } from '@/app/context/dialogue';
+
+const AgentPage = (props: {
+ params: {
+ agentId?: string;
+ },
+ searchParams: {
+ scene?: string;
+ initMessage?: string;
+ }
+}) => {
+ const { refreshDialogList } = useDialogueContext();
+
+ const { data: historyList } = useRequest(async () => await sendGetRequest('/v1/chat/dialogue/messages/history', {
+ con_uid: props.params?.agentId
+ }), {
+ ready: !!props.params?.agentId
+ });
+
+ const { data: paramsList } = useRequest(async () => await sendPostRequest(`/v1/chat/mode/params/list?chat_mode=${props.searchParams?.scene}`), {
+ ready: !!props.searchParams?.scene
+ });
+
+ const { history, handleChatSubmit } = useAgentChat({
+ queryAgentURL: `http://30.183.153.109:5000/v1/chat/completions`,
+ queryBody: {
+ conv_uid: props.params?.agentId,
+ chat_mode: props.searchParams?.scene || 'chat_normal',
+ },
+ initHistory: historyList?.data
+ });
+
+ return (
+
+ {
+ await refreshDialogList();
+ }}
+ messages={history || []}
+ onSubmit={handleChatSubmit}
+ paramsList={paramsList?.data}
+ />
+
+ )
+}
+
+export default AgentPage;
\ No newline at end of file
diff --git a/datacenter/components/topProgressBar.tsx b/datacenter/components/topProgressBar.tsx
index 70541190b..46385524d 100644
--- a/datacenter/components/topProgressBar.tsx
+++ b/datacenter/components/topProgressBar.tsx
@@ -33,26 +33,28 @@ Router.events.on('routeChangeStart', load);
Router.events.on('routeChangeComplete', stop);
Router.events.on('routeChangeError', stop);
-const originalFetch = window.fetch;
-window.fetch = async function (...args) {
- if (activeRequests === 0) {
- load();
- }
-
- activeRequests++;
-
- try {
- const response = await originalFetch(...args);
- return response;
- } catch (error) {
- return Promise.reject(error);
- } finally {
- activeRequests -= 1;
+if (typeof window !== 'undefined' && typeof window?.fetch === 'function') {
+ const originalFetch = window.fetch;
+ window.fetch = async function (...args) {
if (activeRequests === 0) {
- stop();
+ load();
}
- }
-};
+
+ activeRequests++;
+
+ try {
+ const response = await originalFetch(...args);
+ return response;
+ } catch (error) {
+ return Promise.reject(error);
+ } finally {
+ activeRequests -= 1;
+ if (activeRequests === 0) {
+ stop();
+ }
+ }
+ };
+}
export default function TopProgressBar() {
return null;
diff --git a/datacenter/app/defaultTheme.ts b/datacenter/defaultTheme.ts
similarity index 100%
rename from datacenter/app/defaultTheme.ts
rename to datacenter/defaultTheme.ts
diff --git a/datacenter/next.config.js b/datacenter/next.config.js
index ca4a6f7d0..981da9faa 100644
--- a/datacenter/next.config.js
+++ b/datacenter/next.config.js
@@ -1,7 +1,11 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
+ output: 'export',
experimental: {
esmExternals: 'loose'
+ },
+ typescript: {
+ ignoreBuildErrors: true
}
}
diff --git a/datacenter/app/nprogress.css b/datacenter/nprogress.css
similarity index 100%
rename from datacenter/app/nprogress.css
rename to datacenter/nprogress.css
diff --git a/datacenter/utils/request.ts b/datacenter/utils/request.ts
index 65022c9bd..8fbc89ba8 100644
--- a/datacenter/utils/request.ts
+++ b/datacenter/utils/request.ts
@@ -2,7 +2,7 @@ import { message } from 'antd';
import axios from 'axios';
import { isPlainObject } from 'lodash';
-axios.defaults.baseURL = 'http://30.183.154.8:5000';
+axios.defaults.baseURL = 'http://30.183.153.109:5000';
axios.defaults.timeout = 10000;