feat:dynamic retrieval display on frontend#97
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements dynamic retrieval display functionality on the frontend by adding multi-language support with real-time progress tracking and comprehensive WebSocket-based communication for Q&A operations.
Key Changes:
- Multi-language support: Replaced hardcoded Chinese text with dynamic English/Chinese language switching functionality
- Real-time WebSocket communication: Added comprehensive WebSocket messaging for live Q&A progress updates with sub-question tracking and IRCoT step visualization
- Streamlined backend processing: Removed complex security hardening and simplified file upload handling while adding async processing for better performance
Reviewed Changes
Copilot reviewed 17 out of 29 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| frontend/index.html | Complete frontend overhaul with dynamic language switching, real-time Q&A progress display, and WebSocket integration |
| backend.py | Simplified upload logic, added comprehensive WebSocket Q&A progress updates, and improved async processing |
| docs/* | Removed entire documentation directory and related files |
| .github/workflows/publish-docs.yml | Removed GitHub Pages documentation deployment workflow |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| import os | ||
| import re | ||
| import sys |
There was a problem hiding this comment.
The removed import re is still used in the file at line 774 where it's imported as _re. Consider importing re at the top of the file instead of importing it within the function for better code organization.
| <div id="upload" class="tab-content"> | ||
| <div class="card"> | ||
| <h2 data-i18n="upload_documents_title">上传文档</h2> | ||
| <h2 id="uploadDocumentsTitle">Upload Documents</h2> |
There was a problem hiding this comment.
Inconsistent indentation detected. This line has excessive indentation compared to surrounding lines which may indicate a formatting issue.
| <h2 id="uploadDocumentsTitle">Upload Documents</h2> | |
| <h2 id="uploadDocumentsTitle">Upload Documents</h2> |
| <h2 id="uploadDocumentsTitle">Upload Documents</h2> | ||
| <div class="upload-area" id="uploadArea"> | ||
| <div class="upload-icon">📁</div> | ||
| <h3 data-i18n="drag_drop_files">拖拽文件到此处</h3> | ||
| <p data-i18n="or_click_browse">或点击浏览文件</p> | ||
| <p style="font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 12px;" data-i18n="supported_formats"> | ||
| 当前支持格式:.json | ||
| <h3 id="uploadDragTitle">Drag & Drop Files Here</h3> | ||
| <p id="uploadDragDesc">or click to browse files</p> | ||
| <p id="uploadSupports" style="font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 12px;"> | ||
| Currently supports: .json | ||
| </p> | ||
| <div style="margin-top: 20px; padding: 15px; background: rgba(255,255,255,0.1); border-radius: 10px; text-align: left; font-size: 11px; color: rgba(255,255,255,0.8);"> | ||
| <div style="font-weight: 600; margin-bottom: 8px;" data-i18n="sample_format">📄 示例格式 (.json):</div> | ||
| <pre style="margin: 0; font-family: 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; background: rgba(0,0,0,0.3); padding: 8px; border-radius: 5px; overflow-x: auto;" id="sample-format-content"> | ||
| <div id="uploadSampleHeader" style="font-weight: 600; margin-bottom: 8px;">📄 Sample Format (.json):</div> |
There was a problem hiding this comment.
Inconsistent indentation pattern with excessive whitespace. Lines 1089-1092 have irregular indentation that doesn't follow the established pattern in the file.
| <div style="margin-top: 20px; padding: 15px; background: rgba(255,255,255,0.1); border-radius: 10px; text-align: left; font-size: 11px; color: rgba(255,255,255,0.8);"> | ||
| <div style="font-weight: 600; margin-bottom: 8px;" data-i18n="sample_format">📄 示例格式 (.json):</div> | ||
| <pre style="margin: 0; font-family: 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; background: rgba(0,0,0,0.3); padding: 8px; border-radius: 5px; overflow-x: auto;" id="sample-format-content"> | ||
| <div id="uploadSampleHeader" style="font-weight: 600; margin-bottom: 8px;">📄 Sample Format (.json):</div> |
There was a problem hiding this comment.
Excessive indentation that's inconsistent with the surrounding code structure. This should be aligned with the proper indentation level.
| <div id="uploadSampleHeader" style="font-weight: 600; margin-bottom: 8px;">📄 Sample Format (.json):</div> | |
| <div id="uploadSampleHeader" style="font-weight: 600; margin-bottom: 8px;">📄 Sample Format (.json):</div> |
| <button class="btn" id="uploadBtn" disabled onclick="uploadFiles()">Upload Files</button> | ||
| <button class="btn btn-secondary" id="clearUploadBtn" onclick="clearFiles()">Clear</button> |
There was a problem hiding this comment.
Inconsistent indentation with excessive whitespace that doesn't match the established indentation pattern in the file.
backend.py
Outdated
| await send_progress_update(client_id, "construction", 2, "Cleaning old cache files...") | ||
|
|
||
|
|
||
| await send_progress_update(client_id, "construction", 2, "清理旧缓存文件...") |
There was a problem hiding this comment.
Hard-coded Chinese text in progress messages should use the same i18n approach as the frontend to maintain consistency and support multiple languages.
backend.py
Outdated
| await send_progress_update(client_id, "construction", 5, "Initializing graph builder...") | ||
|
|
||
| await send_progress_update(client_id, "construction", 5, "初始化图构建器...") |
There was a problem hiding this comment.
Hard-coded Chinese text in progress messages should use the same i18n approach as the frontend to maintain consistency and support multiple languages.
backend.py
Outdated
| await send_progress_update(client_id, "construction", 10, "Loading configuration and corpus...") | ||
|
|
||
| await send_progress_update(client_id, "construction", 10, "加载配置和语料库...") |
There was a problem hiding this comment.
Hard-coded Chinese text in progress messages should use the same i18n approach as the frontend to maintain consistency and support multiple languages.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 17 out of 29 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| <div id="upload" class="tab-content"> | ||
| <div class="card"> | ||
| <h2 data-i18n="upload_documents_title">上传文档</h2> | ||
| <h2 id="uploadDocumentsTitle">Upload Documents</h2> |
There was a problem hiding this comment.
Excessive indentation found. The line has too many leading spaces compared to surrounding code.
| <h3 id="uploadDragTitle">Drag & Drop Files Here</h3> | ||
| <p id="uploadDragDesc">or click to browse files</p> | ||
| <p id="uploadSupports" style="font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 12px;"> | ||
| Currently supports: .json |
There was a problem hiding this comment.
Inconsistent indentation levels. These lines have excessive leading spaces and should be aligned consistently with surrounding HTML elements.
| <div style="margin-top: 20px; padding: 15px; background: rgba(255,255,255,0.1); border-radius: 10px; text-align: left; font-size: 11px; color: rgba(255,255,255,0.8);"> | ||
| <div style="font-weight: 600; margin-bottom: 8px;" data-i18n="sample_format">📄 示例格式 (.json):</div> | ||
| <pre style="margin: 0; font-family: 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; background: rgba(0,0,0,0.3); padding: 8px; border-radius: 5px; overflow-x: auto;" id="sample-format-content"> | ||
| <div id="uploadSampleHeader" style="font-weight: 600; margin-bottom: 8px;">📄 Sample Format (.json):</div> |
There was a problem hiding this comment.
Excessive indentation found. This line has significantly more leading spaces than necessary.
| import os | ||
| import re | ||
| import sys | ||
| import json |
There was a problem hiding this comment.
Removed import statement for 're' module but regular expressions are still used later in the code (lines 774, _re.search). This will cause a runtime error.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 17 out of 29 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
frontend/index.html:1
- [nitpick] Missing spaces after commas in the file extension list for better readability.
<!DOCTYPE html>
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| from utils.logger import logger | ||
| import ast | ||
| import main as graphrag_main | ||
|
|
There was a problem hiding this comment.
The line import main as graphrag_main was removed but the import statement appears to be incomplete or missing context. Ensure all necessary imports are properly maintained.
| import main as graphrag_main |
No description provided.