generated from tailored/app-template
perf: perf request
This commit is contained in:
parent
226f9a6896
commit
fe716b8ea3
@ -11,10 +11,15 @@ app
|
|||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
const tokenUser = ctx.state.tokenUser;
|
const tokenUser = ctx.state.tokenUser;
|
||||||
const type = ctx.query.type || 'keep';
|
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({
|
const aiChatList = await AiChatHistoryModel.findAll({
|
||||||
where: {
|
where: {
|
||||||
uid: tokenUser.id,
|
uid: tokenUser.id,
|
||||||
type,
|
...search,
|
||||||
},
|
},
|
||||||
order: [['updatedAt', 'DESC']],
|
order: [['updatedAt', 'DESC']],
|
||||||
});
|
});
|
||||||
|
@ -18,6 +18,8 @@ type AiChatHistoryData = {
|
|||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
export const aiChatTypes = ['keep', 'temp', 'archive'] as const;
|
||||||
|
export type AIChatType = (typeof aiChatTypes)[number];
|
||||||
export class AiChatHistoryModel extends Model {
|
export class AiChatHistoryModel extends Model {
|
||||||
declare id: string;
|
declare id: string;
|
||||||
declare username: string;
|
declare username: string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user