generated from tailored/app-template
	perf: perf request
This commit is contained in:
		@@ -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;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user