刘立冬 3 周之前
父節點
當前提交
7c86694181
共有 3 個文件被更改,包括 40 次插入14 次删除
  1. 1 1
      analyze_feature_matches.py
  2. 1 1
      enhanced_search_v2.py
  3. 38 12
      visualize_stage78_with_deconstruction.py

+ 1 - 1
analyze_feature_matches.py

@@ -176,7 +176,7 @@ def save_results(results: Dict[str, Any], output_file: str):
 
 def main():
     # 输入文件路径
-    input_file = "/Users/liulidong/project/pattern相关文件/optimization/69114f150000000007001f30_how copy.json"
+    input_file = "/Users/liulidong/project/pattern相关文件/optimization/690d977d0000000007036331_how.json"
 
     # 输出文件路径
     output_file = "/Users/liulidong/project/pattern相关文件/optimization/feature_matches_analysis.json"

+ 1 - 1
enhanced_search_v2.py

@@ -1892,7 +1892,7 @@ def main():
     parser = argparse.ArgumentParser(description='增强搜索系统V2')
     parser.add_argument(
         '--how-json',
-        default='69114f150000000007001f30_how copy.json',
+        default='690d977d0000000007036331_how.json',
         help='How解构文件路径'
     )
     parser.add_argument(

+ 38 - 12
visualize_stage78_with_deconstruction.py

@@ -340,6 +340,14 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
             margin-bottom: 5px;
         }}
 
+        .post-target-word {{
+            color: #2563eb;
+            background: linear-gradient(90deg, #dbeafe 0%, #f0f9ff 100%);
+            padding: 8px 12px;
+            border-radius: 6px;
+            border-left: 4px solid #2563eb;
+        }}
+
         .feature-meta {{
             font-size: 12px;
             color: #6b7280;
@@ -388,6 +396,14 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
             margin-bottom: 4px;
         }}
 
+        .persona-feature {{
+            color: #059669;
+            background: linear-gradient(90deg, #d1fae5 0%, #ecfdf5 100%);
+            padding: 6px 10px;
+            border-radius: 5px;
+            border-left: 3px solid #059669;
+        }}
+
         .base-word-meta {{
             font-size: 11px;
             color: #6b7280;
@@ -1847,10 +1863,7 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
                 html += `
                     <div class="feature-group">
                         <div class="feature-header" onclick="toggleFeature(${{featureIdx}})" id="feature-header-${{featureIdx}}">
-                            <div class="feature-title">${{feature['原始特征名称']}}</div>
-                            <div class="feature-meta">
-                                ${{feature['来源层级']}} · 权重: ${{feature['权重'].toFixed(2)}} · ${{totalSearches}}个搜索词
-                            </div>
+                            <div class="feature-title post-target-word">📝 ${{feature['原始特征名称']}}</div>
                         </div>
                         <div class="search-words-list" id="search-words-${{featureIdx}}">
                 `;
@@ -1867,7 +1880,7 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
                         <div class="base-word-group">
                             <div class="base-word-header" onclick="toggleBaseWord(${{featureIdx}}, ${{groupIdx}})"
                                  id="base-word-header-${{featureIdx}}-${{groupIdx}}">
-                                <div class="base-word-title">🎯 ${{baseWord}}</div>
+                                <div class="base-word-title persona-feature">👤 ${{baseWord}}</div>
                                 <div class="base-word-meta">相似度: ${{baseSimilarity.toFixed(2)}} · ${{searches.length}}个搜索词</div>
                             </div>
                             <div class="base-word-desc" id="base-word-desc-${{featureIdx}}-${{groupIdx}}">
@@ -2095,14 +2108,14 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
             }}
 
             // 检查是否有解构数据(仅完全匹配)
-            // 调试日志: 记录解构按钮判断过程
-            const inStage7 = !!stage7Data[noteId];
             const inStage8 = !!stage8Data[noteId];
-            const hasDeconstruction = evalCategory === 'complete' && (inStage7 || inStage8);
+            const stage8Features = inStage8 ? (stage8Data[noteId].deconstructed_features || []) : [];
+            const hasValidFeatures = stage8Features.length > 0;
+            const hasDeconstruction = evalCategory === 'complete' && hasValidFeatures;
 
-            // 只为特定note_id输出调试信息(避免console过多输出)
-            if (noteId === '67bda4680000000029013382' || hasDeconstruction) {{
-                console.log(`[解构按钮判断] noteId=${{noteId}}, evalCategory=${{evalCategory}}, inStage7=${{inStage7}}, inStage8=${{inStage8}}, hasDeconstruction=${{hasDeconstruction}}`);
+            // 调试日志: 记录解构按钮判断过程
+            if (noteId === '67e554a300000000090148a7' || hasDeconstruction) {{
+                console.log(`[解构按钮] noteId=${{noteId}}, evalCategory=${{evalCategory}}, inStage8=${{inStage8}}, 特征数=${{stage8Features.length}}, 显示按钮=${{hasDeconstruction}}`);
             }}
 
             let deconstructionSection = '';
@@ -2376,12 +2389,25 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
         function renderDeconstructionContent(noteId) {{
             const stage8Info = stage8Data[noteId];
             if (!stage8Info) {{
-                return '<div style="padding: 15px; text-align: center; color: #6b7280;">暂无解构数据</div>';
+                return `<div style="padding: 30px; text-align: center; color: #6b7280;">
+                    <div style="font-size: 48px; margin-bottom: 10px;">📭</div>
+                    <div style="font-size: 16px; margin-bottom: 8px;">暂无解构数据</div>
+                    <div style="font-size: 14px; opacity: 0.7;">该帖子未进行特征解构分析</div>
+                </div>`;
             }}
 
             const originalFeature = stage8Info.original_feature || '未知特征';
             const features = stage8Info.deconstructed_features || [];
 
+            if (features.length === 0) {{
+                return `<div style="padding: 30px; text-align: center; color: #6b7280;">
+                    <div style="font-size: 48px; margin-bottom: 10px;">🔍</div>
+                    <div style="font-size: 16px; margin-bottom: 8px;">未提取到解构特征</div>
+                    <div style="font-size: 14px; opacity: 0.7;">原始特征:"${{originalFeature}}"</div>
+                    <div style="font-size: 13px; opacity: 0.6; margin-top: 10px;">该帖子虽然评分较高,但AI未能从中提取到有效的解构特征</div>
+                </div>`;
+            }}
+
             // 按维度分组
             const dimensionGroups = {{}};
             features.forEach(feat => {{