mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-11-20 20:18:15 +00:00
feat(search-route): handle history processing after llm validation
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user