Merge pull request #679 from ItzCrazyKns/feat/remove-backend

feat(app): fix build errors
This commit is contained in:
ItzCrazyKns
2025-03-20 12:48:27 +05:30
committed by GitHub
2 changed files with 31 additions and 26 deletions

View File

@ -3,7 +3,7 @@ FROM node:20.18.0-alpine AS builder
WORKDIR /home/perplexica
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
RUN yarn install --frozen-lockfile --network-timeout 600000
COPY tsconfig.json next.config.mjs next-env.d.ts postcss.config.js drizzle.config.ts tailwind.config.ts ./
COPY src ./src

View File

@ -125,35 +125,40 @@ export const POST = async (req: Request) => {
[],
);
return new Promise((resolve, reject) => {
let message = '';
let sources: any[] = [];
return new Promise(
(
resolve: (value: Response) => void,
reject: (value: Response) => void,
) => {
let message = '';
let sources: any[] = [];
emitter.on('data', (data) => {
try {
const parsedData = JSON.parse(data);
if (parsedData.type === 'response') {
message += parsedData.data;
} else if (parsedData.type === 'sources') {
sources = parsedData.data;
emitter.on('data', (data) => {
try {
const parsedData = JSON.parse(data);
if (parsedData.type === 'response') {
message += parsedData.data;
} else if (parsedData.type === 'sources') {
sources = parsedData.data;
}
} catch (error) {
reject(
Response.json({ message: 'Error parsing data' }, { status: 500 }),
);
}
} catch (error) {
});
emitter.on('end', () => {
resolve(Response.json({ message, sources }, { status: 200 }));
});
emitter.on('error', (error) => {
reject(
Response.json({ message: 'Error parsing data' }, { status: 500 }),
Response.json({ message: 'Search error', error }, { status: 500 }),
);
}
});
emitter.on('end', () => {
resolve(Response.json({ message, sources }, { status: 200 }));
});
emitter.on('error', (error) => {
reject(
Response.json({ message: 'Search error', error }, { status: 500 }),
);
});
});
});
},
);
} catch (err: any) {
console.error(`Error in getting search results: ${err.message}`);
return Response.json(