From 3bcf646af15d0d1053cc8128529e1e97b8bb0eda Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:52:12 +0530 Subject: [PATCH] feat(search-route): handle history processing after llm validation --- src/app/api/search/route.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts index bc7255f..f737a55 100644 --- a/src/app/api/search/route.ts +++ b/src/app/api/search/route.ts @@ -30,12 +30,6 @@ export const POST = async (req: Request) => { body.optimizationMode = body.optimizationMode || 'balanced'; body.stream = body.stream || false; - const history: BaseMessage[] = body.history.map((msg) => { - return msg[0] === 'human' - ? new HumanMessage({ content: msg[1] }) - : new AIMessage({ content: msg[1] }); - }); - const registry = new ModelRegistry(); const [llm, embeddings] = await Promise.all([ @@ -46,6 +40,12 @@ export const POST = async (req: Request) => { ), ]); + const history: BaseMessage[] = body.history.map((msg) => { + return msg[0] === 'human' + ? new HumanMessage({ content: msg[1] }) + : new AIMessage({ content: msg[1] }); + }); + const searchHandler: MetaSearchAgentType = searchHandlers[body.focusMode]; if (!searchHandler) { @@ -128,7 +128,7 @@ export const POST = async (req: Request) => { try { controller.close(); - } catch (error) {} + } catch (error) { } }); emitter.on('data', (data: string) => {