mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 03:01:10 +03:00
@@ -141,7 +141,7 @@ const editDocumentStoreFileChunk = async (req: Request, res: Response, next: Nex
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
const body = req.body
|
const body = req.body
|
||||||
if (typeof body === 'undefined' || body.pageContent === 'undefined' || body.pageContent === '') {
|
if (typeof body === 'undefined') {
|
||||||
throw new InternalFlowiseError(
|
throw new InternalFlowiseError(
|
||||||
StatusCodes.PRECONDITION_FAILED,
|
StatusCodes.PRECONDITION_FAILED,
|
||||||
`Error: documentStoreController.editDocumentStoreFileChunk - body not provided!`
|
`Error: documentStoreController.editDocumentStoreFileChunk - body not provided!`
|
||||||
@@ -151,7 +151,8 @@ const editDocumentStoreFileChunk = async (req: Request, res: Response, next: Nex
|
|||||||
req.params.storeId,
|
req.params.storeId,
|
||||||
req.params.loaderId,
|
req.params.loaderId,
|
||||||
req.params.chunkId,
|
req.params.chunkId,
|
||||||
body.pageContent
|
body.pageContent,
|
||||||
|
body.metadata
|
||||||
)
|
)
|
||||||
return res.json(apiResponse)
|
return res.json(apiResponse)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ const deleteDocumentStoreFileChunk = async (storeId: string, docId: string, chun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const editDocumentStoreFileChunk = async (storeId: string, docId: string, chunkId: string, content: string) => {
|
const editDocumentStoreFileChunk = async (storeId: string, docId: string, chunkId: string, content: string, metadata: ICommonObject) => {
|
||||||
try {
|
try {
|
||||||
const appServer = getRunningExpressApp()
|
const appServer = getRunningExpressApp()
|
||||||
const entity = await appServer.AppDataSource.getRepository(DocumentStore).findOneBy({
|
const entity = await appServer.AppDataSource.getRepository(DocumentStore).findOneBy({
|
||||||
@@ -305,6 +305,7 @@ const editDocumentStoreFileChunk = async (storeId: string, docId: string, chunkI
|
|||||||
}
|
}
|
||||||
found.totalChars -= editChunk.pageContent.length
|
found.totalChars -= editChunk.pageContent.length
|
||||||
editChunk.pageContent = content
|
editChunk.pageContent = content
|
||||||
|
editChunk.metadata = JSON.stringify(metadata)
|
||||||
found.totalChars += content.length
|
found.totalChars += content.length
|
||||||
await appServer.AppDataSource.getRepository(DocumentStoreFileChunk).save(editChunk)
|
await appServer.AppDataSource.getRepository(DocumentStoreFileChunk).save(editChunk)
|
||||||
entity.loaders = JSON.stringify(loaders)
|
entity.loaders = JSON.stringify(loaders)
|
||||||
|
|||||||
Reference in New Issue
Block a user