| 1174 | } |
| 1175 | |
| 1176 | private generateRelevanceReason(chunk: CodeChunk, query: string): string { |
| 1177 | const reasons: string[] = []; |
| 1178 | |
| 1179 | if (chunk.componentType) { |
| 1180 | reasons.push(`${chunk.componentType}`); |
| 1181 | } |
| 1182 | |
| 1183 | if (chunk.layer) { |
| 1184 | reasons.push(`${chunk.layer} layer`); |
| 1185 | } |
| 1186 | |
| 1187 | const queryLower = query.toLowerCase(); |
| 1188 | const matchingTags = (chunk.tags || []).filter((tag) => queryLower.includes(tag.toLowerCase())); |
| 1189 | if (matchingTags.length > 0) { |
| 1190 | reasons.push(`tags: ${matchingTags.join(', ')}`); |
| 1191 | } |
| 1192 | |
| 1193 | return reasons.length > 0 ? reasons.join('; ') : 'content match'; |
| 1194 | } |
| 1195 | |
| 1196 | async getChunkCount(): Promise<number> { |
| 1197 | if (this.storageProvider) { |