feat: 为shell-analysis接口添加投票数量字段

- 在FeatureDeletion结构体中添加vote_count字段,记录多方向投影分析中的投票数量
- 在AnalyzeShellFeaturesEnhanced函数中填充投票数据,利用visibilityVotes映射
- 更新JSON响应,为safeDeletions、suggestedDeletions、preserveList添加voteCount字段
- 提供模型外表面可见性程度的量化指标,增强分析结果的透明度

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sladro 2025-09-19 16:40:23 +08:00
parent 1383d9997a
commit 99c6d17795
3 changed files with 11 additions and 3 deletions

View File

@ -1725,6 +1725,10 @@ CreoManager::ShellAnalysisResult CreoManager::AnalyzeShellFeaturesEnhanced(const
deletion.part_path = ""; // Not available in current analysis
deletion.component_type = "COMPONENT";
// Set vote count from projection analysis
auto votesIter = visibilityVotes.find(item.feature_id);
deletion.vote_count = (votesIter != visibilityVotes.end()) ? votesIter->second : 0;
if (item.confidence >= 0.8) {
// Safe deletion - high confidence internal components
result.safe_deletions.push_back(deletion);

View File

@ -260,6 +260,7 @@ public:
std::string part_path;
std::string component_type = "FEATURE";
std::string volume_units = "percentage"; // Added to clarify units
int vote_count = 0; // Number of votes this component received in multi-directional projection analysis
};
struct EstimatedReduction {

View File

@ -995,7 +995,8 @@ HttpResponse ShellAnalysisHandler(const HttpRequest& request) {
<< "\"volumeReduction\": " << deletion.volume_reduction << ","
<< "\"partFile\": \"" << EscapeJsonString(deletion.part_file) << "\","
<< "\"partPath\": \"" << EscapeJsonString(deletion.part_path) << "\","
<< "\"componentType\": \"" << EscapeJsonString(deletion.component_type) << "\""
<< "\"componentType\": \"" << EscapeJsonString(deletion.component_type) << "\","
<< "\"voteCount\": " << deletion.vote_count
<< "}";
}
@ -1016,7 +1017,8 @@ HttpResponse ShellAnalysisHandler(const HttpRequest& request) {
<< "\"volumeReduction\": " << deletion.volume_reduction << ","
<< "\"partFile\": \"" << EscapeJsonString(deletion.part_file) << "\","
<< "\"partPath\": \"" << EscapeJsonString(deletion.part_path) << "\","
<< "\"componentType\": \"" << EscapeJsonString(deletion.component_type) << "\""
<< "\"componentType\": \"" << EscapeJsonString(deletion.component_type) << "\","
<< "\"voteCount\": " << deletion.vote_count
<< "}";
}
@ -1037,7 +1039,8 @@ HttpResponse ShellAnalysisHandler(const HttpRequest& request) {
<< "\"volumeReduction\": " << preserve.volume_reduction << ","
<< "\"partFile\": \"" << EscapeJsonString(preserve.part_file) << "\","
<< "\"partPath\": \"" << EscapeJsonString(preserve.part_path) << "\","
<< "\"componentType\": \"" << EscapeJsonString(preserve.component_type) << "\""
<< "\"componentType\": \"" << EscapeJsonString(preserve.component_type) << "\","
<< "\"voteCount\": " << preserve.vote_count
<< "}";
}