mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +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
|
const searchRes = await pg.query<PgModelDataItemType>(`SELECT id, q, a, status
|
||||||
FROM modelData
|
FROM modelData
|
||||||
WHERE user_id='${userId}' AND model_id='${modelId}'
|
WHERE user_id='${userId}' AND model_id='${modelId}'
|
||||||
|
ORDER BY id DESC
|
||||||
LIMIT ${pageSize} OFFSET ${pageSize * (pageNum - 1)}
|
LIMIT ${pageSize} OFFSET ${pageSize * (pageNum - 1)}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
@@ -16,9 +16,6 @@ export const connectPg = async () => {
|
|||||||
connectionTimeoutMillis: 2000
|
connectionTimeoutMillis: 2000
|
||||||
});
|
});
|
||||||
|
|
||||||
global.pgClient.on('connect', () => {
|
|
||||||
console.log('pg connected');
|
|
||||||
});
|
|
||||||
global.pgClient.on('error', (err) => {
|
global.pgClient.on('error', (err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
global.pgClient = null;
|
global.pgClient = null;
|
||||||
@@ -26,6 +23,7 @@ export const connectPg = async () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await global.pgClient.connect();
|
await global.pgClient.connect();
|
||||||
|
console.log('pg connected');
|
||||||
return global.pgClient;
|
return global.pgClient;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
global.pgClient = null;
|
global.pgClient = null;
|
||||||
|
Reference in New Issue
Block a user