v4.6.6-search test adapt diff search mode (#685)
This commit is contained in:
@@ -14,7 +14,14 @@ import { searchQueryExtension } from '@fastgpt/service/core/ai/functions/queryEx
|
||||
export default withNextCors(async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
await connectToDatabase();
|
||||
const { datasetId, text, limit = 20, searchMode, usingReRank } = req.body as SearchTestProps;
|
||||
const {
|
||||
datasetId,
|
||||
text,
|
||||
limit = 1500,
|
||||
similarity,
|
||||
searchMode,
|
||||
usingReRank
|
||||
} = req.body as SearchTestProps;
|
||||
|
||||
if (!datasetId || !text) {
|
||||
throw new Error('缺少参数');
|
||||
@@ -40,11 +47,12 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
// model: global.chatModels[0].model
|
||||
// });
|
||||
|
||||
const { searchRes, tokens } = await searchDatasetData({
|
||||
const { searchRes, tokens, ...result } = await searchDatasetData({
|
||||
rawQuery: text,
|
||||
queries: [text],
|
||||
model: dataset.vectorModel,
|
||||
limit: Math.min(limit * 800, 30000),
|
||||
limit: Math.min(limit, 20000),
|
||||
similarity,
|
||||
datasetIds: [datasetId],
|
||||
searchMode,
|
||||
usingReRank
|
||||
@@ -68,7 +76,8 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
jsonRes<SearchTestResponse>(res, {
|
||||
data: {
|
||||
list: searchRes,
|
||||
duration: `${((Date.now() - start) / 1000).toFixed(3)}s`
|
||||
duration: `${((Date.now() - start) / 1000).toFixed(3)}s`,
|
||||
...result
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user