Spaces:
Sleeping
Sleeping
Add document summary endpoint and enhance vector database functionality
Browse files- Introduced `get_all_texts` method in `VectorDatabase` to retrieve all stored text documents.
- Added new `DocumentSummaryRequest` and `DocumentSummaryResponse` models for handling document summary requests in the FastAPI application.
- Implemented `/document-summary` endpoint to generate structured summaries from uploaded documents, including key topics, entities, word cloud data, and document structure.
- Enhanced frontend to integrate document summary display and settings management for improved user experience.
- Updated global CSS with styles for word cloud visualization.
- aimakerspace/vectordatabase.py +9 -0
- api/main.py +112 -0
- app/frontend/package.json +1 -0
- app/frontend/src/App.js +34 -1
- app/frontend/src/components/DocumentSummary.js +225 -0
- app/frontend/src/components/ui/dialog.js +94 -0
- app/frontend/src/components/ui/label.js +19 -0
- app/frontend/src/components/ui/settings-dialog.js +65 -0
- app/frontend/src/components/ui/switch.js +22 -0
- app/frontend/src/globals.css +25 -0
aimakerspace/vectordatabase.py
CHANGED
|
@@ -53,6 +53,15 @@ class VectorDatabase:
|
|
| 53 |
self.insert(text, np.array(embedding))
|
| 54 |
return self
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
if __name__ == "__main__":
|
| 58 |
list_of_text = [
|
|
|
|
| 53 |
self.insert(text, np.array(embedding))
|
| 54 |
return self
|
| 55 |
|
| 56 |
+
def get_all_texts(self) -> List[str]:
|
| 57 |
+
"""
|
| 58 |
+
Returns all the text documents stored in the vector database.
|
| 59 |
+
|
| 60 |
+
Returns:
|
| 61 |
+
List[str]: A list of all text documents
|
| 62 |
+
"""
|
| 63 |
+
return list(self.vectors.keys())
|
| 64 |
+
|
| 65 |
|
| 66 |
if __name__ == "__main__":
|
| 67 |
list_of_text = [
|
api/main.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
import tempfile
|
| 3 |
import shutil
|
|
|
|
| 4 |
from typing import List
|
| 5 |
from fastapi import FastAPI, UploadFile, File, Form, HTTPException
|
| 6 |
from fastapi.middleware.cors import CORSMiddleware
|
|
@@ -58,6 +59,15 @@ class QueryResponse(BaseModel):
|
|
| 58 |
response: str
|
| 59 |
session_id: str
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
@app.post("/upload")
|
| 62 |
async def upload_file(file: UploadFile = File(...), session_id: str = Form(...)):
|
| 63 |
if file.content_type not in ["text/plain", "application/pdf"]:
|
|
@@ -172,6 +182,108 @@ async def query(request: QueryRequest):
|
|
| 172 |
|
| 173 |
return {"response": response_text, "session_id": session_id}
|
| 174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
# Serve the frontend
|
| 176 |
@app.get("/")
|
| 177 |
async def read_root():
|
|
|
|
| 1 |
import os
|
| 2 |
import tempfile
|
| 3 |
import shutil
|
| 4 |
+
import json
|
| 5 |
from typing import List
|
| 6 |
from fastapi import FastAPI, UploadFile, File, Form, HTTPException
|
| 7 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 59 |
response: str
|
| 60 |
session_id: str
|
| 61 |
|
| 62 |
+
class DocumentSummaryRequest(BaseModel):
|
| 63 |
+
session_id: str
|
| 64 |
+
|
| 65 |
+
class DocumentSummaryResponse(BaseModel):
|
| 66 |
+
keyTopics: List[str]
|
| 67 |
+
entities: List[str]
|
| 68 |
+
wordCloudData: List[dict]
|
| 69 |
+
documentStructure: List[dict]
|
| 70 |
+
|
| 71 |
@app.post("/upload")
|
| 72 |
async def upload_file(file: UploadFile = File(...), session_id: str = Form(...)):
|
| 73 |
if file.content_type not in ["text/plain", "application/pdf"]:
|
|
|
|
| 182 |
|
| 183 |
return {"response": response_text, "session_id": session_id}
|
| 184 |
|
| 185 |
+
@app.post("/document-summary", response_model=DocumentSummaryResponse)
|
| 186 |
+
async def get_document_summary(request: DocumentSummaryRequest):
|
| 187 |
+
session_id = request.session_id
|
| 188 |
+
|
| 189 |
+
# Check if session exists
|
| 190 |
+
if session_id not in user_sessions:
|
| 191 |
+
raise HTTPException(status_code=404, detail="Session not found. Please upload a document first.")
|
| 192 |
+
|
| 193 |
+
# Get the retrieval pipeline from the session
|
| 194 |
+
retrieval_pipeline = user_sessions[session_id]
|
| 195 |
+
|
| 196 |
+
# Get access to the document content
|
| 197 |
+
vector_db = retrieval_pipeline.vector_db_retriever
|
| 198 |
+
|
| 199 |
+
# We'll use all the text chunks to create a comprehensive summary
|
| 200 |
+
# Get all text chunks from the vector store
|
| 201 |
+
all_texts = vector_db.get_all_texts()
|
| 202 |
+
|
| 203 |
+
# Combine a sample of the texts (to avoid hitting token limits)
|
| 204 |
+
sample_texts = all_texts[:10] if len(all_texts) > 10 else all_texts
|
| 205 |
+
doc_content = "\n".join(sample_texts)
|
| 206 |
+
|
| 207 |
+
# Create the LLM summary prompt
|
| 208 |
+
summary_prompt = f"""
|
| 209 |
+
Analyze the following document content and generate a structured summary in JSON format:
|
| 210 |
+
|
| 211 |
+
```
|
| 212 |
+
{doc_content}
|
| 213 |
+
```
|
| 214 |
+
|
| 215 |
+
Return ONLY a JSON object with the following structure:
|
| 216 |
+
|
| 217 |
+
{{
|
| 218 |
+
"keyTopics": [list of 5-7 key topics in the document],
|
| 219 |
+
"entities": [list of 5-8 important named entities such as organizations, technologies, or people],
|
| 220 |
+
"wordCloudData": [
|
| 221 |
+
{{ "text": "word1", "value": frequency_score }},
|
| 222 |
+
{{ "text": "word2", "value": frequency_score }},
|
| 223 |
+
...
|
| 224 |
+
],
|
| 225 |
+
"documentStructure": [
|
| 226 |
+
{{
|
| 227 |
+
"title": "Section title",
|
| 228 |
+
"subsections": ["Subsection1", "Subsection2", ...]
|
| 229 |
+
}},
|
| 230 |
+
...
|
| 231 |
+
]
|
| 232 |
+
}}
|
| 233 |
+
|
| 234 |
+
The wordCloudData should contain 15-20 important terms with their relative frequency scores (higher numbers = more important/frequent).
|
| 235 |
+
The documentStructure should reflect the hierarchical organization of the document with main sections and their subsections.
|
| 236 |
+
"""
|
| 237 |
+
|
| 238 |
+
# Get LLM response
|
| 239 |
+
try:
|
| 240 |
+
llm = retrieval_pipeline.llm
|
| 241 |
+
response = await llm.acreate_single_response(summary_prompt)
|
| 242 |
+
|
| 243 |
+
# Parse the JSON
|
| 244 |
+
# Find JSON content (sometimes the LLM adds extra text)
|
| 245 |
+
import re
|
| 246 |
+
json_match = re.search(r'({[\s\S]*})', response)
|
| 247 |
+
|
| 248 |
+
if json_match:
|
| 249 |
+
json_str = json_match.group(1)
|
| 250 |
+
summary_data = json.loads(json_str)
|
| 251 |
+
else:
|
| 252 |
+
# If no JSON found, create a basic structure with an error message
|
| 253 |
+
summary_data = {
|
| 254 |
+
"keyTopics": ["Error parsing document structure"],
|
| 255 |
+
"entities": ["Please try again"],
|
| 256 |
+
"wordCloudData": [{"text": "Error", "value": 50}],
|
| 257 |
+
"documentStructure": [{"title": "Document structure unavailable", "subsections": []}]
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
# Ensure the response has all required fields
|
| 261 |
+
if "keyTopics" not in summary_data:
|
| 262 |
+
summary_data["keyTopics"] = ["Topic extraction failed"]
|
| 263 |
+
if "entities" not in summary_data:
|
| 264 |
+
summary_data["entities"] = ["Entity extraction failed"]
|
| 265 |
+
if "wordCloudData" not in summary_data:
|
| 266 |
+
summary_data["wordCloudData"] = [{"text": "Data", "value": 50}]
|
| 267 |
+
if "documentStructure" not in summary_data:
|
| 268 |
+
summary_data["documentStructure"] = [{"title": "Structure unavailable", "subsections": []}]
|
| 269 |
+
|
| 270 |
+
return summary_data
|
| 271 |
+
|
| 272 |
+
except Exception as e:
|
| 273 |
+
# Return a fallback summary on error
|
| 274 |
+
return {
|
| 275 |
+
"keyTopics": ["Error analyzing document"],
|
| 276 |
+
"entities": ["Try refreshing the page"],
|
| 277 |
+
"wordCloudData": [
|
| 278 |
+
{"text": "Error", "value": 60},
|
| 279 |
+
{"text": "Document", "value": 40},
|
| 280 |
+
{"text": "Analysis", "value": 30}
|
| 281 |
+
],
|
| 282 |
+
"documentStructure": [
|
| 283 |
+
{"title": "Error in document analysis", "subsections": ["Please try again"]}
|
| 284 |
+
]
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
# Serve the frontend
|
| 288 |
@app.get("/")
|
| 289 |
async def read_root():
|
app/frontend/package.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
| 8 |
"@radix-ui/react-label": "^2.1.3",
|
| 9 |
"@radix-ui/react-separator": "^1.1.3",
|
| 10 |
"@radix-ui/react-slot": "^1.2.0",
|
|
|
|
| 11 |
"@radix-ui/react-toast": "^1.2.7",
|
| 12 |
"@testing-library/jest-dom": "^5.16.5",
|
| 13 |
"@testing-library/react": "^13.4.0",
|
|
|
|
| 8 |
"@radix-ui/react-label": "^2.1.3",
|
| 9 |
"@radix-ui/react-separator": "^1.1.3",
|
| 10 |
"@radix-ui/react-slot": "^1.2.0",
|
| 11 |
+
"@radix-ui/react-switch": "^1.0.3",
|
| 12 |
"@radix-ui/react-toast": "^1.2.7",
|
| 13 |
"@testing-library/jest-dom": "^5.16.5",
|
| 14 |
"@testing-library/react": "^13.4.0",
|
app/frontend/src/App.js
CHANGED
|
@@ -3,8 +3,10 @@ import { v4 as uuidv4 } from 'uuid';
|
|
| 3 |
import FileUpload from './components/FileUpload';
|
| 4 |
import FileManager from './components/FileManager';
|
| 5 |
import Chat from './components/Chat';
|
|
|
|
| 6 |
import { ThemeProvider } from './components/ui/theme-provider';
|
| 7 |
import { ThemeToggle } from './components/ui/theme-toggle';
|
|
|
|
| 8 |
|
| 9 |
function App() {
|
| 10 |
const [sessionId, setSessionId] = useState('');
|
|
@@ -12,6 +14,13 @@ function App() {
|
|
| 12 |
const [uploadedFiles, setUploadedFiles] = useState([]);
|
| 13 |
const [activeFileIndex, setActiveFileIndex] = useState(0);
|
| 14 |
const [selectedQuestion, setSelectedQuestion] = useState('');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
// Get active file data
|
| 17 |
const activeFile = uploadedFiles[activeFileIndex] || null;
|
|
@@ -23,6 +32,15 @@ function App() {
|
|
| 23 |
}
|
| 24 |
}, [sessionId]);
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
const handleFileUploadSuccess = (fileName, description, questions) => {
|
| 27 |
// Add the new file to the uploaded files array
|
| 28 |
setUploadedFiles(prev => [
|
|
@@ -65,7 +83,15 @@ function App() {
|
|
| 65 |
<span role="img" aria-label="brain" className="text-2xl">🧠</span>
|
| 66 |
<h1 className="text-2xl font-bold">RAG Chat</h1>
|
| 67 |
</div>
|
| 68 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
</div>
|
| 70 |
</header>
|
| 71 |
|
|
@@ -97,6 +123,13 @@ function App() {
|
|
| 97 |
<p className="text-sm text-muted-foreground line-clamp-3">{activeFile.description}</p>
|
| 98 |
</div>
|
| 99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
<div className="min-h-[100px] mb-4">
|
| 101 |
{activeFile.suggestedQuestions && activeFile.suggestedQuestions.length > 0 && (
|
| 102 |
<div className="space-y-2 bg-card p-4 rounded-md border border-border transition-colors duration-300 h-full">
|
|
|
|
| 3 |
import FileUpload from './components/FileUpload';
|
| 4 |
import FileManager from './components/FileManager';
|
| 5 |
import Chat from './components/Chat';
|
| 6 |
+
import DocumentSummary from './components/DocumentSummary';
|
| 7 |
import { ThemeProvider } from './components/ui/theme-provider';
|
| 8 |
import { ThemeToggle } from './components/ui/theme-toggle';
|
| 9 |
+
import { SettingsDialog } from './components/ui/settings-dialog';
|
| 10 |
|
| 11 |
function App() {
|
| 12 |
const [sessionId, setSessionId] = useState('');
|
|
|
|
| 14 |
const [uploadedFiles, setUploadedFiles] = useState([]);
|
| 15 |
const [activeFileIndex, setActiveFileIndex] = useState(0);
|
| 16 |
const [selectedQuestion, setSelectedQuestion] = useState('');
|
| 17 |
+
|
| 18 |
+
// App settings with localStorage persistence
|
| 19 |
+
const [settings, setSettings] = useState(() => {
|
| 20 |
+
// Initialize from localStorage, default to true if not set
|
| 21 |
+
const saved = localStorage.getItem('appSettings');
|
| 22 |
+
return saved ? JSON.parse(saved) : { showDashboard: true };
|
| 23 |
+
});
|
| 24 |
|
| 25 |
// Get active file data
|
| 26 |
const activeFile = uploadedFiles[activeFileIndex] || null;
|
|
|
|
| 32 |
}
|
| 33 |
}, [sessionId]);
|
| 34 |
|
| 35 |
+
// Save settings to localStorage when they change
|
| 36 |
+
useEffect(() => {
|
| 37 |
+
localStorage.setItem('appSettings', JSON.stringify(settings));
|
| 38 |
+
}, [settings]);
|
| 39 |
+
|
| 40 |
+
const handleSettingsChange = (newSettings) => {
|
| 41 |
+
setSettings(newSettings);
|
| 42 |
+
};
|
| 43 |
+
|
| 44 |
const handleFileUploadSuccess = (fileName, description, questions) => {
|
| 45 |
// Add the new file to the uploaded files array
|
| 46 |
setUploadedFiles(prev => [
|
|
|
|
| 83 |
<span role="img" aria-label="brain" className="text-2xl">🧠</span>
|
| 84 |
<h1 className="text-2xl font-bold">RAG Chat</h1>
|
| 85 |
</div>
|
| 86 |
+
<div className="flex items-center gap-4">
|
| 87 |
+
{!showUploadForm && uploadedFiles.length > 0 && (
|
| 88 |
+
<SettingsDialog
|
| 89 |
+
settings={settings}
|
| 90 |
+
onSettingsChange={handleSettingsChange}
|
| 91 |
+
/>
|
| 92 |
+
)}
|
| 93 |
+
<ThemeToggle />
|
| 94 |
+
</div>
|
| 95 |
</div>
|
| 96 |
</header>
|
| 97 |
|
|
|
|
| 123 |
<p className="text-sm text-muted-foreground line-clamp-3">{activeFile.description}</p>
|
| 124 |
</div>
|
| 125 |
|
| 126 |
+
{settings.showDashboard &&
|
| 127 |
+
<DocumentSummary
|
| 128 |
+
fileName={activeFile.name}
|
| 129 |
+
sessionId={activeFile.sessionId}
|
| 130 |
+
/>
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
<div className="min-h-[100px] mb-4">
|
| 134 |
{activeFile.suggestedQuestions && activeFile.suggestedQuestions.length > 0 && (
|
| 135 |
<div className="space-y-2 bg-card p-4 rounded-md border border-border transition-colors duration-300 h-full">
|
app/frontend/src/components/DocumentSummary.js
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState, useEffect } from 'react';
|
| 2 |
+
import { Button } from './ui/button';
|
| 3 |
+
import axios from 'axios';
|
| 4 |
+
|
| 5 |
+
// Fallback data in case of API failure
|
| 6 |
+
const fallbackData = {
|
| 7 |
+
keyTopics: ['Document analysis unavailable'],
|
| 8 |
+
entities: ['Try refreshing the page'],
|
| 9 |
+
wordCloudData: [
|
| 10 |
+
{ text: 'Document', value: 50 },
|
| 11 |
+
{ text: 'Summary', value: 40 },
|
| 12 |
+
{ text: 'Unavailable', value: 30 },
|
| 13 |
+
],
|
| 14 |
+
documentStructure: [
|
| 15 |
+
{ title: 'Document structure unavailable', subsections: ['Please refresh the page or try a different document'] }
|
| 16 |
+
]
|
| 17 |
+
};
|
| 18 |
+
|
| 19 |
+
const DocumentSummary = ({ fileName, sessionId }) => {
|
| 20 |
+
const [activeTab, setActiveTab] = useState('overview');
|
| 21 |
+
const [summaryData, setSummaryData] = useState(null);
|
| 22 |
+
const [loading, setLoading] = useState(true);
|
| 23 |
+
const [error, setError] = useState(null);
|
| 24 |
+
|
| 25 |
+
useEffect(() => {
|
| 26 |
+
const fetchDocumentSummary = async () => {
|
| 27 |
+
if (!sessionId) return;
|
| 28 |
+
|
| 29 |
+
setLoading(true);
|
| 30 |
+
setError(null);
|
| 31 |
+
|
| 32 |
+
try {
|
| 33 |
+
const response = await axios.post('/document-summary', {
|
| 34 |
+
session_id: sessionId
|
| 35 |
+
});
|
| 36 |
+
|
| 37 |
+
setSummaryData(response.data);
|
| 38 |
+
} catch (err) {
|
| 39 |
+
console.error('Error fetching document summary:', err);
|
| 40 |
+
setError('Failed to load document summary. Please try again.');
|
| 41 |
+
setSummaryData(fallbackData);
|
| 42 |
+
} finally {
|
| 43 |
+
setLoading(false);
|
| 44 |
+
}
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
fetchDocumentSummary();
|
| 48 |
+
}, [sessionId, fileName]);
|
| 49 |
+
|
| 50 |
+
if (loading) {
|
| 51 |
+
return (
|
| 52 |
+
<div className="bg-card border border-border rounded-lg p-4 mb-6 transition-colors duration-300">
|
| 53 |
+
<h2 className="text-lg font-semibold mb-4 flex items-center gap-2">
|
| 54 |
+
<span role="img" aria-label="chart" className="text-xl">📊</span>
|
| 55 |
+
Document Summary Dashboard
|
| 56 |
+
</h2>
|
| 57 |
+
<div className="py-8 text-center">
|
| 58 |
+
<div className="animate-pulse flex flex-col items-center">
|
| 59 |
+
<div className="h-4 bg-muted-foreground/20 rounded w-1/4 mb-4"></div>
|
| 60 |
+
<div className="h-2 bg-muted-foreground/20 rounded w-1/2 mb-2"></div>
|
| 61 |
+
<div className="h-2 bg-muted-foreground/20 rounded w-1/3 mb-2"></div>
|
| 62 |
+
<div className="h-2 bg-muted-foreground/20 rounded w-2/5 mb-2"></div>
|
| 63 |
+
<div className="mt-4 text-sm text-muted-foreground">Generating document insights...</div>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
if (error && !summaryData) {
|
| 71 |
+
return (
|
| 72 |
+
<div className="bg-card border border-border rounded-lg p-4 mb-6 transition-colors duration-300">
|
| 73 |
+
<h2 className="text-lg font-semibold mb-4 flex items-center gap-2">
|
| 74 |
+
<span role="img" aria-label="chart" className="text-xl">📊</span>
|
| 75 |
+
Document Summary Dashboard
|
| 76 |
+
</h2>
|
| 77 |
+
<div className="py-4 text-center text-destructive">
|
| 78 |
+
<span role="img" aria-label="error" className="text-2xl block mb-2">⚠️</span>
|
| 79 |
+
{error}
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
);
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
if (!summaryData) {
|
| 86 |
+
return (
|
| 87 |
+
<div className="bg-card border border-border rounded-lg p-4 mb-6 transition-colors duration-300">
|
| 88 |
+
<h2 className="text-lg font-semibold mb-4 flex items-center gap-2">
|
| 89 |
+
<span role="img" aria-label="chart" className="text-xl">📊</span>
|
| 90 |
+
Document Summary Dashboard
|
| 91 |
+
</h2>
|
| 92 |
+
<div className="py-4 text-center">No document summary available</div>
|
| 93 |
+
</div>
|
| 94 |
+
);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
return (
|
| 98 |
+
<div className="bg-card border border-border rounded-lg p-4 mb-6 transition-colors duration-300">
|
| 99 |
+
<h2 className="text-lg font-semibold mb-4 flex items-center gap-2">
|
| 100 |
+
<span role="img" aria-label="chart" className="text-xl">📊</span>
|
| 101 |
+
Document Summary Dashboard
|
| 102 |
+
</h2>
|
| 103 |
+
|
| 104 |
+
<div className="mb-4 border-b border-border">
|
| 105 |
+
<div className="flex space-x-2">
|
| 106 |
+
<Button
|
| 107 |
+
variant={activeTab === 'overview' ? "default" : "ghost"}
|
| 108 |
+
size="sm"
|
| 109 |
+
onClick={() => setActiveTab('overview')}
|
| 110 |
+
className="rounded-b-none"
|
| 111 |
+
>
|
| 112 |
+
Overview
|
| 113 |
+
</Button>
|
| 114 |
+
<Button
|
| 115 |
+
variant={activeTab === 'wordcloud' ? "default" : "ghost"}
|
| 116 |
+
size="sm"
|
| 117 |
+
onClick={() => setActiveTab('wordcloud')}
|
| 118 |
+
className="rounded-b-none"
|
| 119 |
+
>
|
| 120 |
+
Word Cloud
|
| 121 |
+
</Button>
|
| 122 |
+
<Button
|
| 123 |
+
variant={activeTab === 'structure' ? "default" : "ghost"}
|
| 124 |
+
size="sm"
|
| 125 |
+
onClick={() => setActiveTab('structure')}
|
| 126 |
+
className="rounded-b-none"
|
| 127 |
+
>
|
| 128 |
+
Document Structure
|
| 129 |
+
</Button>
|
| 130 |
+
</div>
|
| 131 |
+
</div>
|
| 132 |
+
|
| 133 |
+
{activeTab === 'overview' && (
|
| 134 |
+
<div className="space-y-4">
|
| 135 |
+
<div>
|
| 136 |
+
<h3 className="text-sm font-medium mb-2">Key Topics</h3>
|
| 137 |
+
<div className="flex flex-wrap gap-2">
|
| 138 |
+
{summaryData.keyTopics.map((topic, idx) => (
|
| 139 |
+
<span
|
| 140 |
+
key={idx}
|
| 141 |
+
className="bg-primary/10 text-primary px-3 py-1 rounded-full text-sm"
|
| 142 |
+
>
|
| 143 |
+
{topic}
|
| 144 |
+
</span>
|
| 145 |
+
))}
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
|
| 149 |
+
<div>
|
| 150 |
+
<h3 className="text-sm font-medium mb-2">Key Entities</h3>
|
| 151 |
+
<div className="flex flex-wrap gap-2">
|
| 152 |
+
{summaryData.entities.map((entity, idx) => (
|
| 153 |
+
<span
|
| 154 |
+
key={idx}
|
| 155 |
+
className="bg-secondary/10 text-secondary-foreground px-3 py-1 rounded-full text-sm"
|
| 156 |
+
>
|
| 157 |
+
{entity}
|
| 158 |
+
</span>
|
| 159 |
+
))}
|
| 160 |
+
</div>
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
)}
|
| 164 |
+
|
| 165 |
+
{activeTab === 'wordcloud' && (
|
| 166 |
+
<div className="py-4">
|
| 167 |
+
<div className="bg-muted rounded-lg p-4 min-h-[200px] flex items-center justify-center">
|
| 168 |
+
<div className="word-cloud-container">
|
| 169 |
+
{summaryData.wordCloudData.map((word, idx) => {
|
| 170 |
+
// Calculate font size based on value (scale from 14 to 36)
|
| 171 |
+
const fontSize = 14 + (word.value - 16) * (22 / 48);
|
| 172 |
+
const opacity = 0.5 + (word.value / 64) * 0.5;
|
| 173 |
+
|
| 174 |
+
return (
|
| 175 |
+
<span
|
| 176 |
+
key={idx}
|
| 177 |
+
className="inline-block px-2 py-1 m-1 cursor-pointer hover:text-primary transition-colors duration-200"
|
| 178 |
+
style={{
|
| 179 |
+
fontSize: `${fontSize}px`,
|
| 180 |
+
opacity,
|
| 181 |
+
transform: `rotate(${Math.random() * 20 - 10}deg)`
|
| 182 |
+
}}
|
| 183 |
+
>
|
| 184 |
+
{word.text}
|
| 185 |
+
</span>
|
| 186 |
+
);
|
| 187 |
+
})}
|
| 188 |
+
</div>
|
| 189 |
+
</div>
|
| 190 |
+
<p className="text-xs text-muted-foreground mt-2 text-center">
|
| 191 |
+
Word size represents frequency in the document. Click on any word to search for it.
|
| 192 |
+
</p>
|
| 193 |
+
</div>
|
| 194 |
+
)}
|
| 195 |
+
|
| 196 |
+
{activeTab === 'structure' && (
|
| 197 |
+
<div className="py-4">
|
| 198 |
+
<div className="bg-muted rounded-lg p-4 min-h-[200px]">
|
| 199 |
+
<ul className="space-y-2">
|
| 200 |
+
{summaryData.documentStructure.map((section, idx) => (
|
| 201 |
+
<li key={idx} className="border-l-2 border-primary pl-3 py-1">
|
| 202 |
+
<div className="font-medium">{section.title}</div>
|
| 203 |
+
{section.subsections.length > 0 && (
|
| 204 |
+
<ul className="ml-4 mt-1 space-y-1">
|
| 205 |
+
{section.subsections.map((subsection, subIdx) => (
|
| 206 |
+
<li key={subIdx} className="border-l-2 border-secondary pl-3 py-1 text-sm">
|
| 207 |
+
{subsection}
|
| 208 |
+
</li>
|
| 209 |
+
))}
|
| 210 |
+
</ul>
|
| 211 |
+
)}
|
| 212 |
+
</li>
|
| 213 |
+
))}
|
| 214 |
+
</ul>
|
| 215 |
+
</div>
|
| 216 |
+
<p className="text-xs text-muted-foreground mt-2 text-center">
|
| 217 |
+
Document structure extracted from headings and content organization.
|
| 218 |
+
</p>
|
| 219 |
+
</div>
|
| 220 |
+
)}
|
| 221 |
+
</div>
|
| 222 |
+
);
|
| 223 |
+
};
|
| 224 |
+
|
| 225 |
+
export default DocumentSummary;
|
app/frontend/src/components/ui/dialog.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
| 3 |
+
import { X } from "lucide-react"
|
| 4 |
+
|
| 5 |
+
import { cn } from "./utils"
|
| 6 |
+
|
| 7 |
+
const Dialog = DialogPrimitive.Root
|
| 8 |
+
|
| 9 |
+
const DialogTrigger = DialogPrimitive.Trigger
|
| 10 |
+
|
| 11 |
+
const DialogPortal = DialogPrimitive.Portal
|
| 12 |
+
|
| 13 |
+
const DialogClose = DialogPrimitive.Close
|
| 14 |
+
|
| 15 |
+
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (
|
| 16 |
+
<DialogPrimitive.Overlay
|
| 17 |
+
ref={ref}
|
| 18 |
+
className={cn(
|
| 19 |
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
| 20 |
+
className
|
| 21 |
+
)}
|
| 22 |
+
{...props} />
|
| 23 |
+
))
|
| 24 |
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
| 25 |
+
|
| 26 |
+
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (
|
| 27 |
+
<DialogPortal>
|
| 28 |
+
<DialogOverlay />
|
| 29 |
+
<DialogPrimitive.Content
|
| 30 |
+
ref={ref}
|
| 31 |
+
className={cn(
|
| 32 |
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
| 33 |
+
className
|
| 34 |
+
)}
|
| 35 |
+
{...props}>
|
| 36 |
+
{children}
|
| 37 |
+
<DialogPrimitive.Close
|
| 38 |
+
className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
| 39 |
+
<X className="h-4 w-4" />
|
| 40 |
+
<span className="sr-only">Close</span>
|
| 41 |
+
</DialogPrimitive.Close>
|
| 42 |
+
</DialogPrimitive.Content>
|
| 43 |
+
</DialogPortal>
|
| 44 |
+
))
|
| 45 |
+
DialogContent.displayName = DialogPrimitive.Content.displayName
|
| 46 |
+
|
| 47 |
+
const DialogHeader = ({
|
| 48 |
+
className,
|
| 49 |
+
...props
|
| 50 |
+
}) => (
|
| 51 |
+
<div
|
| 52 |
+
className={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)}
|
| 53 |
+
{...props} />
|
| 54 |
+
)
|
| 55 |
+
DialogHeader.displayName = "DialogHeader"
|
| 56 |
+
|
| 57 |
+
const DialogFooter = ({
|
| 58 |
+
className,
|
| 59 |
+
...props
|
| 60 |
+
}) => (
|
| 61 |
+
<div
|
| 62 |
+
className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
|
| 63 |
+
{...props} />
|
| 64 |
+
)
|
| 65 |
+
DialogFooter.displayName = "DialogFooter"
|
| 66 |
+
|
| 67 |
+
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (
|
| 68 |
+
<DialogPrimitive.Title
|
| 69 |
+
ref={ref}
|
| 70 |
+
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
| 71 |
+
{...props} />
|
| 72 |
+
))
|
| 73 |
+
DialogTitle.displayName = DialogPrimitive.Title.displayName
|
| 74 |
+
|
| 75 |
+
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (
|
| 76 |
+
<DialogPrimitive.Description
|
| 77 |
+
ref={ref}
|
| 78 |
+
className={cn("text-sm text-muted-foreground", className)}
|
| 79 |
+
{...props} />
|
| 80 |
+
))
|
| 81 |
+
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
| 82 |
+
|
| 83 |
+
export {
|
| 84 |
+
Dialog,
|
| 85 |
+
DialogPortal,
|
| 86 |
+
DialogOverlay,
|
| 87 |
+
DialogClose,
|
| 88 |
+
DialogTrigger,
|
| 89 |
+
DialogContent,
|
| 90 |
+
DialogHeader,
|
| 91 |
+
DialogFooter,
|
| 92 |
+
DialogTitle,
|
| 93 |
+
DialogDescription,
|
| 94 |
+
}
|
app/frontend/src/components/ui/label.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
import * as LabelPrimitive from "@radix-ui/react-label"
|
| 3 |
+
import { cva } from "class-variance-authority"
|
| 4 |
+
|
| 5 |
+
import { cn } from "./utils"
|
| 6 |
+
|
| 7 |
+
const labelVariants = cva(
|
| 8 |
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
const Label = React.forwardRef(({ className, ...props }, ref) => (
|
| 12 |
+
<LabelPrimitive.Root
|
| 13 |
+
ref={ref}
|
| 14 |
+
className={cn(labelVariants(), className)}
|
| 15 |
+
{...props} />
|
| 16 |
+
))
|
| 17 |
+
Label.displayName = LabelPrimitive.Root.displayName
|
| 18 |
+
|
| 19 |
+
export { Label }
|
app/frontend/src/components/ui/settings-dialog.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { Button } from './button';
|
| 3 |
+
import {
|
| 4 |
+
Dialog,
|
| 5 |
+
DialogContent,
|
| 6 |
+
DialogDescription,
|
| 7 |
+
DialogFooter,
|
| 8 |
+
DialogHeader,
|
| 9 |
+
DialogTitle,
|
| 10 |
+
DialogTrigger
|
| 11 |
+
} from './dialog';
|
| 12 |
+
import { Switch } from './switch';
|
| 13 |
+
import { Label } from './label';
|
| 14 |
+
|
| 15 |
+
export function SettingsDialog({ settings, onSettingsChange }) {
|
| 16 |
+
const handleDashboardToggle = (checked) => {
|
| 17 |
+
onSettingsChange({
|
| 18 |
+
...settings,
|
| 19 |
+
showDashboard: checked
|
| 20 |
+
});
|
| 21 |
+
};
|
| 22 |
+
|
| 23 |
+
return (
|
| 24 |
+
<Dialog>
|
| 25 |
+
<DialogTrigger asChild>
|
| 26 |
+
<Button
|
| 27 |
+
variant="ghost"
|
| 28 |
+
size="sm"
|
| 29 |
+
className="flex items-center gap-1"
|
| 30 |
+
>
|
| 31 |
+
<span role="img" aria-label="settings" className="text-lg">⚙️</span>
|
| 32 |
+
<span className="hidden sm:inline">Settings</span>
|
| 33 |
+
</Button>
|
| 34 |
+
</DialogTrigger>
|
| 35 |
+
<DialogContent className="sm:max-w-[425px]">
|
| 36 |
+
<DialogHeader>
|
| 37 |
+
<DialogTitle>Application Settings</DialogTitle>
|
| 38 |
+
<DialogDescription>
|
| 39 |
+
Customize your document analysis experience
|
| 40 |
+
</DialogDescription>
|
| 41 |
+
</DialogHeader>
|
| 42 |
+
<div className="py-4 space-y-4">
|
| 43 |
+
<div className="flex items-center justify-between">
|
| 44 |
+
<div className="space-y-0.5">
|
| 45 |
+
<Label htmlFor="dashboard-toggle">Document Dashboard</Label>
|
| 46 |
+
<p className="text-sm text-muted-foreground">
|
| 47 |
+
Show document summary with topics and structure visualization
|
| 48 |
+
</p>
|
| 49 |
+
</div>
|
| 50 |
+
<Switch
|
| 51 |
+
id="dashboard-toggle"
|
| 52 |
+
checked={settings.showDashboard}
|
| 53 |
+
onCheckedChange={handleDashboardToggle}
|
| 54 |
+
/>
|
| 55 |
+
</div>
|
| 56 |
+
</div>
|
| 57 |
+
<DialogFooter>
|
| 58 |
+
<p className="text-sm text-muted-foreground mr-auto">
|
| 59 |
+
Settings are saved automatically
|
| 60 |
+
</p>
|
| 61 |
+
</DialogFooter>
|
| 62 |
+
</DialogContent>
|
| 63 |
+
</Dialog>
|
| 64 |
+
);
|
| 65 |
+
}
|
app/frontend/src/components/ui/switch.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
import * as SwitchPrimitives from "@radix-ui/react-switch"
|
| 3 |
+
|
| 4 |
+
import { cn } from "./utils"
|
| 5 |
+
|
| 6 |
+
const Switch = React.forwardRef(({ className, ...props }, ref) => (
|
| 7 |
+
<SwitchPrimitives.Root
|
| 8 |
+
className={cn(
|
| 9 |
+
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
| 10 |
+
className
|
| 11 |
+
)}
|
| 12 |
+
{...props}
|
| 13 |
+
ref={ref}>
|
| 14 |
+
<SwitchPrimitives.Thumb
|
| 15 |
+
className={cn(
|
| 16 |
+
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
|
| 17 |
+
)} />
|
| 18 |
+
</SwitchPrimitives.Root>
|
| 19 |
+
))
|
| 20 |
+
Switch.displayName = SwitchPrimitives.Root.displayName
|
| 21 |
+
|
| 22 |
+
export { Switch }
|
app/frontend/src/globals.css
CHANGED
|
@@ -219,4 +219,29 @@
|
|
| 219 |
button, a {
|
| 220 |
backface-visibility: hidden;
|
| 221 |
transform: translateZ(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
}
|
|
|
|
| 219 |
button, a {
|
| 220 |
backface-visibility: hidden;
|
| 221 |
transform: translateZ(0);
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
/* Word Cloud Styles */
|
| 225 |
+
.word-cloud-container {
|
| 226 |
+
display: flex;
|
| 227 |
+
flex-wrap: wrap;
|
| 228 |
+
justify-content: center;
|
| 229 |
+
align-items: center;
|
| 230 |
+
width: 100%;
|
| 231 |
+
height: 100%;
|
| 232 |
+
text-align: center;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
.word-cloud-container span {
|
| 236 |
+
display: inline-block;
|
| 237 |
+
padding: 4px 8px;
|
| 238 |
+
margin: 4px;
|
| 239 |
+
border-radius: 4px;
|
| 240 |
+
transition: all 0.2s ease;
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
.word-cloud-container span:hover {
|
| 244 |
+
color: hsl(var(--primary));
|
| 245 |
+
transform: scale(1.1);
|
| 246 |
+
z-index: 1;
|
| 247 |
}
|