|
6 | 6 | :visible="showSidebar" |
7 | 7 | :dir-tree="subDirs" |
8 | 8 | :current-node-key="currentSubDir" |
| 9 | + :loaded-keys="loadedSubDirs" |
9 | 10 | @select-run="onSelectSubDir" |
10 | 11 | @resize="w => sidebarWidth = w" |
11 | 12 | /> |
|
25 | 26 | <el-tag v-if="d.mode === 'directory'" size="small" type="info" style="margin-left: 6px">{{ $t('hyeval.browseDirectory') }}</el-tag> |
26 | 27 | </div> |
27 | 28 | <div class="recent-item-meta"> |
28 | | - <template v-if="d.mode === 'directory'">{{ $t('hyeval.subDirCount', { count: d.records }) }}</template> |
| 29 | + <template v-if="d.mode === 'directory'">{{ $t('hyeval.subDirCount', { count: d.records }) }}<template v-if="d.loaded"> · {{ $t('hyeval.loaded', { count: d.loaded }) }}</template></template> |
29 | 30 | <template v-else>{{ d.records }} {{ $t('hyeval.records') }}</template> |
30 | 31 | · {{ formatTime(d.time) }} |
31 | 32 | </div> |
@@ -405,6 +406,7 @@ export default { |
405 | 406 | currentSubDir: localStorage.getItem('hyeval_current_subdir') || '', |
406 | 407 | sidebarWidth: 0, |
407 | 408 | loadGeneration: 0, |
| 409 | + loadedSubDirs: new Set(), |
408 | 410 | }; |
409 | 411 | }, |
410 | 412 |
|
@@ -621,7 +623,9 @@ export default { |
621 | 623 | updateRecentDirs(name, recordCount, mode) { |
622 | 624 | const MAX = 40; |
623 | 625 | const list = this.recentDirs.filter(d => d.name !== name); |
624 | | - list.unshift({ name, time: Date.now(), records: recordCount || 0, mode: mode || 'file' }); |
| 626 | + const entry = { name, time: Date.now(), records: recordCount || 0, mode: mode || 'file' }; |
| 627 | + if (mode === 'directory') entry.loaded = this.loadedSubDirs.size; |
| 628 | + list.unshift(entry); |
625 | 629 | if (list.length > MAX) list.length = MAX; |
626 | 630 | this.recentDirs = list; |
627 | 631 | localStorage.setItem('hyeval_recent_dirs', JSON.stringify(list)); |
@@ -820,9 +824,16 @@ export default { |
820 | 824 | return; |
821 | 825 | } |
822 | 826 | dirs.sort((a, b) => b.label.localeCompare(a.label)); |
| 827 | + const loaded = new Set(); |
| 828 | + await Promise.all(dirs.map(async (d) => { |
| 829 | + const cached = await this.getJudgeCache(`hyeval_v${CACHE_VERSION}_judge_${d.label}`); |
| 830 | + if (cached) loaded.add(d.label); |
| 831 | + })); |
| 832 | + this.loadedSubDirs = loaded; |
| 833 | + const parentLabel = `${parentHandle.name} (${loaded.size}/${dirs.length})`; |
823 | 834 | this.subDirs = [{ |
824 | 835 | id: `parent_${parentHandle.name}`, |
825 | | - label: parentHandle.name, |
| 836 | + label: parentLabel, |
826 | 837 | children: dirs, |
827 | 838 | }]; |
828 | 839 | this.browseMode = 'directory'; |
@@ -853,6 +864,20 @@ export default { |
853 | 864 | await this.loadDirectory(node.handle); |
854 | 865 | }, |
855 | 866 |
|
| 867 | + updateSidebarLabel() { |
| 868 | + if (!this.subDirs.length) return; |
| 869 | + const root = this.subDirs[0]; |
| 870 | + const total = root.children ? root.children.length : 0; |
| 871 | + const name = this.parentDirHandle ? this.parentDirHandle.name : root.label.replace(/ \(.*\)$/, ''); |
| 872 | + root.label = `${name} (${this.loadedSubDirs.size}/${total})`; |
| 873 | + this.subDirs = [...this.subDirs]; |
| 874 | + const idx = this.recentDirs.findIndex(d => d.name === name && d.mode === 'directory'); |
| 875 | + if (idx !== -1) { |
| 876 | + this.recentDirs[idx].loaded = this.loadedSubDirs.size; |
| 877 | + localStorage.setItem('hyeval_recent_dirs', JSON.stringify(this.recentDirs)); |
| 878 | + } |
| 879 | + }, |
| 880 | +
|
856 | 881 | formatTime(ts) { |
857 | 882 | if (!ts) return ''; |
858 | 883 | const d = new Date(ts); |
@@ -1106,6 +1131,10 @@ export default { |
1106 | 1131 | this.msgCountMap = cachedMsg; |
1107 | 1132 | this.diagMap = cachedDiag; |
1108 | 1133 | this.toolCallMap = cachedTool; |
| 1134 | + if (this.browseMode === 'directory' && fn) { |
| 1135 | + this.loadedSubDirs.add(fn); |
| 1136 | + this.updateSidebarLabel(); |
| 1137 | + } |
1109 | 1138 | return; |
1110 | 1139 | } |
1111 | 1140 |
|
@@ -1169,6 +1198,10 @@ export default { |
1169 | 1198 | await this.setJudgeCache(msgCacheKey, msgMap); |
1170 | 1199 | await this.setJudgeCache(diagCacheKey, diagMapLocal); |
1171 | 1200 | await this.setJudgeCache(toolCacheKey, toolMap); |
| 1201 | + if (this.browseMode === 'directory' && fn) { |
| 1202 | + this.loadedSubDirs.add(fn); |
| 1203 | + this.updateSidebarLabel(); |
| 1204 | + } |
1172 | 1205 | }, |
1173 | 1206 |
|
1174 | 1207 | async getJudgeCache(key) { |
|
0 commit comments