DawnC commited on
Commit
871beb7
1 Parent(s): ca83381

Update search_history.py

Browse files
Files changed (1) hide show
  1. search_history.py +5 -19
search_history.py CHANGED
@@ -43,16 +43,12 @@ class SearchHistoryComponent:
43
  search_type = entry.get('search_type', 'criteria')
44
  results = entry.get('results', [])
45
 
46
- # 根據搜尋類型使用不同的標題樣式
47
- type_label = "Criteria History" if search_type == "criteria" else "Description History"
48
- type_color = "#4299e1" if search_type == "criteria" else "#48bb78" # 藍色vs綠色
49
-
50
  html += f"""
51
  <div class="history-entry">
52
- <div class="history-header" style="border-left: 4px solid {type_color}; padding-left: 10px;">
53
  <span class="timestamp">🕒 {timestamp}</span>
54
- <span class="search-type" style="color: {type_color}; font-weight: bold; margin-left: 10px;">
55
- {type_label}
56
  </span>
57
  </div>
58
  """
@@ -72,17 +68,8 @@ class SearchHistoryComponent:
72
  </ul>
73
  </div>
74
  """
75
- else:
76
- # Description 搜尋的顯示邏輯
77
- description = entry.get('description', 'No description provided')
78
- html += f"""
79
- <div class="description-section" style="background: #f8fafc; padding: 16px; border-radius: 8px; margin-bottom: 16px;">
80
- <h4 style="font-size: 1.1em; font-weight: 600; color: #2D3748; margin-bottom: 12px; border-bottom: 2px solid #E2E8F0; padding-bottom: 8px;">Search Description:</h4>
81
- <p class="user-description" style="color: #4A5568; font-style: italic; line-height: 1.6; margin: 8px 0;">{description}</p>
82
- </div>
83
- """
84
 
85
- # 共用的結果顯示邏輯
86
  html += """
87
  <div class="results-list">
88
  <h4 style="font-size: 1.1em; font-weight: 600; color: #2D3748; margin-bottom: 12px; border-bottom: 2px solid #E2E8F0; padding-bottom: 8px;">Top 10 Breed Matches:</h4>
@@ -155,8 +142,7 @@ class SearchHistoryComponent:
155
  return self.history_manager.save_history(
156
  user_preferences=user_preferences,
157
  results=results,
158
- search_type=search_type,
159
- description=description
160
  )
161
 
162
  def create_history_component():
 
43
  search_type = entry.get('search_type', 'criteria')
44
  results = entry.get('results', [])
45
 
 
 
 
 
46
  html += f"""
47
  <div class="history-entry">
48
+ <div class="history-header" style="border-left: 4px solid #4299e1; padding-left: 10px;">
49
  <span class="timestamp">🕒 {timestamp}</span>
50
+ <span class="search-type" style="color: #4299e1; font-weight: bold; margin-left: 10px;">
51
+ Search History
52
  </span>
53
  </div>
54
  """
 
68
  </ul>
69
  </div>
70
  """
 
 
 
 
 
 
 
 
 
71
 
72
+ # 結果顯示邏輯
73
  html += """
74
  <div class="results-list">
75
  <h4 style="font-size: 1.1em; font-weight: 600; color: #2D3748; margin-bottom: 12px; border-bottom: 2px solid #E2E8F0; padding-bottom: 8px;">Top 10 Breed Matches:</h4>
 
142
  return self.history_manager.save_history(
143
  user_preferences=user_preferences,
144
  results=results,
145
+ search_type='criteria',
 
146
  )
147
 
148
  def create_history_component():