mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-09 20:28:07 +00:00
fix: solve the conflict
This commit is contained in:
commit
51c6f0064a
@ -1,8 +1,3 @@
|
|||||||
{
|
{
|
||||||
"extends": "next/core-web-vitals",
|
"extends": "next/core-web-vitals"
|
||||||
"rules": {
|
|
||||||
"indent": ["warning", 2, {
|
|
||||||
"SwitchCase": 1
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,14 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useRequest } from 'ahooks';
|
import dynamic from 'next/dynamic'
|
||||||
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) => {
|
const DynamicWrapper = dynamic(() => import ('@/components/agentPage'), {
|
||||||
const { refreshDialogList } = useDialogueContext();
|
loading: () => <p>Loading...</p>,
|
||||||
|
ssr: false,
|
||||||
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 DynamicAgentPage = (props: any) => {
|
||||||
return (
|
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 '>
|
<DynamicWrapper {...props} />
|
||||||
<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;
|
export default DynamicAgentPage;
|
@ -16,7 +16,7 @@ const Item = styled(Sheet)(({ theme }) => ({
|
|||||||
|
|
||||||
const Agents = () => {
|
const Agents = () => {
|
||||||
const { handleChatSubmit, history } = useAgentChat({
|
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 = [
|
const data = [
|
||||||
@ -119,10 +119,10 @@ const Agents = () => {
|
|||||||
<Grid key={item.label} xs={3}>
|
<Grid key={item.label} xs={3}>
|
||||||
<Card className="flex-1 h-full">
|
<Card className="flex-1 h-full">
|
||||||
<CardContent className="justify-around">
|
<CardContent className="justify-around">
|
||||||
<Typography gutterBottom variant="h5" component="div">
|
<Typography gutterBottom component="div">
|
||||||
{item.label}
|
{item.label}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="body2">
|
<Typography>
|
||||||
{item.value}
|
{item.value}
|
||||||
</Typography>
|
</Typography>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
@ -134,7 +134,7 @@ const Agents = () => {
|
|||||||
<Item className='flex-1'>
|
<Item className='flex-1'>
|
||||||
<Card className='h-full'>
|
<Card className='h-full'>
|
||||||
<CardContent className='h-full'>
|
<CardContent className='h-full'>
|
||||||
<Typography gutterBottom variant="h5" component="div">
|
<Typography gutterBottom component="div">
|
||||||
Revenue Won by Month
|
Revenue Won by Month
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className='flex-1'>
|
<div className='flex-1'>
|
||||||
@ -156,7 +156,7 @@ const Agents = () => {
|
|||||||
<Grid xs={4} className='h-full'>
|
<Grid xs={4} className='h-full'>
|
||||||
<Card className='flex-1 h-full'>
|
<Card className='flex-1 h-full'>
|
||||||
<CardContent className='h-full'>
|
<CardContent className='h-full'>
|
||||||
<Typography gutterBottom variant="h5" component="div">
|
<Typography gutterBottom component="div">
|
||||||
Close % by Month
|
Close % by Month
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className='flex-1'>
|
<div className='flex-1'>
|
||||||
@ -171,7 +171,7 @@ const Agents = () => {
|
|||||||
<Grid xs={4} className='h-full'>
|
<Grid xs={4} className='h-full'>
|
||||||
<Card className='flex-1 h-full'>
|
<Card className='flex-1 h-full'>
|
||||||
<CardContent className='h-full'>
|
<CardContent className='h-full'>
|
||||||
<Typography gutterBottom variant="h5" component="div">
|
<Typography gutterBottom component="div">
|
||||||
Close % by Month
|
Close % by Month
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className='flex-1'>
|
<div className='flex-1'>
|
||||||
@ -186,7 +186,7 @@ const Agents = () => {
|
|||||||
<Grid xs={4} className='h-full'>
|
<Grid xs={4} className='h-full'>
|
||||||
<Card className='flex-1 h-full'>
|
<Card className='flex-1 h-full'>
|
||||||
<CardContent className='h-full'>
|
<CardContent className='h-full'>
|
||||||
<Typography gutterBottom variant="h5" component="div">
|
<Typography gutterBottom component="div">
|
||||||
Close % by Month
|
Close % by Month
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className='flex-1'>
|
<div className='flex-1'>
|
||||||
|
@ -10,7 +10,7 @@ export const [useDialogueContext, DialogueProvider] = createCtx<{
|
|||||||
refreshDialogList: () => void;
|
refreshDialogList: () => void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
export default ({ children }: {
|
const DialogueContext = ({ children }: {
|
||||||
children: React.ReactElement
|
children: React.ReactElement
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
@ -33,3 +33,5 @@ export default ({ children }: {
|
|||||||
</DialogueProvider>
|
</DialogueProvider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default DialogueContext;
|
@ -1,9 +1,9 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import './globals.css'
|
import './globals.css'
|
||||||
import './nprogress.css';
|
import '@/nprogress.css';
|
||||||
import LeftSider from '@/components/leftSider';
|
import LeftSider from '@/components/leftSider';
|
||||||
import { CssVarsProvider, ThemeProvider } from '@mui/joy/styles';
|
import { CssVarsProvider, ThemeProvider } from '@mui/joy/styles';
|
||||||
import { joyTheme } from './defaultTheme';
|
import { joyTheme } from '@/defaultTheme';
|
||||||
import TopProgressBar from '@/components/topProgressBar';
|
import TopProgressBar from '@/components/topProgressBar';
|
||||||
import DialogueContext from './context/dialogue';
|
import DialogueContext from './context/dialogue';
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ export default function Home() {
|
|||||||
|
|
||||||
return (
|
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'>
|
<div className='w-[108rem] flex-none flex justify-end'>
|
||||||
<picture>
|
<picture>
|
||||||
<source srcSet='/bg1.avif' type='image/avif'></source>
|
<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('routeChangeComplete', stop);
|
||||||
Router.events.on('routeChangeError', stop);
|
Router.events.on('routeChangeError', stop);
|
||||||
|
|
||||||
const originalFetch = window.fetch;
|
if (typeof window !== 'undefined' && typeof window?.fetch === 'function') {
|
||||||
window.fetch = async function (...args) {
|
const originalFetch = window.fetch;
|
||||||
if (activeRequests === 0) {
|
window.fetch = async function (...args) {
|
||||||
load();
|
|
||||||
}
|
|
||||||
|
|
||||||
activeRequests++;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await originalFetch(...args);
|
|
||||||
return response;
|
|
||||||
} catch (error) {
|
|
||||||
return Promise.reject(error);
|
|
||||||
} finally {
|
|
||||||
activeRequests -= 1;
|
|
||||||
if (activeRequests === 0) {
|
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() {
|
export default function TopProgressBar() {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
|
output: 'export',
|
||||||
experimental: {
|
experimental: {
|
||||||
esmExternals: 'loose'
|
esmExternals: 'loose'
|
||||||
|
},
|
||||||
|
typescript: {
|
||||||
|
ignoreBuildErrors: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { message } from 'antd';
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { isPlainObject } from 'lodash';
|
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;
|
axios.defaults.timeout = 10000;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user