|
71 | 71 | /** @type {string | null | undefined } */ |
72 | 72 | let nextId; |
73 | 73 |
|
| 74 | + /** @type {number | null | undefined} */ |
| 75 | + let totalDataCount; |
| 76 | +
|
74 | 77 | /** @type {string} */ |
75 | 78 | let editCollection; |
76 | 79 |
|
|
208 | 211 |
|
209 | 212 | searchVectorKnowledge(selectedCollection, params).then(res => { |
210 | 213 | items = res || []; |
| 214 | + totalDataCount = items.length; |
211 | 215 | isFromSearch = true; |
212 | 216 | }).finally(() => { |
213 | 217 | isSearching = false; |
|
367 | 371 | items = [ ...items, ...newItems ]; |
368 | 372 | } |
369 | 373 | nextId = res.next_id; |
| 374 | + totalDataCount = res.count; |
370 | 375 | resolve(res); |
371 | 376 | }).catch(err => { |
372 | 377 | console.log(err); |
|
447 | 452 | isComplete = false; |
448 | 453 | }, duration); |
449 | 454 | items = items?.filter(x => x.id !== id) || []; |
| 455 | + if (totalDataCount) { |
| 456 | + totalDataCount -= 1; |
| 457 | + } |
450 | 458 | } else { |
451 | 459 | throw 'error when deleting vector knowledge!'; |
452 | 460 | } |
|
1032 | 1040 | <div class="w-100"> |
1033 | 1041 | <Card> |
1034 | 1042 | <CardBody> |
1035 | | - <div class="mt-2"> |
1036 | | - <div class="d-flex flex-wrap mb-3 justify-content-between knowledge-table-header"> |
1037 | | - <div class="d-flex" style="gap: 5px;"> |
1038 | | - <h5 class="font-size-16 knowledge-header-text"> |
| 1043 | + <div class="mt-2 knowledge-table-header"> |
| 1044 | + {#if totalDataCount != null && totalDataCount != undefined} |
| 1045 | + <div class="knowledge-count line-align-center text-muted font-size-11"> |
| 1046 | + {`Total data: ${Number(totalDataCount).toLocaleString("en-US")}`} |
| 1047 | + </div> |
| 1048 | + {/if} |
| 1049 | + <div class="d-flex flex-wrap mb-3 justify-content-between"> |
| 1050 | + <div class="action-container-padding d-flex" style="gap: 5px;"> |
| 1051 | + <h5 class="knowledge-header-text font-size-16"> |
1039 | 1052 | <div>{$_('Knowledges')}</div> |
1040 | 1053 | </h5> |
1041 | 1054 | <div |
|
1044 | 1057 | data-bs-placement="top" |
1045 | 1058 | title="Add knowledge" |
1046 | 1059 | > |
1047 | | - <Button |
1048 | | - class="btn btn-sm btn-soft-primary knowledge-btn-icon" |
| 1060 | + <Button |
| 1061 | + class="btn btn-sm btn-soft-primary knowledge-btn-icon" |
1049 | 1062 | disabled={disabled} |
1050 | | - on:click={() => onKnowledgeCreate()} |
1051 | | - > |
1052 | | - <i class="mdi mdi-plus" /> |
1053 | | - </Button> |
| 1063 | + on:click={() => onKnowledgeCreate()} |
| 1064 | + > |
| 1065 | + <i class="mdi mdi-plus" /> |
| 1066 | + </Button> |
1054 | 1067 | </div> |
1055 | 1068 | <div |
1056 | 1069 | class="line-align-center" |
1057 | 1070 | data-bs-toggle="tooltip" |
1058 | 1071 | data-bs-placement="top" |
1059 | 1072 | title="Delete all data" |
1060 | 1073 | > |
1061 | | - <Button |
1062 | | - class="btn btn-sm btn-soft-danger knowledge-btn-icon" |
| 1074 | + <Button |
| 1075 | + class="btn btn-sm btn-soft-danger knowledge-btn-icon" |
1063 | 1076 | disabled={disabled} |
1064 | | - on:click={() => onKnowledgeDeleteAll()} |
1065 | | - > |
1066 | | - <i class="mdi mdi-minus" /> |
1067 | | - </Button> |
| 1077 | + on:click={() => onKnowledgeDeleteAll()} |
| 1078 | + > |
| 1079 | + <i class="mdi mdi-minus" /> |
| 1080 | + </Button> |
1068 | 1081 | </div> |
1069 | 1082 | </div> |
1070 | | -
|
1071 | | - <div class="collection-action-container"> |
| 1083 | + <div class="collection-action-container action-container-padding"> |
1072 | 1084 | {#if selectedCollection} |
1073 | 1085 | <div |
1074 | 1086 | class="line-align-center" |
|
0 commit comments