θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
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
15 changes: 8 additions & 7 deletions server/utils/vectorDbProviders/milvus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,10 @@ const Milvus = {
filterIdentifiers,
});

const sources = sourceDocuments.map((metadata, i) => {
return { ...metadata, text: contextTexts[i] };
const sources = sourceDocuments.map((doc, i) => {
return { metadata: doc, text: contextTexts[i] };
});

return {
contextTexts,
sources: this.curateSources(sources),
Expand Down Expand Up @@ -358,7 +359,10 @@ const Milvus = {
}

result.contextTexts.push(match.metadata.text);
result.sourceDocuments.push(match);
result.sourceDocuments.push({
...match.metadata,
score: match.score,
});
result.scores.push(match.score);
});
return result;
Expand Down Expand Up @@ -394,13 +398,10 @@ const Milvus = {
if (Object.keys(metadata).length > 0) {
documents.push({
...metadata,
...(source.hasOwnProperty("pageContent")
? { text: source.pageContent }
: {}),
...(source.text ? { text: source.text } : {}),
});
}
}

return documents;
},
};
Expand Down
10 changes: 6 additions & 4 deletions server/utils/vectorDbProviders/pinecone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ const PineconeDB = {
}

result.contextTexts.push(match.metadata.text);
result.sourceDocuments.push(match);
result.sourceDocuments.push({
...match.metadata,
score: match.score,
});
result.scores.push(match.score);
});

Expand Down Expand Up @@ -263,8 +266,8 @@ const PineconeDB = {
filterIdentifiers,
});

const sources = sourceDocuments.map((metadata, i) => {
return { ...metadata, text: contextTexts[i] };
const sources = sourceDocuments.map((doc, i) => {
return { metadata: doc, text: contextTexts[i] };
});
return {
contextTexts,
Expand All @@ -285,7 +288,6 @@ const PineconeDB = {
});
}
}

return documents;
},
};
Expand Down
13 changes: 7 additions & 6 deletions server/utils/vectorDbProviders/zilliz/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ const Zilliz = {
filterIdentifiers,
});

const sources = sourceDocuments.map((metadata, i) => {
return { ...metadata, text: contextTexts[i] };
const sources = sourceDocuments.map((doc, i) => {
return { metadata: doc, text: contextTexts[i] };
});
return {
contextTexts,
Expand Down Expand Up @@ -350,7 +350,10 @@ const Zilliz = {
return;
}
result.contextTexts.push(match.metadata.text);
result.sourceDocuments.push(match);
result.sourceDocuments.push({
...match.metadata,
score: match.score,
});
result.scores.push(match.score);
});
return result;
Expand Down Expand Up @@ -386,9 +389,7 @@ const Zilliz = {
if (Object.keys(metadata).length > 0) {
documents.push({
...metadata,
...(source.hasOwnProperty("pageContent")
? { text: source.pageContent }
: {}),
...(source.text ? { text: source.text } : {}),
});
}
}
Expand Down