Skip to content

Commit

Permalink
trying to solve the search problem
Browse files Browse the repository at this point in the history
  • Loading branch information
dokmy committed Jan 13, 2024
1 parent fa5b830 commit 0163567
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/app/(root)/(routes)/results/[searchId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ResultsPage = async ({ params: { searchId } }: Props) => {
return redirect("/sign-in");
}

const search_metadata = await prismadb.search.findMany({
const search_metadata = await prismadb.search.findUnique({
where: {
id: searchId,
},
Expand All @@ -42,10 +42,14 @@ const ResultsPage = async ({ params: { searchId } }: Props) => {
},
});

if (!search_metadata) {
return <div>Cannot find this search in db.</div>;
}

return (
<ChatComponentsWrapper
searchResults={searchResults}
searchMetadataQuery={search_metadata[0].query}
searchMetadataQuery={search_metadata.query}
/>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const config = new Configuration({
})
const openai = new OpenAIApi(config)

export const runtime = 'edge';


export async function POST(req: Request) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/search/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export async function POST(req: Request) {

// -------Inserting search results to DB-------
await Promise.all(filteredResults.map(result => {
return prisma?.searchResult.create({
return prismadb?.searchResult.create({
data: {
caseName: result.case_title,
caseNeutralCit: result.case_neutral_cit,
Expand Down

0 comments on commit 0163567

Please sign in to comment.