perf: perf request

This commit is contained in:
xion 2025-04-07 17:04:48 +08:00
parent 226f9a6896
commit fe716b8ea3
2 changed files with 8 additions and 1 deletions

View File

@ -11,10 +11,15 @@ app
.define(async (ctx) => {
const tokenUser = ctx.state.tokenUser;
const type = ctx.query.type || 'keep';
const all = ctx.query.all || false;
let search: any = {};
if (type && !all) {
search.type = type;
}
const aiChatList = await AiChatHistoryModel.findAll({
where: {
uid: tokenUser.id,
type,
...search,
},
order: [['updatedAt', 'DESC']],
});

View File

@ -18,6 +18,8 @@ type AiChatHistoryData = {
[key: string]: any;
};
};
export const aiChatTypes = ['keep', 'temp', 'archive'] as const;
export type AIChatType = (typeof aiChatTypes)[number];
export class AiChatHistoryModel extends Model {
declare id: string;
declare username: string;