diff --git a/datacenter/app/agents/page.tsx b/datacenter/app/agents/page.tsx index 814e03efe..3dcd8462e 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.153.109:5000/v1/chat/completions`, + queryAgentURL: `/v1/chat/completions`, }); const data = [ diff --git a/datacenter/app/datastores/constants.tsx b/datacenter/app/datastores/constants.tsx deleted file mode 100644 index 427f053b4..000000000 --- a/datacenter/app/datastores/constants.tsx +++ /dev/null @@ -1 +0,0 @@ -export const fetchBaseURL = 'http://30.183.153.109:5000'; diff --git a/datacenter/app/datastores/documents/chunklist/page.tsx b/datacenter/app/datastores/documents/chunklist/page.tsx index 0a3db6383..eb191c676 100644 --- a/datacenter/app/datastores/documents/chunklist/page.tsx +++ b/datacenter/app/datastores/documents/chunklist/page.tsx @@ -4,7 +4,6 @@ import { useSearchParams } from 'next/navigation' import React, { useState, useEffect } from 'react' import { useColorScheme, Table, Stack } from '@/lib/mui' import { Popover, Pagination } from 'antd' -import { fetchBaseURL } from '@/app/datastores/constants' const page_size = 20 const ChunkList = () => { @@ -17,7 +16,7 @@ const ChunkList = () => { useEffect(() => { async function fetchChunks() { const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/chunk/list`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/chunk/list`, { method: 'POST', headers: { @@ -107,7 +106,7 @@ const ChunkList = () => { total={total} onChange={async (page) => { const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/chunk/list`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/chunk/list`, { method: 'POST', headers: { diff --git a/datacenter/app/datastores/documents/page.tsx b/datacenter/app/datastores/documents/page.tsx index 8e14b5d2c..72ae15f3e 100644 --- a/datacenter/app/datastores/documents/page.tsx +++ b/datacenter/app/datastores/documents/page.tsx @@ -19,7 +19,6 @@ import moment from 'moment' import { InboxOutlined } from '@ant-design/icons' import type { UploadProps } from 'antd' import { Upload, Pagination, message } from 'antd' -import { fetchBaseURL } from '@/app/datastores/constants' const { Dragger } = Upload const Item = styled(Sheet)(({ theme }) => ({ @@ -89,7 +88,7 @@ const Documents = () => { useEffect(() => { async function fetchDocuments() { const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/document/list`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/document/list`, { method: 'POST', headers: { @@ -194,7 +193,7 @@ const Documents = () => { size="sm" onClick={async () => { const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/document/sync`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/document/sync`, { method: 'POST', headers: { @@ -247,7 +246,7 @@ const Documents = () => { total={total} onChange={async (page) => { const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/document/list`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/document/list`, { method: 'POST', headers: { @@ -400,7 +399,7 @@ const Documents = () => { return } const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/document/add`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/document/add`, { method: 'POST', headers: { @@ -418,7 +417,7 @@ const Documents = () => { message.success('success') setIsAddDocumentModalShow(false) const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/document/list`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/document/list`, { method: 'POST', headers: { @@ -449,7 +448,7 @@ const Documents = () => { formData.append('doc_file', originFileObj) formData.append('doc_type', 'DOCUMENT') const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/document/upload`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/document/upload`, { method: 'POST', body: formData @@ -460,7 +459,7 @@ const Documents = () => { message.success('success') setIsAddDocumentModalShow(false) const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/document/list`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/document/list`, { method: 'POST', headers: { @@ -487,7 +486,7 @@ const Documents = () => { return } const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/document/add`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/document/add`, { method: 'POST', headers: { @@ -506,7 +505,7 @@ const Documents = () => { message.success('success') setIsAddDocumentModalShow(false) const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/document/list`, + `${process.env.API_BASE_URL}/knowledge/${spaceName}/document/list`, { method: 'POST', headers: { diff --git a/datacenter/app/datastores/page.tsx b/datacenter/app/datastores/page.tsx index e66c39a1f..c8166c8c5 100644 --- a/datacenter/app/datastores/page.tsx +++ b/datacenter/app/datastores/page.tsx @@ -18,7 +18,6 @@ import { Chip, styled } from '@/lib/mui' -import { fetchBaseURL } from '@/app/datastores/constants' const { Dragger } = Upload @@ -87,7 +86,7 @@ const Index = () => { } useEffect(() => { async function fetchData() { - const res = await fetch(`${fetchBaseURL}/knowledge/space/list`, { + const res = await fetch(`${process.env.API_BASE_URL}/knowledge/space/list`, { method: 'POST', headers: { 'Content-Type': 'application/json' @@ -237,7 +236,7 @@ const Index = () => { message.error('please input the name') return } - const res = await fetch(`${fetchBaseURL}/knowledge/space/add`, { + const res = await fetch(`${process.env.API_BASE_URL}/knowledge/space/add`, { method: 'POST', headers: { 'Content-Type': 'application/json' @@ -254,7 +253,7 @@ const Index = () => { message.success('success') setActiveStep(1) const res = await fetch( - `${fetchBaseURL}/knowledge/space/list`, + `${process.env.API_BASE_URL}/knowledge/space/list`, { method: 'POST', headers: { @@ -371,7 +370,7 @@ const Index = () => { return } const res = await fetch( - `${fetchBaseURL}/knowledge/${knowledgeSpaceName}/document/add`, + `${process.env.API_BASE_URL}/knowledge/${knowledgeSpaceName}/document/add`, { method: 'POST', headers: { @@ -401,7 +400,7 @@ const Index = () => { formData.append('doc_file', originFileObj) formData.append('doc_type', 'DOCUMENT') const res = await fetch( - `${fetchBaseURL}/knowledge/${knowledgeSpaceName}/document/upload`, + `${process.env.API_BASE_URL}/knowledge/${knowledgeSpaceName}/document/upload`, { method: 'POST', body: formData @@ -420,7 +419,7 @@ const Index = () => { return } const res = await fetch( - `${fetchBaseURL}/knowledge/${knowledgeSpaceName}/document/add`, + `${process.env.API_BASE_URL}/knowledge/${knowledgeSpaceName}/document/add`, { method: 'POST', headers: { diff --git a/datacenter/app/page.tsx b/datacenter/app/page.tsx index 61384178f..6e425be64 100644 --- a/datacenter/app/page.tsx +++ b/datacenter/app/page.tsx @@ -1,7 +1,7 @@ "use client"; import { useRequest } from 'ahooks'; import { useState } from 'react'; -import { Button, Input, useColorScheme } from '@/lib/mui'; +import { Button, Input, useColorScheme, Box, buttonClasses } from '@/lib/mui'; import IconButton from '@mui/joy/IconButton'; import SendRoundedIcon from '@mui/icons-material/SendRounded'; import { zodResolver } from '@hookform/resolvers/zod'; @@ -38,25 +38,30 @@ export default function Home() { }; return ( - <> -
Scenes
-Scenes
+