Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ class AnswerAgent_MCP implements INode {
args: [packagePath],
env: {
ANSWERAGENT_AI_API_BASE_URL: apiHost,
ANSWERAGENT_AI_API_TOKEN: apiKey
ANSWERAGENT_AI_API_TOKEN: apiKey,
// Subprocess does not inherit process.env; without this the axios client defaults to a 5s timeout
API_TIMEOUT: process.env.ANSWERAGENT_MCP_API_TIMEOUT || '30000'
}
}

Expand Down
16 changes: 11 additions & 5 deletions packages/server/src/services/documentstore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1989,12 +1989,18 @@ const queryVectorStore = async (data: ICommonObject, workspaceId: string) => {
id: uuidv4()
}
})
// query our document store chunk with the storeId and pageContent
for (const doc of docs) {
const documentStoreChunk = await appServer.AppDataSource.getRepository(DocumentStoreFileChunk).findOneBy({
storeId: data.storeId,
pageContent: doc.pageContent
// Backfill chunk id/chunkNo with a single batched query instead of one lookup per doc
const chunkByContent = new Map<string, DocumentStoreFileChunk>()
if (docs.length > 0) {
const documentStoreChunks = await appServer.AppDataSource.getRepository(DocumentStoreFileChunk).find({
where: { storeId: data.storeId, pageContent: In(docs.map((doc: any) => doc.pageContent)) }
})
for (const chunk of documentStoreChunks) {
if (!chunkByContent.has(chunk.pageContent)) chunkByContent.set(chunk.pageContent, chunk)
}
}
for (const doc of docs) {
const documentStoreChunk = chunkByContent.get(doc.pageContent)
if (documentStoreChunk) {
doc.id = documentStoreChunk.id
doc.chunkNo = documentStoreChunk.chunkNo
Expand Down
Loading