mirror of
https://github.com/hexastack/hexabot
synced 2025-05-08 06:44:49 +00:00
fix: apply feedback updates
This commit is contained in:
parent
1eb09ab84e
commit
1cc99d0020
@ -117,24 +117,15 @@ export class NlpValueRepository extends BaseRepository<
|
||||
}
|
||||
|
||||
private async aggregateWithCount<T extends 'full' | 'stub' = 'stub'>(
|
||||
{ limit = 10, skip = 0, sort = ['createdAt', -1] }: PageQueryDto<NlpValue>,
|
||||
{
|
||||
limit = 10,
|
||||
skip = 0,
|
||||
sort = ['createdAt', 'desc'],
|
||||
}: PageQueryDto<NlpValue>,
|
||||
{ $and = [], ...rest }: TFilterQuery<NlpValue>,
|
||||
populatePipelineStages: PipelineStage[] = [],
|
||||
) {
|
||||
const pipeline: PipelineStage[] = [
|
||||
// support pageQuery
|
||||
{
|
||||
$limit: limit,
|
||||
},
|
||||
{
|
||||
$skip: skip,
|
||||
},
|
||||
{
|
||||
$sort: {
|
||||
[sort[0]]: sort[1] === 'desc' ? -1 : 1,
|
||||
_id: sort[1] === 'desc' ? -1 : 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
// support filters
|
||||
$match: {
|
||||
@ -152,6 +143,13 @@ export class NlpValueRepository extends BaseRepository<
|
||||
}),
|
||||
},
|
||||
},
|
||||
// support pageQuery
|
||||
{
|
||||
$skip: skip,
|
||||
},
|
||||
{
|
||||
$limit: limit,
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'nlpsampleentities',
|
||||
@ -196,6 +194,12 @@ export class NlpValueRepository extends BaseRepository<
|
||||
},
|
||||
},
|
||||
...populatePipelineStages,
|
||||
{
|
||||
$sort: {
|
||||
[sort[0]]: sort[1].toString().startsWith('desc') ? -1 : 1,
|
||||
_id: sort[1].toString().startsWith('desc') ? -1 : 1,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
return await this.model.aggregate<TNlpValueCountFormat<T>>(pipeline).exec();
|
||||
|
@ -126,14 +126,17 @@ export const NlpValues = ({ entityId }: { entityId: string }) => {
|
||||
renderHeader,
|
||||
},
|
||||
{
|
||||
flex: 3,
|
||||
flex: 2,
|
||||
field: "nlpSamplesCount",
|
||||
align: "center",
|
||||
headerName: t("label.nlp_samples_count"),
|
||||
sortable: true,
|
||||
disableColumnMenu: true,
|
||||
headerAlign: "center",
|
||||
renderHeader,
|
||||
renderCell: ({ row }) => (
|
||||
<Chip
|
||||
sx={{ alignContent: "center" }}
|
||||
id={(row.nlpSamplesCount || `nlpSamplesCount_${row.id}`).toString()}
|
||||
label={row.nlpSamplesCount?.toString()}
|
||||
variant="inbox"
|
||||
|
Loading…
Reference in New Issue
Block a user