mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-09 04:08:10 +00:00
Merge remote-tracking branch 'origin/new-page-framework' into new-page-framework
This commit is contained in:
commit
bdcc3d2bc6
@ -5,6 +5,7 @@ import useAgentChat from '@/hooks/useAgentChat';
|
|||||||
import ChatBoxComp from '@/components/chatBoxTemp';
|
import ChatBoxComp from '@/components/chatBoxTemp';
|
||||||
import { useDialogueContext } from '@/app/context/dialogue';
|
import { useDialogueContext } from '@/app/context/dialogue';
|
||||||
import { useSearchParams } from 'next/navigation';
|
import { useSearchParams } from 'next/navigation';
|
||||||
|
|
||||||
const AgentPage = () => {
|
const AgentPage = () => {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const { refreshDialogList } = useDialogueContext();
|
const { refreshDialogList } = useDialogueContext();
|
||||||
@ -20,7 +21,7 @@ const AgentPage = () => {
|
|||||||
|
|
||||||
const { data: paramsList } = useRequest(async () => await sendPostRequest(`/v1/chat/mode/params/list?chat_mode=${scene}`), {
|
const { data: paramsList } = useRequest(async () => await sendPostRequest(`/v1/chat/mode/params/list?chat_mode=${scene}`), {
|
||||||
ready: !!scene,
|
ready: !!scene,
|
||||||
refreshDeps: [scene]
|
refreshDeps: [id, scene]
|
||||||
});
|
});
|
||||||
|
|
||||||
const { history, handleChatSubmit } = useAgentChat({
|
const { history, handleChatSubmit } = useAgentChat({
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { InboxOutlined } from '@ant-design/icons'
|
import { InboxOutlined } from '@ant-design/icons'
|
||||||
import CheckCircleOutlinedIcon from '@mui/icons-material/CheckCircleOutlined';
|
import CheckCircleOutlinedIcon from '@mui/icons-material/CheckCircleOutlined'
|
||||||
|
import AddBoxOutlinedIcon from '@mui/icons-material/AddBoxOutlined';
|
||||||
|
import ContentPasteSearchOutlinedIcon from '@mui/icons-material/ContentPasteSearchOutlined';
|
||||||
import type { UploadProps } from 'antd'
|
import type { UploadProps } from 'antd'
|
||||||
import { message, Upload, Popover } from 'antd'
|
import { message, Upload, Popover } from 'antd'
|
||||||
import {
|
import {
|
||||||
@ -90,13 +92,16 @@ const Index = () => {
|
|||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
const res = await fetch(`${process.env.API_BASE_URL}/knowledge/space/list`, {
|
const res = await fetch(
|
||||||
|
`${process.env.API_BASE_URL}/knowledge/space/list`,
|
||||||
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({})
|
body: JSON.stringify({})
|
||||||
})
|
}
|
||||||
|
)
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
setKnowledgeSpaceList(data.data)
|
setKnowledgeSpaceList(data.data)
|
||||||
@ -105,97 +110,135 @@ const Index = () => {
|
|||||||
fetchData()
|
fetchData()
|
||||||
}, [])
|
}, [])
|
||||||
return (
|
return (
|
||||||
<>
|
<Box
|
||||||
<Sheet
|
sx={{
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
backgroundColor: mode === 'light' ? 'rgb(238, 240, 245)' : 'rgb(33, 33, 33)'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box className="page-body p-4" sx={{
|
||||||
|
'&': {
|
||||||
|
height: '90%',
|
||||||
|
overflow: 'auto',
|
||||||
|
},
|
||||||
|
'&::-webkit-scrollbar': {
|
||||||
|
display: 'none'
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="space-between"
|
||||||
|
alignItems="center"
|
||||||
|
flexWrap="wrap"
|
||||||
|
sx={{
|
||||||
|
'& i': {
|
||||||
|
width: '430px',
|
||||||
|
marginRight: '30px'
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
boxSizing: "content-box",
|
||||||
|
width: '390px',
|
||||||
|
height: '79px',
|
||||||
|
padding: '33px 20px 40px',
|
||||||
|
marginRight: '30px',
|
||||||
|
marginBottom: '30px',
|
||||||
|
fontSize: '18px',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
color: 'black',
|
||||||
|
backgroundColor: mode === 'light' ? 'rgb(224, 228, 237)' : 'rgb(72, 72, 72)',
|
||||||
|
flexShrink: 0,
|
||||||
|
flexGrow: 0,
|
||||||
|
cursor: 'pointer',
|
||||||
|
'&: hover': {
|
||||||
|
boxShadow: '0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);'
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onClick={() => setIsAddKnowledgeSpaceModalShow(true)}
|
||||||
|
><AddBoxOutlinedIcon sx={{ marginRight: '10px', fontSize: '30px' }} />Space</Box>
|
||||||
|
{knowledgeSpaceList.map((item: any, index: number) => (
|
||||||
|
<Box
|
||||||
|
key={index}
|
||||||
|
sx={{
|
||||||
|
padding: '30px 20px 40px',
|
||||||
|
marginRight: '30px',
|
||||||
|
marginBottom: '30px',
|
||||||
|
backgroundColor: mode === 'light' ? 'rgb(255, 255, 255)' : 'rgb(72, 72, 72)',
|
||||||
|
borderTop: '3px solid rgb(82, 196, 26)',
|
||||||
|
flexShrink: 0,
|
||||||
|
flexGrow: 0,
|
||||||
|
cursor: 'pointer',
|
||||||
|
'&: hover': {
|
||||||
|
boxShadow: '0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);'
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
router.push(`/datastores/documents?name=${item.name}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box sx={{
|
||||||
|
fontSize: '18px',
|
||||||
|
marginBottom: '10px',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
color: 'black'
|
||||||
|
}}><ContentPasteSearchOutlinedIcon sx={{ marginRight: '5px' }}/>{item.name}</Box>
|
||||||
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'space-between'
|
justifyContent: 'flex-start',
|
||||||
}}
|
}}
|
||||||
className="p-4"
|
|
||||||
>
|
>
|
||||||
<Sheet
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: '30px',
|
width: '130px',
|
||||||
fontWeight: 'bold'
|
flexGrow: 0,
|
||||||
|
flexShrink: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Knowledge Spaces
|
<Box
|
||||||
</Sheet>
|
|
||||||
<Button
|
|
||||||
onClick={() => setIsAddKnowledgeSpaceModalShow(true)}
|
|
||||||
variant="outlined"
|
|
||||||
>
|
|
||||||
+ New Knowledge Space
|
|
||||||
</Button>
|
|
||||||
</Sheet>
|
|
||||||
<div className="page-body p-4">
|
|
||||||
{knowledgeSpaceList.length ? (
|
|
||||||
<Table
|
|
||||||
color="primary"
|
|
||||||
variant="plain"
|
|
||||||
size="lg"
|
|
||||||
sx={{
|
sx={{
|
||||||
'& tbody tr: hover': {
|
color: 'black'
|
||||||
backgroundColor:
|
}}
|
||||||
mode === 'light' ? 'rgb(246, 246, 246)' : 'rgb(33, 33, 40)'
|
>{item.vector_type}</Box>
|
||||||
},
|
<Box sx={{ fontSize: '12px', color: 'black' }}>Vector</Box>
|
||||||
'& tbody tr: hover a': {
|
</Box>
|
||||||
textDecoration: 'underline'
|
<Box
|
||||||
},
|
sx={{
|
||||||
'& tbody tr a': {
|
width: '130px',
|
||||||
color: 'rgb(13, 96, 217)'
|
flexGrow: 0,
|
||||||
}
|
flexShrink: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<thead>
|
<Box
|
||||||
<tr>
|
sx={{
|
||||||
<th>Name</th>
|
color: 'black'
|
||||||
<th>Vector</th>
|
}}
|
||||||
<th>Owner</th>
|
>{item.owner}</Box>
|
||||||
<th>Description</th>
|
<Box sx={{ fontSize: '12px', color: 'black' }}>Owner</Box>
|
||||||
</tr>
|
</Box>
|
||||||
</thead>
|
<Box
|
||||||
<tbody>
|
sx={{
|
||||||
{knowledgeSpaceList.map((row: any) => (
|
width: '130px',
|
||||||
<tr key={row.id}>
|
flexGrow: 0,
|
||||||
<td>
|
flexShrink: 0
|
||||||
{
|
}}
|
||||||
<a
|
|
||||||
style={{ fontWeight: 'bold' }}
|
|
||||||
href="javascript:;"
|
|
||||||
onClick={() =>
|
|
||||||
router.push(`/datastores/documents?name=${row.name}`)
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{row.name}
|
<Box
|
||||||
</a>
|
sx={{
|
||||||
}
|
color: 'black'
|
||||||
</td>
|
}}
|
||||||
<td>
|
>{item.docs || 0}</Box>
|
||||||
<Chip variant="solid" color="neutral" sx={{ opacity: 0.5 }}>
|
<Box sx={{ fontSize: '12px', color: 'black' }}>Docs</Box>
|
||||||
{row.vector_type}
|
</Box>
|
||||||
</Chip>
|
</Box>
|
||||||
</td>
|
</Box>
|
||||||
<td>
|
|
||||||
<Chip variant="solid" color="neutral" sx={{ opacity: 0.5 }}>
|
|
||||||
{row.owner}
|
|
||||||
</Chip>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Popover content={row.desc} trigger="hover">
|
|
||||||
{row.desc.length > 10
|
|
||||||
? `${row.desc.slice(0, 10)}...`
|
|
||||||
: row.desc}
|
|
||||||
</Popover>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
))}
|
||||||
</tbody>
|
<i></i><i></i><i></i><i></i><i></i>
|
||||||
</Table>
|
</Stack>
|
||||||
) : (
|
</Box>
|
||||||
<></>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<Modal
|
<Modal
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -225,7 +268,11 @@ const Index = () => {
|
|||||||
color: activeStep === index ? '#814DDE' : ''
|
color: activeStep === index ? '#814DDE' : ''
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{index < activeStep ? <CheckCircleOutlinedIcon /> : `${index + 1}.`}
|
{index < activeStep ? (
|
||||||
|
<CheckCircleOutlinedIcon />
|
||||||
|
) : (
|
||||||
|
`${index + 1}.`
|
||||||
|
)}
|
||||||
{`${item}`}
|
{`${item}`}
|
||||||
</Item>
|
</Item>
|
||||||
))}
|
))}
|
||||||
@ -533,7 +580,7 @@ const Index = () => {
|
|||||||
)}
|
)}
|
||||||
</Sheet>
|
</Sheet>
|
||||||
</Modal>
|
</Modal>
|
||||||
</>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,9 @@ export default function Home() {
|
|||||||
size="md"
|
size="md"
|
||||||
variant="solid"
|
variant="solid"
|
||||||
className='text-base rounded-none '
|
className='text-base rounded-none '
|
||||||
|
style={{
|
||||||
|
boxShadow: '0px 8px 10px 0px rgb(31 31 31 / 50%)'
|
||||||
|
}}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
const res = await sendPostRequest('/v1/chat/dialogue/new', {
|
const res = await sendPostRequest('/v1/chat/dialogue/new', {
|
||||||
chat_mode: scene['chat_scene']
|
chat_mode: scene['chat_scene']
|
||||||
|
@ -130,7 +130,7 @@ const LeftSider = () => {
|
|||||||
<ListItemContent>
|
<ListItemContent>
|
||||||
<Link href={`/chat?id=${each.conv_uid}&scene=${each?.chat_mode}`} className="flex items-center justify-between">
|
<Link href={`/chat?id=${each.conv_uid}&scene=${each?.chat_mode}`} className="flex items-center justify-between">
|
||||||
<Typography fontSize={14} noWrap={true}>
|
<Typography fontSize={14} noWrap={true}>
|
||||||
<SmsOutlinedIcon className='mr-2' />
|
<SmsOutlinedIcon style={{ marginRight: '0.5rem' }} />
|
||||||
{each?.user_name || each?.user_input || 'undefined'}
|
{each?.user_name || each?.user_input || 'undefined'}
|
||||||
</Typography>
|
</Typography>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
@ -8,7 +8,7 @@ export const joyTheme = extendTheme({
|
|||||||
mode: 'dark',
|
mode: 'dark',
|
||||||
primary: {
|
primary: {
|
||||||
...colors.grey,
|
...colors.grey,
|
||||||
solidBg: '#dfdfdf91',
|
solidBg: '#9a9a9a91',
|
||||||
solidColor: '#4e4e4e',
|
solidColor: '#4e4e4e',
|
||||||
solidHoverBg: '#d5d5d5',
|
solidHoverBg: '#d5d5d5',
|
||||||
outlinedColor: '#4e4e59'
|
outlinedColor: '#4e4e59'
|
||||||
@ -36,7 +36,9 @@ export const joyTheme = extendTheme({
|
|||||||
...colors.grey,
|
...colors.grey,
|
||||||
softBg: '#353539',
|
softBg: '#353539',
|
||||||
softHoverBg: '#35353978',
|
softHoverBg: '#35353978',
|
||||||
softDisabledBg: '#353539'
|
softDisabledBg: '#353539',
|
||||||
|
solidBg: '#434356',
|
||||||
|
solidHoverBg: '#5a5a72',
|
||||||
},
|
},
|
||||||
neutral: {
|
neutral: {
|
||||||
plainColor: '#D8D8DF',
|
plainColor: '#D8D8DF',
|
||||||
|
Loading…
Reference in New Issue
Block a user