fix: getting docId, storeId parameters (#3761)
* fix: getting docId, storeId parameters * useparams to get path params --------- Co-authored-by: Henry <hzj94@hotmail.com>
This commit is contained in:
parent
d71ad22e27
commit
b6165e3578
|
|
@ -98,27 +98,27 @@ const MainRoutes = {
|
||||||
element: <Documents />
|
element: <Documents />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/document-stores/:id',
|
path: '/document-stores/:storeId',
|
||||||
element: <DocumentStoreDetail />
|
element: <DocumentStoreDetail />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/document-stores/chunks/:id/:id',
|
path: '/document-stores/chunks/:storeId/:fileId',
|
||||||
element: <ShowStoredChunks />
|
element: <ShowStoredChunks />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/document-stores/:id/:name',
|
path: '/document-stores/:storeId/:name',
|
||||||
element: <LoaderConfigPreviewChunks />
|
element: <LoaderConfigPreviewChunks />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/document-stores/vector/:id',
|
path: '/document-stores/vector/:storeId',
|
||||||
element: <VectorStoreConfigure />
|
element: <VectorStoreConfigure />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/document-stores/vector/:id/:docId',
|
path: '/document-stores/vector/:storeId/:docId',
|
||||||
element: <VectorStoreConfigure />
|
element: <VectorStoreConfigure />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/document-stores/query/:id',
|
path: '/document-stores/query/:storeId',
|
||||||
element: <VectorStoreQuery />
|
element: <VectorStoreQuery />
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { cloneDeep, set } from 'lodash'
|
import { cloneDeep, set } from 'lodash'
|
||||||
import { memo, useEffect, useState, useRef } from 'react'
|
import { memo, useEffect, useState, useRef } from 'react'
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import { FullPageChat } from 'flowise-embed-react'
|
import { FullPageChat } from 'flowise-embed-react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
|
|
@ -76,8 +76,7 @@ const CustomAssistantConfigurePreview = () => {
|
||||||
const getToolsApi = useApi(assistantsApi.getTools)
|
const getToolsApi = useApi(assistantsApi.getTools)
|
||||||
const getSpecificChatflowApi = useApi(chatflowsApi.getSpecificChatflow)
|
const getSpecificChatflowApi = useApi(chatflowsApi.getSpecificChatflow)
|
||||||
|
|
||||||
const URLpath = document.location.pathname.toString().split('/')
|
const { id: customAssistantId } = useParams()
|
||||||
const customAssistantId = URLpath[URLpath.length - 1] === 'assistants' ? '' : URLpath[URLpath.length - 1]
|
|
||||||
|
|
||||||
const [chatModelsComponents, setChatModelsComponents] = useState([])
|
const [chatModelsComponents, setChatModelsComponents] = useState([])
|
||||||
const [chatModelsOptions, setChatModelsOptions] = useState([])
|
const [chatModelsOptions, setChatModelsOptions] = useState([])
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import * as PropTypes from 'prop-types'
|
import * as PropTypes from 'prop-types'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
|
|
||||||
// material-ui
|
// material-ui
|
||||||
import {
|
import {
|
||||||
|
|
@ -146,8 +146,7 @@ const DocumentStoreDetails = () => {
|
||||||
const [anchorEl, setAnchorEl] = useState(null)
|
const [anchorEl, setAnchorEl] = useState(null)
|
||||||
const open = Boolean(anchorEl)
|
const open = Boolean(anchorEl)
|
||||||
|
|
||||||
const URLpath = document.location.pathname.toString().split('/')
|
const { storeId } = useParams()
|
||||||
const storeId = URLpath[URLpath.length - 1] === 'document-stores' ? '' : URLpath[URLpath.length - 1]
|
|
||||||
|
|
||||||
const openPreviewSettings = (id) => {
|
const openPreviewSettings = (id) => {
|
||||||
navigate('/document-stores/' + storeId + '/' + id)
|
navigate('/document-stores/' + storeId + '/' + id)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { cloneDeep } from 'lodash'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { validate as uuidValidate, v4 as uuidv4 } from 'uuid'
|
import { validate as uuidValidate, v4 as uuidv4 } from 'uuid'
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import ReactJson from 'flowise-react-json-view'
|
import ReactJson from 'flowise-react-json-view'
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
|
|
@ -66,9 +66,7 @@ const LoaderConfigPreviewChunks = () => {
|
||||||
const getNodesByCategoryApi = useApi(nodesApi.getNodesByCategory)
|
const getNodesByCategoryApi = useApi(nodesApi.getNodesByCategory)
|
||||||
const getSpecificDocumentStoreApi = useApi(documentsApi.getSpecificDocumentStore)
|
const getSpecificDocumentStoreApi = useApi(documentsApi.getSpecificDocumentStore)
|
||||||
|
|
||||||
const URLpath = document.location.pathname.toString().split('/')
|
const { storeId, name: docLoaderNodeName } = useParams()
|
||||||
const docLoaderNodeName = URLpath[URLpath.length - 1] === 'document-stores' ? '' : URLpath[URLpath.length - 1]
|
|
||||||
const storeId = URLpath[URLpath.length - 2] === 'document-stores' ? '' : URLpath[URLpath.length - 2]
|
|
||||||
|
|
||||||
const [selectedDocumentLoader, setSelectedDocumentLoader] = useState({})
|
const [selectedDocumentLoader, setSelectedDocumentLoader] = useState({})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import ReactJson from 'flowise-react-json-view'
|
import ReactJson from 'flowise-react-json-view'
|
||||||
|
|
||||||
// material-ui
|
// material-ui
|
||||||
|
|
@ -60,9 +60,7 @@ const ShowStoredChunks = () => {
|
||||||
|
|
||||||
const getChunksApi = useApi(documentsApi.getFileChunks)
|
const getChunksApi = useApi(documentsApi.getFileChunks)
|
||||||
|
|
||||||
const URLpath = document.location.pathname.toString().split('/')
|
const { storeId, fileId } = useParams()
|
||||||
const fileId = URLpath[URLpath.length - 1] === 'document-stores' ? '' : URLpath[URLpath.length - 1]
|
|
||||||
const storeId = URLpath[URLpath.length - 2] === 'document-stores' ? '' : URLpath[URLpath.length - 2]
|
|
||||||
|
|
||||||
const [documentChunks, setDocumentChunks] = useState([])
|
const [documentChunks, setDocumentChunks] = useState([])
|
||||||
const [totalChunks, setTotalChunks] = useState(0)
|
const [totalChunks, setTotalChunks] = useState(0)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import moment from 'moment/moment'
|
import moment from 'moment/moment'
|
||||||
|
|
@ -50,9 +50,7 @@ const VectorStoreConfigure = () => {
|
||||||
useNotifier()
|
useNotifier()
|
||||||
const customization = useSelector((state) => state.customization)
|
const customization = useSelector((state) => state.customization)
|
||||||
|
|
||||||
const pathSegments = document.location.pathname.toString().split('/')
|
const { storeId, docId } = useParams()
|
||||||
const storeId = pathSegments[3] || null
|
|
||||||
const docId = pathSegments[4] || null
|
|
||||||
|
|
||||||
const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args))
|
const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args))
|
||||||
const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args))
|
const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useEffect, useState, useRef } from 'react'
|
import { useEffect, useState, useRef } from 'react'
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
import ReactJson from 'flowise-react-json-view'
|
import ReactJson from 'flowise-react-json-view'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
|
@ -63,8 +63,7 @@ const VectorStoreQuery = () => {
|
||||||
const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args))
|
const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args))
|
||||||
const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args))
|
const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args))
|
||||||
|
|
||||||
const URLpath = document.location.pathname.toString().split('/')
|
const { storeId } = useParams()
|
||||||
const storeId = URLpath[URLpath.length - 1] === 'document-stores' ? '' : URLpath[URLpath.length - 1]
|
|
||||||
|
|
||||||
const [documentChunks, setDocumentChunks] = useState([])
|
const [documentChunks, setDocumentChunks] = useState([])
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue