mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
perf: 倒序
This commit is contained in:
@@ -40,6 +40,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
const searchRes = await pg.query<PgModelDataItemType>(`SELECT id, q, a, status
|
||||
FROM modelData
|
||||
WHERE user_id='${userId}' AND model_id='${modelId}'
|
||||
ORDER BY id DESC
|
||||
LIMIT ${pageSize} OFFSET ${pageSize * (pageNum - 1)}
|
||||
`);
|
||||
|
||||
|
@@ -16,9 +16,6 @@ export const connectPg = async () => {
|
||||
connectionTimeoutMillis: 2000
|
||||
});
|
||||
|
||||
global.pgClient.on('connect', () => {
|
||||
console.log('pg connected');
|
||||
});
|
||||
global.pgClient.on('error', (err) => {
|
||||
console.log(err);
|
||||
global.pgClient = null;
|
||||
@@ -26,6 +23,7 @@ export const connectPg = async () => {
|
||||
|
||||
try {
|
||||
await global.pgClient.connect();
|
||||
console.log('pg connected');
|
||||
return global.pgClient;
|
||||
} catch (error) {
|
||||
global.pgClient = null;
|
||||
|
Reference in New Issue
Block a user