feat: self vector search

This commit is contained in:
archer
2023-08-26 18:24:16 +08:00
parent 13439c5183
commit be33794a5f
22 changed files with 151 additions and 71 deletions

View File

@@ -24,11 +24,8 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
await connectToDatabase();
// 凭证校验
const { userId } = await authUser({ req });
// find model
const kb = await KB.findById(kbId, 'model');
// auth user and get kb
const [{ userId }, kb] = await Promise.all([authUser({ req }), KB.findById(kbId, 'model')]);
if (!kb) {
throw new Error("Can't find database");