刘立冬 2 週間 前
コミット
f6858f6bb1
1 ファイル変更36 行追加25 行削除
  1. 36 25
      src/visualizers/deconstruction_visualizer.py

+ 36 - 25
src/visualizers/deconstruction_visualizer.py

@@ -1052,8 +1052,8 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
         .path-probability {{
             margin-top: 6px;
             padding: 8px;
-            background: #fef3c7;
-            border-left: 3px solid #f59e0b;
+            background: #f0f9ff;
+            border-left: 3px solid #3b82f6;
             border-radius: 4px;
             font-size: 11px;
             line-height: 1.6;
@@ -1061,7 +1061,7 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
 
         .path-probability-label {{
             font-weight: 600;
-            color: #92400e;
+            color: #2563eb;
             margin-bottom: 4px;
         }}
 
@@ -1075,9 +1075,9 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
         .path-node {{
             padding: 4px 8px;
             background: white;
-            border: 1px solid #fbbf24;
+            border: 1px solid #93c5fd;
             border-radius: 4px;
-            color: #78350f;
+            color: #1e40af;
             font-weight: 500;
             font-size: 10px;
         }}
@@ -1086,7 +1086,7 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
             position: relative;
             flex: 1;
             height: 2px;
-            background: #fbbf24;
+            background: #93c5fd;
             min-width: 30px;
         }}
 
@@ -1097,7 +1097,7 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
             top: -3px;
             width: 0;
             height: 0;
-            border-left: 6px solid #fbbf24;
+            border-left: 6px solid #93c5fd;
             border-top: 4px solid transparent;
             border-bottom: 4px solid transparent;
         }}
@@ -1107,7 +1107,7 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
             top: -16px;
             left: 50%;
             transform: translateX(-50%);
-            background: #fbbf24;
+            background: #3b82f6;
             color: white;
             padding: 2px 6px;
             border-radius: 4px;
@@ -1128,11 +1128,17 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
             line-height: 1.6;
         }}
 
+        .reasoning-header {{
+            display: flex;
+            align-items: center;
+            gap: 8px;
+            margin-bottom: 4px;
+        }}
+
         .reasoning-label {{
             font-weight: 600;
             color: #2563eb;
-            margin-bottom: 4px;
-            display: block;
+            display: inline-block;
         }}
 
         .reasoning-text {{
@@ -1145,8 +1151,7 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
 
         .reasoning-toggle {{
             display: inline-block;
-            margin-top: 6px;
-            padding: 4px 10px;
+            padding: 2px 8px;
             font-size: 11px;
             font-weight: 600;
             color: #3b82f6;
@@ -1344,21 +1349,28 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
         /* 右侧栏搜索词项 */
         .searchword-item {{
             padding: 12px 15px;
-            border-bottom: 1px solid #e5e7eb;
+            margin-bottom: 12px;
+            border: 1px solid #e5e7eb;
+            border-radius: 8px;
             cursor: pointer;
             transition: all 0.2s;
             border-left: 3px solid transparent;
+            background: white;
+            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
         }}
 
         .searchword-item:hover {{
             background: #dbeafe;
             border-left-color: #3b82f6;
+            box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
         }}
 
         .searchword-item.active {{
             background: linear-gradient(90deg, #dbeafe 0%, #eff6ff 100%);
             border-left-color: #3b82f6;
+            border-color: #3b82f6;
             position: relative;
+            box-shadow: 0 3px 10px rgba(59, 130, 246, 0.2);
         }}
 
         .searchword-item.active::after {{
@@ -3260,7 +3272,7 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
 
         <!-- 中间栏:base_word列表 -->
         <div class="middle-sidebar" id="middleSidebar">
-            <div class="sidebar-header">人设-人设分类、标签</div>
+            <div class="sidebar-header">人设-人设分类、标签(匹配度TOP3)</div>
             <div class="sidebar-content" id="middleContent"></div>
         </div>
 
@@ -3954,10 +3966,7 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
                     <div class="searchword-item ${{isActive ? 'active' : ''}}"
                          onclick="selectSearchWord(${{featureIdx}}, ${{baseWordIdx}}, ${{swIdx}})"
                          id="searchword-${{featureIdx}}-${{baseWordIdx}}-${{swIdx}}">
-                        <div class="cascade-item-title">📝 ${{searchWord}}</div>
-                        <div style="font-size:11px;color:#6b7280;margin-top:4px;">
-                            组合词: ${{sourceWord}} → [${{score.toFixed(2)}}]
-                        </div>
+                        <div class="cascade-item-title">🔍 ${{searchWord}}</div>
                         ${{evalBadges ? `<div style="margin-top:4px;">${{evalBadges}}</div>` : ''}}
                         ${{originalFeature ? `
                             <div class="path-probability">
@@ -3973,14 +3982,16 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
                         ` : ''}}
                         ${{reasoning ? `
                             <div class="search-word-reasoning">
-                                <span class="reasoning-label">💭 推荐理由</span>
+                                <div class="reasoning-header">
+                                    <span class="reasoning-label">💭 推荐理由</span>
+                                    <div class="reasoning-toggle"
+                                         onclick="event.stopPropagation(); toggleSearchWordReasoning('${{reasoningId}}')">
+                                        展开 ▼
+                                    </div>
+                                </div>
                                 <div class="reasoning-text" id="${{reasoningId}}-text">
                                     ${{reasoning}}
                                 </div>
-                                <div class="reasoning-toggle"
-                                     onclick="event.stopPropagation(); toggleSearchWordReasoning('${{reasoningId}}')">
-                                    展开 ▼
-                                </div>
                             </div>
                         ` : ''}}
                     </div>
@@ -4124,8 +4135,8 @@ def generate_html(data: List[Dict[str, Any]], stats: Dict[str, Any],
 
                 const evalDetailId = `eval-detail-${{featureIdx}}-${{baseWordIdx}}-${{swIdx}}-${{noteIdx}}`;
 
-                // 检查是否有解构数据
-                const hasDeconstruction = deconstructionData[noteId] != null;
+                // 检查是否有解构数据,且仅当完全匹配时显示解构按钮
+                const hasDeconstruction = deconstructionData[noteId] != null && matchType.includes('完全匹配');
 
                 html += `
                     <div class="note-card ${{matchClass}}" style="border:2px solid #fbbf24;border-radius:12px;overflow:hidden;background:white;transition:all 0.2s;">