doc and config rerank (#475)

This commit is contained in:
Archer
2023-11-16 10:46:47 +08:00
committed by GitHub
parent cd3acb44ab
commit 16103029f5
18 changed files with 158 additions and 55 deletions

View File

@@ -11,6 +11,7 @@ type DatasetSearchProps = ModuleDispatchProps<{
datasets: SelectedDatasetType;
similarity: number;
limit: number;
rerank: boolean;
userChatInput: string;
}>;
export type KBSearchResponse = {
@@ -20,9 +21,9 @@ export type KBSearchResponse = {
quoteQA: SearchDataResponseItemType[];
};
export async function dispatchDatasetSearch(props: Record<string, any>): Promise<KBSearchResponse> {
export async function dispatchDatasetSearch(props: DatasetSearchProps): Promise<KBSearchResponse> {
const {
inputs: { datasets = [], similarity = 0.4, limit = 5, userChatInput }
inputs: { datasets = [], similarity = 0.4, limit = 5, rerank, userChatInput }
} = props as DatasetSearchProps;
if (datasets.length === 0) {
@@ -41,7 +42,8 @@ export async function dispatchDatasetSearch(props: Record<string, any>): Promise
model: vectorModel.model,
similarity,
limit,
datasetIds: datasets.map((item) => item.datasetId)
datasetIds: datasets.map((item) => item.datasetId),
rerank
});
return {