fisherman611 commited on
Commit
28f6dae
·
verified ·
1 Parent(s): 80a91cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -341,10 +341,6 @@ class VietnameseLegalChatbot:
341
  if Config.SHOW_SEARCH_TRIGGER_INFO:
342
  source_info = "\n\n*🔍➡️🌐 Không tìm thấy đủ thông tin trong tài liệu tham khảo nên đã tự động tìm kiếm trên web.*"
343
  self.metrics["fallback_queries"] += 1
344
- elif result.get('enhanced_search_used'):
345
- if Config.SHOW_SEARCH_TRIGGER_INFO:
346
- source_info = "\n\n*🔍➡️🔎 Đã tự động sử dụng tìm kiếm nâng cao để tìm thông tin bổ sung.*"
347
- self.metrics["fallback_queries"] += 1
348
  else:
349
  if Config.SHOW_SEARCH_TRIGGER_INFO:
350
  source_info = "\n\n*🔍 Đã kích hoạt tìm kiếm tự động.*"
@@ -354,9 +350,6 @@ class VietnameseLegalChatbot:
354
  if result.get('search_results'):
355
  if Config.SHOW_SOURCE_INFO:
356
  source_info = "\n\n*🌐 Thông tin này được tìm kiếm từ web do không tìm thấy đủ thông tin trong cơ sở dữ liệu pháp luật nội bộ.*"
357
- elif result.get('enhanced_search_used'):
358
- if Config.SHOW_SOURCE_INFO:
359
- source_info = "\n\n*🔍 Sử dụng tìm kiếm nâng cao.*"
360
  else:
361
  self.metrics["successful_queries"] += 1
362
  if Config.SHOW_SOURCE_INFO:
@@ -411,11 +404,12 @@ class VietnameseLegalChatbot:
411
  # Safe access to document properties
412
  title = str(doc.get('title', 'Không có tiêu đề'))
413
  content = str(doc.get('content', ''))
 
414
 
415
  # Truncate content for display
416
  display_content = content[:200] + "..." if len(content) > 200 else content
417
 
418
- docs_html += f"### 📄 {i}. {title}\n"
419
  docs_html += f"**📝 Nội dung:** {display_content}\n\n"
420
  docs_html += "---\n\n"
421
 
@@ -645,4 +639,4 @@ def main():
645
  interface.launch()
646
 
647
  if __name__ == "__main__":
648
- main()
 
341
  if Config.SHOW_SEARCH_TRIGGER_INFO:
342
  source_info = "\n\n*🔍➡️🌐 Không tìm thấy đủ thông tin trong tài liệu tham khảo nên đã tự động tìm kiếm trên web.*"
343
  self.metrics["fallback_queries"] += 1
 
 
 
 
344
  else:
345
  if Config.SHOW_SEARCH_TRIGGER_INFO:
346
  source_info = "\n\n*🔍 Đã kích hoạt tìm kiếm tự động.*"
 
350
  if result.get('search_results'):
351
  if Config.SHOW_SOURCE_INFO:
352
  source_info = "\n\n*🌐 Thông tin này được tìm kiếm từ web do không tìm thấy đủ thông tin trong cơ sở dữ liệu pháp luật nội bộ.*"
 
 
 
353
  else:
354
  self.metrics["successful_queries"] += 1
355
  if Config.SHOW_SOURCE_INFO:
 
404
  # Safe access to document properties
405
  title = str(doc.get('title', 'Không có tiêu đề'))
406
  content = str(doc.get('content', ''))
407
+ law_id = str(doc['metadata'].get('law_id', ''))
408
 
409
  # Truncate content for display
410
  display_content = content[:200] + "..." if len(content) > 200 else content
411
 
412
+ docs_html += f"### 📄 {i}. ({law_id}) {title}\n"
413
  docs_html += f"**📝 Nội dung:** {display_content}\n\n"
414
  docs_html += "---\n\n"
415
 
 
639
  interface.launch()
640
 
641
  if __name__ == "__main__":
642
+ main()