mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-18 08:17:38 +00:00
feat: set a constant to record the fetch URL
This commit is contained in:
parent
8d7a45c142
commit
8c35b02c8a
1
datacenter/app/datastores/constants.tsx
Normal file
1
datacenter/app/datastores/constants.tsx
Normal file
@ -0,0 +1 @@
|
|||||||
|
export const fetchURL = 'http://30.183.154.125:5000';
|
@ -4,6 +4,7 @@ import { useSearchParams } from 'next/navigation'
|
|||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { Table, Stack } from '@/lib/mui'
|
import { Table, Stack } from '@/lib/mui'
|
||||||
import { Popover, Pagination } from 'antd'
|
import { Popover, Pagination } from 'antd'
|
||||||
|
import { fetchURL } from '@/app/datastores/constants';
|
||||||
const page_size = 20
|
const page_size = 20
|
||||||
|
|
||||||
const ChunkList = () => {
|
const ChunkList = () => {
|
||||||
@ -15,7 +16,7 @@ const ChunkList = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchChunks() {
|
async function fetchChunks() {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/chunk/list`,
|
`${fetchURL}/knowledge/${spaceName}/chunk/list`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -88,7 +89,7 @@ const ChunkList = () => {
|
|||||||
total={total}
|
total={total}
|
||||||
onChange={async (page) => {
|
onChange={async (page) => {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/chunk/list`,
|
`${fetchURL}/knowledge/${spaceName}/chunk/list`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -18,6 +18,7 @@ import moment from 'moment'
|
|||||||
import { InboxOutlined } from '@ant-design/icons'
|
import { InboxOutlined } from '@ant-design/icons'
|
||||||
import type { UploadProps } from 'antd'
|
import type { UploadProps } from 'antd'
|
||||||
import { Upload, Pagination, message } from 'antd'
|
import { Upload, Pagination, message } from 'antd'
|
||||||
|
import { fetchURL } from '@/app/datastores/constants';
|
||||||
|
|
||||||
const { Dragger } = Upload
|
const { Dragger } = Upload
|
||||||
const Item = styled(Sheet)(({ theme }) => ({
|
const Item = styled(Sheet)(({ theme }) => ({
|
||||||
@ -85,7 +86,7 @@ const Documents = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchDocuments() {
|
async function fetchDocuments() {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/document/list`,
|
`${fetchURL}/knowledge/${spaceName}/document/list`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -168,7 +169,7 @@ const Documents = () => {
|
|||||||
size="sm"
|
size="sm"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/document/sync`,
|
`${fetchURL}/knowledge/${spaceName}/document/sync`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -217,7 +218,7 @@ const Documents = () => {
|
|||||||
total={total}
|
total={total}
|
||||||
onChange={async (page) => {
|
onChange={async (page) => {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/document/list`,
|
`${fetchURL}/knowledge/${spaceName}/document/list`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -370,7 +371,7 @@ const Documents = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/document/add`,
|
`${fetchURL}/knowledge/${spaceName}/document/add`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -388,7 +389,7 @@ const Documents = () => {
|
|||||||
message.success('success')
|
message.success('success')
|
||||||
setIsAddDocumentModalShow(false)
|
setIsAddDocumentModalShow(false)
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/document/list`,
|
`${fetchURL}/knowledge/${spaceName}/document/list`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -419,7 +420,7 @@ const Documents = () => {
|
|||||||
formData.append('doc_file', originFileObj)
|
formData.append('doc_file', originFileObj)
|
||||||
formData.append('doc_type', 'DOCUMENT')
|
formData.append('doc_type', 'DOCUMENT')
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/document/upload`,
|
`${fetchURL}/knowledge/${spaceName}/document/upload`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
@ -430,7 +431,7 @@ const Documents = () => {
|
|||||||
message.success('success')
|
message.success('success')
|
||||||
setIsAddDocumentModalShow(false)
|
setIsAddDocumentModalShow(false)
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/document/list`,
|
`${fetchURL}/knowledge/${spaceName}/document/list`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -457,7 +458,7 @@ const Documents = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/document/add`,
|
`${fetchURL}/knowledge/${spaceName}/document/add`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -476,7 +477,7 @@ const Documents = () => {
|
|||||||
message.success('success')
|
message.success('success')
|
||||||
setIsAddDocumentModalShow(false)
|
setIsAddDocumentModalShow(false)
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${spaceName}/document/list`,
|
`${fetchURL}/knowledge/${spaceName}/document/list`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -16,6 +16,7 @@ import {
|
|||||||
Textarea,
|
Textarea,
|
||||||
styled
|
styled
|
||||||
} from '@/lib/mui'
|
} from '@/lib/mui'
|
||||||
|
import { fetchURL } from '@/app/datastores/constants';
|
||||||
|
|
||||||
const { Dragger } = Upload
|
const { Dragger } = Upload
|
||||||
|
|
||||||
@ -83,7 +84,7 @@ const Index = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
'http://30.183.154.125:5000/knowledge/space/list',
|
`${fetchURL}/knowledge/space/list`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -206,7 +207,7 @@ const Index = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
'http://30.183.154.125:5000/knowledge/space/add',
|
`${fetchURL}/knowledge/space/add`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -225,7 +226,7 @@ const Index = () => {
|
|||||||
message.success('success')
|
message.success('success')
|
||||||
setActiveStep(1)
|
setActiveStep(1)
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
'http://30.183.154.125:5000/knowledge/space/list',
|
`${fetchURL}/knowledge/space/list`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -342,7 +343,7 @@ const Index = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${knowledgeSpaceName}/document/add`,
|
`${fetchURL}/knowledge/${knowledgeSpaceName}/document/add`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -372,7 +373,7 @@ const Index = () => {
|
|||||||
formData.append('doc_file', originFileObj)
|
formData.append('doc_file', originFileObj)
|
||||||
formData.append('doc_type', 'DOCUMENT')
|
formData.append('doc_type', 'DOCUMENT')
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${knowledgeSpaceName}/document/upload`,
|
`${fetchURL}/knowledge/${knowledgeSpaceName}/document/upload`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
@ -391,7 +392,7 @@ const Index = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`http://30.183.154.125:5000/knowledge/${knowledgeSpaceName}/document/add`,
|
`${fetchURL}/knowledge/${knowledgeSpaceName}/document/add`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
Loading…
Reference in New Issue
Block a user