mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-07 19:34:04 +00:00
fix: solve the conflict
This commit is contained in:
commit
51c6f0064a
@ -1,8 +1,3 @@
|
||||
{
|
||||
"extends": "next/core-web-vitals",
|
||||
"rules": {
|
||||
"indent": ["warning", 2, {
|
||||
"SwitchCase": 1
|
||||
}]
|
||||
}
|
||||
"extends": "next/core-web-vitals"
|
||||
}
|
||||
|
@ -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: () => <p>Loading...</p>,
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
const DynamicAgentPage = (props: any) => {
|
||||
return (
|
||||
<div className='mx-auto flex h-full max-w-3xl flex-col gap-6 px-5 py-6 sm:gap-8 xl:max-w-5xl '>
|
||||
<ChatBoxComp
|
||||
initialMessage={historyList?.data ? (historyList?.data?.length <= 0 ? props.searchParams?.initMessage : undefined) : undefined}
|
||||
clearIntialMessage={async () => {
|
||||
await refreshDialogList();
|
||||
}}
|
||||
messages={history || []}
|
||||
onSubmit={handleChatSubmit}
|
||||
paramsList={paramsList?.data}
|
||||
/>
|
||||
</div>
|
||||
<DynamicWrapper {...props} />
|
||||
)
|
||||
}
|
||||
export default AgentPage;
|
||||
export default DynamicAgentPage;
|
@ -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 = () => {
|
||||
<Grid key={item.label} xs={3}>
|
||||
<Card className="flex-1 h-full">
|
||||
<CardContent className="justify-around">
|
||||
<Typography gutterBottom variant="h5" component="div">
|
||||
<Typography gutterBottom component="div">
|
||||
{item.label}
|
||||
</Typography>
|
||||
<Typography variant="body2">
|
||||
<Typography>
|
||||
{item.value}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
@ -134,7 +134,7 @@ const Agents = () => {
|
||||
<Item className='flex-1'>
|
||||
<Card className='h-full'>
|
||||
<CardContent className='h-full'>
|
||||
<Typography gutterBottom variant="h5" component="div">
|
||||
<Typography gutterBottom component="div">
|
||||
Revenue Won by Month
|
||||
</Typography>
|
||||
<div className='flex-1'>
|
||||
@ -156,7 +156,7 @@ const Agents = () => {
|
||||
<Grid xs={4} className='h-full'>
|
||||
<Card className='flex-1 h-full'>
|
||||
<CardContent className='h-full'>
|
||||
<Typography gutterBottom variant="h5" component="div">
|
||||
<Typography gutterBottom component="div">
|
||||
Close % by Month
|
||||
</Typography>
|
||||
<div className='flex-1'>
|
||||
@ -171,7 +171,7 @@ const Agents = () => {
|
||||
<Grid xs={4} className='h-full'>
|
||||
<Card className='flex-1 h-full'>
|
||||
<CardContent className='h-full'>
|
||||
<Typography gutterBottom variant="h5" component="div">
|
||||
<Typography gutterBottom component="div">
|
||||
Close % by Month
|
||||
</Typography>
|
||||
<div className='flex-1'>
|
||||
@ -186,7 +186,7 @@ const Agents = () => {
|
||||
<Grid xs={4} className='h-full'>
|
||||
<Card className='flex-1 h-full'>
|
||||
<CardContent className='h-full'>
|
||||
<Typography gutterBottom variant="h5" component="div">
|
||||
<Typography gutterBottom component="div">
|
||||
Close % by Month
|
||||
</Typography>
|
||||
<div className='flex-1'>
|
||||
|
@ -10,7 +10,7 @@ export const [useDialogueContext, DialogueProvider] = createCtx<{
|
||||
refreshDialogList: () => void;
|
||||
}>();
|
||||
|
||||
export default ({ children }: {
|
||||
const DialogueContext = ({ children }: {
|
||||
children: React.ReactElement
|
||||
}) => {
|
||||
const {
|
||||
@ -33,3 +33,5 @@ export default ({ children }: {
|
||||
</DialogueProvider>
|
||||
)
|
||||
}
|
||||
|
||||
export default DialogueContext;
|
@ -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';
|
||||
|
||||
|
@ -39,7 +39,7 @@ export default function Home() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={`${mode} absolute z-20 top-0 inset-x-0 flex justify-center overflow-hidden pointer-events-none`}>
|
||||
<div className={`absolute z-20 top-0 inset-x-0 flex justify-center overflow-hidden pointer-events-none`}>
|
||||
<div className='w-[108rem] flex-none flex justify-end'>
|
||||
<picture>
|
||||
<source srcSet='/bg1.avif' type='image/avif'></source>
|
||||
|
53
datacenter/components/agentPage.tsx
Normal file
53
datacenter/components/agentPage.tsx
Normal file
@ -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 (
|
||||
<div className='mx-auto flex h-full max-w-3xl flex-col gap-6 px-5 py-6 sm:gap-8 xl:max-w-5xl '>
|
||||
<ChatBoxComp
|
||||
initialMessage={historyList?.data ? (historyList?.data?.length <= 0 ? props.searchParams?.initMessage : undefined) : undefined}
|
||||
clearIntialMessage={async () => {
|
||||
await refreshDialogList();
|
||||
}}
|
||||
messages={history || []}
|
||||
onSubmit={handleChatSubmit}
|
||||
paramsList={paramsList?.data}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default AgentPage;
|
@ -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;
|
||||
|
@ -1,7 +1,11 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: 'export',
|
||||
experimental: {
|
||||
esmExternals: 'loose'
|
||||
},
|
||||
typescript: {
|
||||
ignoreBuildErrors: true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user