修改前端显示逻辑
This commit is contained in:
113
web/main.py
113
web/main.py
@@ -42,6 +42,8 @@ class SessionData:
|
||||
self.generated_report: Optional[str] = None
|
||||
self.log_file: Optional[str] = None
|
||||
self.analysis_results: List[Dict] = [] # Store analysis results for gallery
|
||||
self.agent: Optional[DataAnalysisAgent] = None # Store the agent instance for follow-up
|
||||
|
||||
|
||||
class SessionManager:
|
||||
def __init__(self):
|
||||
@@ -72,7 +74,7 @@ app.mount("/outputs", StaticFiles(directory="outputs"), name="outputs")
|
||||
|
||||
# --- Helper Functions ---
|
||||
|
||||
def run_analysis_task(session_id: str, files: list, user_requirement: str):
|
||||
def run_analysis_task(session_id: str, files: list, user_requirement: str, is_followup: bool = False):
|
||||
"""
|
||||
Runs the analysis agent in a background thread for a specific session.
|
||||
"""
|
||||
@@ -83,14 +85,13 @@ def run_analysis_task(session_id: str, files: list, user_requirement: str):
|
||||
|
||||
session.is_running = True
|
||||
try:
|
||||
# Create session directory
|
||||
# Create session directory if not exists (for follow-up it should accept existing)
|
||||
base_output_dir = "outputs"
|
||||
# We enforce a specific directory naming convention or let the util handle it
|
||||
# ideally we map session_id to the directory
|
||||
# For now, let's use the standard utility but we might lose the direct mapping if not careful
|
||||
# Let's trust the return value
|
||||
session_output_dir = create_session_output_dir(base_output_dir, user_requirement)
|
||||
session.output_dir = session_output_dir
|
||||
|
||||
if not session.output_dir:
|
||||
session.output_dir = create_session_output_dir(base_output_dir, user_requirement)
|
||||
|
||||
session_output_dir = session.output_dir
|
||||
|
||||
# Initialize Log capturing
|
||||
session.log_file = os.path.join(session_output_dir, "process.log")
|
||||
@@ -125,8 +126,13 @@ def run_analysis_task(session_id: str, files: list, user_requirement: str):
|
||||
# but try to capture to file?
|
||||
# Let's just write to the file.
|
||||
|
||||
with open(session.log_file, "w", encoding="utf-8") as f:
|
||||
f.write(f"--- Session {session_id} Started ---\n")
|
||||
# Let's just write to the file.
|
||||
|
||||
with open(session.log_file, "a" if is_followup else "w", encoding="utf-8") as f:
|
||||
if is_followup:
|
||||
f.write(f"\n--- Follow-up Session {session_id} Continued ---\n")
|
||||
else:
|
||||
f.write(f"--- Session {session_id} Started ---\n")
|
||||
|
||||
# We will create a custom print function that writes to the file
|
||||
# And monkeypatch builtins.print? No, that's too hacky.
|
||||
@@ -153,14 +159,30 @@ def run_analysis_task(session_id: str, files: list, user_requirement: str):
|
||||
sys.stdout = logger # Global hijack!
|
||||
|
||||
try:
|
||||
llm_config = LLMConfig()
|
||||
agent = DataAnalysisAgent(llm_config, force_max_rounds=False, output_dir=base_output_dir)
|
||||
|
||||
result = agent.analyze(
|
||||
user_input=user_requirement,
|
||||
files=files,
|
||||
session_output_dir=session_output_dir
|
||||
)
|
||||
if not is_followup:
|
||||
llm_config = LLMConfig()
|
||||
agent = DataAnalysisAgent(llm_config, force_max_rounds=False, output_dir=base_output_dir)
|
||||
session.agent = agent
|
||||
|
||||
result = agent.analyze(
|
||||
user_input=user_requirement,
|
||||
files=files,
|
||||
session_output_dir=session_output_dir,
|
||||
reset_session=True
|
||||
)
|
||||
else:
|
||||
agent = session.agent
|
||||
if not agent:
|
||||
print("Error: Agent not initialized for follow-up.")
|
||||
return
|
||||
|
||||
result = agent.analyze(
|
||||
user_input=user_requirement,
|
||||
files=None,
|
||||
session_output_dir=session_output_dir,
|
||||
reset_session=False,
|
||||
max_rounds=10
|
||||
)
|
||||
|
||||
session.generated_report = result.get("report_file_path", None)
|
||||
session.analysis_results = result.get("analysis_results", [])
|
||||
@@ -185,6 +207,10 @@ def run_analysis_task(session_id: str, files: list, user_requirement: str):
|
||||
class StartRequest(BaseModel):
|
||||
requirement: str
|
||||
|
||||
class ChatRequest(BaseModel):
|
||||
session_id: str
|
||||
message: str
|
||||
|
||||
# --- API Endpoints ---
|
||||
|
||||
@app.get("/")
|
||||
@@ -214,9 +240,21 @@ async def start_analysis(request: StartRequest, background_tasks: BackgroundTask
|
||||
|
||||
files = [os.path.abspath(f) for f in files] # Only use absolute paths
|
||||
|
||||
background_tasks.add_task(run_analysis_task, session_id, files, request.requirement)
|
||||
background_tasks.add_task(run_analysis_task, session_id, files, request.requirement, is_followup=False)
|
||||
return {"status": "started", "session_id": session_id}
|
||||
|
||||
@app.post("/api/chat")
|
||||
async def chat_analysis(request: ChatRequest, background_tasks: BackgroundTasks):
|
||||
session = session_manager.get_session(request.session_id)
|
||||
if not session:
|
||||
raise HTTPException(status_code=404, detail="Session not found")
|
||||
|
||||
if session.is_running:
|
||||
raise HTTPException(status_code=400, detail="Analysis already in progress")
|
||||
|
||||
background_tasks.add_task(run_analysis_task, request.session_id, [], request.message, is_followup=True)
|
||||
return {"status": "started"}
|
||||
|
||||
@app.get("/api/status")
|
||||
async def get_status(session_id: str = Query(..., description="Session ID")):
|
||||
session = session_manager.get_session(session_id)
|
||||
@@ -235,6 +273,27 @@ async def get_status(session_id: str = Query(..., description="Session ID")):
|
||||
"report_path": session.generated_report
|
||||
}
|
||||
|
||||
@app.get("/api/export")
|
||||
async def export_session(session_id: str = Query(..., description="Session ID")):
|
||||
session = session_manager.get_session(session_id)
|
||||
if not session:
|
||||
raise HTTPException(status_code=404, detail="Session not found")
|
||||
|
||||
if not session.output_dir or not os.path.exists(session.output_dir):
|
||||
raise HTTPException(status_code=404, detail="No data available for export")
|
||||
|
||||
# Create a zip file
|
||||
import shutil
|
||||
|
||||
# We want to zip the contents of session_output_dir
|
||||
# Zip path should be outside to avoid recursive zipping if inside
|
||||
zip_base_name = os.path.join("outputs", f"export_{session_id}")
|
||||
|
||||
# shutil.make_archive expects base_name (without extension) and root_dir
|
||||
archive_path = shutil.make_archive(zip_base_name, 'zip', session.output_dir)
|
||||
|
||||
return FileResponse(archive_path, media_type='application/zip', filename=f"analysis_export_{session_id}.zip")
|
||||
|
||||
@app.get("/api/report")
|
||||
async def get_report(session_id: str = Query(..., description="Session ID")):
|
||||
session = session_manager.get_session(session_id)
|
||||
@@ -250,8 +309,24 @@ async def get_report(session_id: str = Query(..., description="Session ID")):
|
||||
# Fix image paths
|
||||
relative_session_path = os.path.relpath(session.output_dir, os.getcwd())
|
||||
web_base_path = f"/{relative_session_path}"
|
||||
|
||||
# Robust image path replacement
|
||||
# 1. Replace explicit relative paths ./image.png
|
||||
content = content.replace("](./", f"]({web_base_path}/")
|
||||
|
||||
# 2. Replace naked paths that might be generated like ](image.png) but NOT ](http...) or ](/...)
|
||||
import re
|
||||
def replace_link(match):
|
||||
alt = match.group(1)
|
||||
url = match.group(2)
|
||||
if url.startswith("http") or url.startswith("/") or url.startswith("data:"):
|
||||
return match.group(0)
|
||||
# Remove ./ if exists again just in case
|
||||
clean_url = url.lstrip("./")
|
||||
return f""
|
||||
|
||||
content = re.sub(r'!\[(.*?)\]\((.*?)\)', replace_link, content)
|
||||
|
||||
return {"content": content, "base_path": web_base_path}
|
||||
|
||||
@app.get("/api/figures")
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
<!-- Google Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap"
|
||||
rel="stylesheet">
|
||||
<!-- Markdown Parser -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<!-- Font Awesome -->
|
||||
@@ -110,63 +112,74 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VIEW: TOOLS -->
|
||||
<div id="viewTools" class="view-section" style="display: none;">
|
||||
<div class="tools-grid">
|
||||
<!-- Tool Card 1: Merge Excel -->
|
||||
<div class="tool-card">
|
||||
<div class="tool-icon"><i class="fa-solid fa-file-csv"></i></div>
|
||||
<h3>Excel to CSV Merger</h3>
|
||||
<p>Merge multiple .xlsx files from the uploads directory into a single CSV for analysis.</p>
|
||||
<div class="tool-actions">
|
||||
<input type="text" id="mergeSource" value="uploads" placeholder="Source Directory"
|
||||
class="input-sm">
|
||||
<button class="btn secondary" onclick="triggerMerge()">
|
||||
<i class="fa-solid fa-bolt"></i> Merge Now
|
||||
</button>
|
||||
</div>
|
||||
<div id="mergeResult" class="tool-result"></div>
|
||||
</div>
|
||||
|
||||
<!-- Tool Card 2: Sort CSV -->
|
||||
<div class="tool-card">
|
||||
<div class="tool-icon"><i class="fa-solid fa-arrow-down-a-z"></i></div>
|
||||
<h3>Time Sorter</h3>
|
||||
<p>Sort a CSV file by 'SendTime' or time column to fix ordering issues.</p>
|
||||
<div class="tool-actions">
|
||||
<input type="text" id="sortTarget" value="cleaned_data.csv" placeholder="Target Filename"
|
||||
class="input-sm">
|
||||
<button class="btn secondary" onclick="triggerSort()">
|
||||
<i class="fa-solid fa-sort"></i> Sort Now
|
||||
</button>
|
||||
</div>
|
||||
<div id="sortResult" class="tool-result"></div>
|
||||
</div>
|
||||
<!-- Follow-up Chat Section -->
|
||||
<div id="followUpSection" class="chat-input-container" style="display: none;">
|
||||
<div class="input-wrapper">
|
||||
<textarea id="followUpInput"
|
||||
placeholder="Follow-up question... (e.g. 'Analyze the error codes')"></textarea>
|
||||
<button id="sendFollowUpBtn" class="btn primary" onclick="sendFollowUp()">
|
||||
<i class="fa-solid fa-paper-plane"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VIEW: GALLERY -->
|
||||
<div id="viewGallery" class="view-section" style="display: none;">
|
||||
<div id="galleryContainer" class="gallery-grid">
|
||||
<div class="empty-state">
|
||||
<i class="fa-solid fa-images"></i>
|
||||
<p>No images generated yet.<br>Start an analysis to see results here.</p>
|
||||
</div>
|
||||
<!-- VIEW: TOOLS -->
|
||||
<div id="viewTools" class="view-section" style="display: none;">
|
||||
<div class="tools-grid">
|
||||
<!-- Tool Card 1: Merge Excel -->
|
||||
<div class="tool-card">
|
||||
<div class="tool-icon"><i class="fa-solid fa-file-csv"></i></div>
|
||||
<h3>Excel to CSV Merger</h3>
|
||||
<p>Merge multiple .xlsx files from the uploads directory into a single CSV for analysis.</p>
|
||||
<div class="tool-actions">
|
||||
<input type="text" id="mergeSource" value="uploads" placeholder="Source Directory" class="input-sm">
|
||||
<button class="btn secondary" onclick="triggerMerge()">
|
||||
<i class="fa-solid fa-bolt"></i> Merge Now
|
||||
</button>
|
||||
</div>
|
||||
<div id="mergeResult" class="tool-result"></div>
|
||||
</div>
|
||||
|
||||
<!-- VIEW: HELP -->
|
||||
<div id="viewHelp" class="view-section" style="display: none;">
|
||||
<div class="help-header">
|
||||
<h2>Troubleshooting Guide</h2>
|
||||
<button class="btn secondary" onclick="fetchHelp()">Refresh</button>
|
||||
</div>
|
||||
<div id="helpContainer" class="markdown-body help-body">
|
||||
<p>Loading guide...</p>
|
||||
<!-- Tool Card 2: Sort CSV -->
|
||||
<div class="tool-card">
|
||||
<div class="tool-icon"><i class="fa-solid fa-arrow-down-a-z"></i></div>
|
||||
<h3>Time Sorter</h3>
|
||||
<p>Sort a CSV file by 'SendTime' or time column to fix ordering issues.</p>
|
||||
<div class="tool-actions">
|
||||
<input type="text" id="sortTarget" value="cleaned_data.csv" placeholder="Target Filename"
|
||||
class="input-sm">
|
||||
<button class="btn secondary" onclick="triggerSort()">
|
||||
<i class="fa-solid fa-sort"></i> Sort Now
|
||||
</button>
|
||||
</div>
|
||||
<div id="sortResult" class="tool-result"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
<!-- VIEW: GALLERY -->
|
||||
<div id="viewGallery" class="view-section" style="display: none;">
|
||||
<div id="galleryContainer" class="gallery-grid">
|
||||
<div class="empty-state">
|
||||
<i class="fa-solid fa-images"></i>
|
||||
<p>No images generated yet.<br>Start an analysis to see results here.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VIEW: HELP -->
|
||||
<div id="viewHelp" class="view-section" style="display: none;">
|
||||
<div class="help-header">
|
||||
<h2>Troubleshooting Guide</h2>
|
||||
<button class="btn secondary" onclick="fetchHelp()">Refresh</button>
|
||||
</div>
|
||||
<div id="helpContainer" class="markdown-body help-body">
|
||||
<p>Loading guide...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script src="/static/script.js"></script>
|
||||
|
||||
@@ -111,9 +111,11 @@ function setRunningState(running) {
|
||||
if (running) {
|
||||
statusDot.className = 'dot running';
|
||||
statusText.innerText = 'Analysis in Progress';
|
||||
if (document.getElementById('followUpSection')) document.getElementById('followUpSection').style.display = 'none';
|
||||
} else {
|
||||
statusDot.className = 'dot done';
|
||||
statusText.innerText = 'Completed';
|
||||
if (currentSessionId && document.getElementById('followUpSection')) document.getElementById('followUpSection').style.display = 'flex';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,6 +217,7 @@ async function loadGallery() {
|
||||
}
|
||||
}
|
||||
|
||||
// --- Export Report ---
|
||||
// --- Export Report ---
|
||||
window.triggerExport = async function () {
|
||||
if (!currentSessionId) {
|
||||
@@ -228,17 +231,29 @@ window.triggerExport = async function () {
|
||||
btn.disabled = true;
|
||||
|
||||
try {
|
||||
// Trigger download
|
||||
// We can't use fetch for file download easily if we want browser to handle save dialog
|
||||
// So we create a link approach or check status first
|
||||
|
||||
// Check if download is possible
|
||||
const url = `/api/export?session_id=${currentSessionId}`;
|
||||
const res = await fetch(url, { method: 'HEAD' });
|
||||
const res = await fetch(url); // Default GET
|
||||
|
||||
if (res.ok) {
|
||||
window.location.href = url;
|
||||
const blob = await res.blob();
|
||||
const downloadUrl = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = downloadUrl;
|
||||
a.download = `analysis_export_${currentSessionId}.zip`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.URL.revokeObjectURL(downloadUrl);
|
||||
} else {
|
||||
alert("Export failed: No data available.");
|
||||
// Try to parse error
|
||||
let errMsg = "Unknown error";
|
||||
try {
|
||||
const err = await res.json();
|
||||
errMsg = err.detail || errMsg;
|
||||
} catch (jsonErr) {
|
||||
errMsg = res.statusText;
|
||||
}
|
||||
alert("Export failed: " + errMsg);
|
||||
}
|
||||
} catch (e) {
|
||||
alert("Export failed: " + e.message);
|
||||
@@ -248,6 +263,45 @@ window.triggerExport = async function () {
|
||||
}
|
||||
}
|
||||
|
||||
// --- Follow-up Chat ---
|
||||
window.sendFollowUp = async function () {
|
||||
if (!currentSessionId || isRunning) return;
|
||||
|
||||
const input = document.getElementById('followUpInput');
|
||||
const message = input.value.trim();
|
||||
if (!message) return;
|
||||
|
||||
// UI Loading state
|
||||
const btn = document.getElementById('sendFollowUpBtn');
|
||||
btn.disabled = true;
|
||||
input.disabled = true;
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/chat', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ session_id: currentSessionId, message: message })
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
input.value = '';
|
||||
setRunningState(true);
|
||||
startPolling();
|
||||
switchTab('logs');
|
||||
} else {
|
||||
const err = await res.json();
|
||||
alert('Error: ' + err.detail);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert('Failed to send request');
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
input.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --- Tabs (Inner) ---
|
||||
window.switchTab = function (tabName) {
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');
|
||||
|
||||
:root {
|
||||
--bg-color: #0f172a;
|
||||
--sidebar-bg: rgba(30, 41, 59, 0.7);
|
||||
--glass-border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
/* Nebula Theme Palette */
|
||||
--bg-deep: #020617;
|
||||
--bg-secondary: #0f172a;
|
||||
|
||||
--sidebar-bg: rgba(15, 23, 42, 0.6);
|
||||
--card-bg: rgba(30, 41, 59, 0.3);
|
||||
--glass-border: 1px solid rgba(148, 163, 184, 0.08);
|
||||
|
||||
--primary-color: #6366f1;
|
||||
--primary-hover: #4f46e5;
|
||||
--primary-glow: #6366f1aa;
|
||||
--accent-color: #0ea5e9;
|
||||
|
||||
--text-main: #f8fafc;
|
||||
--text-muted: #94a3b8;
|
||||
--card-bg: rgba(30, 41, 59, 0.4);
|
||||
|
||||
--success: #10b981;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
|
||||
--radius-lg: 1rem;
|
||||
--radius-md: 0.75rem;
|
||||
--radius-sm: 0.5rem;
|
||||
}
|
||||
|
||||
* {
|
||||
@@ -19,369 +33,469 @@
|
||||
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
background-color: var(--bg-color);
|
||||
background-color: var(--bg-deep);
|
||||
background-image:
|
||||
radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
|
||||
radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.15) 0px, transparent 50%);
|
||||
radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
|
||||
radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.08) 0%, transparent 50%);
|
||||
color: var(--text-main);
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.app-container {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
height: 96vh;
|
||||
width: 98vw;
|
||||
gap: 1rem;
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Sidebar */
|
||||
/* --- Floating Sidebar --- */
|
||||
.sidebar {
|
||||
width: 320px;
|
||||
width: 280px;
|
||||
background: var(--sidebar-bg);
|
||||
backdrop-filter: blur(12px);
|
||||
border-right: var(--glass-border);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
border: var(--glass-border);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 1.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2rem;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
color: var(--text-main);
|
||||
padding: 0.5rem 0.5rem 1rem 0.5rem;
|
||||
border-bottom: var(--glass-border);
|
||||
}
|
||||
|
||||
.brand i {
|
||||
font-size: 1.5rem;
|
||||
color: var(--primary-color);
|
||||
font-size: 1.75rem;
|
||||
background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
|
||||
}
|
||||
|
||||
.brand h1 {
|
||||
font-size: 1.25rem;
|
||||
font-family: 'Outfit', sans-serif;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
background: linear-gradient(to right, #fff, #94a3b8);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
|
||||
/* Nav Buttons */
|
||||
.nav-btn {
|
||||
width: 100%;
|
||||
padding: 0.875rem 1rem;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
font-family: 'Outfit', sans-serif;
|
||||
font-weight: 500;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-md);
|
||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.nav-btn i {
|
||||
font-size: 1.1rem;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.nav-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
color: var(--text-main);
|
||||
transform: translateX(4px);
|
||||
}
|
||||
|
||||
.nav-btn.active {
|
||||
background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), transparent);
|
||||
color: var(--primary-color);
|
||||
border-left: 3px solid var(--primary-color);
|
||||
border-radius: 4px var(--radius-md) var(--radius-md) 4px;
|
||||
}
|
||||
|
||||
.nav-btn.active i {
|
||||
color: var(--primary-color);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
/* --- Main Content --- */
|
||||
.main-content {
|
||||
flex: 1;
|
||||
background: rgba(15, 23, 42, 0.4);
|
||||
backdrop-filter: blur(12px);
|
||||
border: var(--glass-border);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 2rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
/* Controls */
|
||||
.control-group-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.control-group h3 {
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-muted);
|
||||
font-family: 'Outfit', sans-serif;
|
||||
font-size: 0.75rem;
|
||||
color: #475569;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
letter-spacing: 0.1em;
|
||||
font-weight: 700;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
/* Upload Zone */
|
||||
.upload-zone {
|
||||
border: 2px dashed rgba(255, 255, 255, 0.1);
|
||||
border-radius: 0.75rem;
|
||||
padding: 2rem 1rem;
|
||||
border: 1px dashed rgba(255, 255, 255, 0.1);
|
||||
border-radius: 1rem;
|
||||
padding: 1.5rem;
|
||||
text-align: center;
|
||||
transition: all 0.2s;
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
transition: all 0.3s ease;
|
||||
background: rgba(2, 6, 23, 0.3);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upload-zone::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: radial-gradient(circle at center, rgba(99, 102, 241, 0.1), transparent 70%);
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
.upload-zone:hover::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.upload-zone.dragover {
|
||||
border-color: var(--primary-color);
|
||||
background: rgba(99, 102, 241, 0.1);
|
||||
box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
|
||||
}
|
||||
|
||||
.upload-zone i {
|
||||
font-size: 2rem;
|
||||
color: var(--text-muted);
|
||||
background: linear-gradient(to bottom, #94a3b8, #475569);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.upload-zone p {
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
/* Inputs */
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 120px;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
border: var(--glass-border);
|
||||
border-radius: 0.5rem;
|
||||
padding: 0.75rem;
|
||||
color: var(--text-main);
|
||||
font-family: inherit;
|
||||
resize: none;
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary-color);
|
||||
.file-list {
|
||||
margin-top: 0.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
border-radius: 0.5rem;
|
||||
padding: 0.875rem;
|
||||
border-radius: var(--radius-md);
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-family: 'Outfit', sans-serif;
|
||||
font-weight: 600;
|
||||
transition: all 0.2s;
|
||||
font-size: 0.9rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.btn.primary {
|
||||
background: var(--primary-color);
|
||||
background: linear-gradient(135deg, var(--primary-color), var(--primary-hover, #4f46e5));
|
||||
color: white;
|
||||
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
|
||||
}
|
||||
|
||||
.btn.primary:hover {
|
||||
background: var(--primary-hover);
|
||||
box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.btn.primary::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
||||
transition: 0.5s;
|
||||
}
|
||||
|
||||
.btn.primary:hover::after {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
.btn.secondary {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: var(--text-main);
|
||||
font-size: 0.8rem;
|
||||
padding: 0.5rem;
|
||||
width: auto;
|
||||
margin: 0 auto;
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
.btn.secondary:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
/* Status */
|
||||
.status-indicator {
|
||||
margin-top: auto;
|
||||
/* Inputs */
|
||||
textarea,
|
||||
input[type="text"] {
|
||||
width: 100%;
|
||||
background: rgba(2, 6, 23, 0.3);
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 1rem;
|
||||
color: var(--text-main);
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-size: 0.9rem;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
textarea:focus,
|
||||
input[type="text"]:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
|
||||
}
|
||||
|
||||
/* Tabs */
|
||||
.tabs {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
background: rgba(2, 6, 23, 0.2);
|
||||
padding: 0.3rem;
|
||||
border-radius: var(--radius-lg);
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.tab-btn {
|
||||
padding: 0.6rem 1.25rem;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
font-family: 'Outfit', sans-serif;
|
||||
font-weight: 500;
|
||||
font-size: 0.85rem;
|
||||
border-radius: var(--radius-md);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
padding-top: 1rem;
|
||||
border-top: var(--glass-border);
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--text-muted);
|
||||
.tab-btn:hover {
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.dot.running {
|
||||
background-color: var(--warning);
|
||||
box-shadow: 0 0 8px var(--warning);
|
||||
animation: pulse 1s infinite;
|
||||
.tab-btn.active {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
color: white;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.dot.done {
|
||||
background-color: var(--success);
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
50% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Main Content */
|
||||
.main-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 1.5rem;
|
||||
gap: 1rem;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
/* Crucial for nested flex scroll */
|
||||
}
|
||||
|
||||
/* View Section needs to fill space for analysis view */
|
||||
.view-section {
|
||||
flex: 1;
|
||||
display: none;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.view-section.active {
|
||||
display: flex;
|
||||
/* Changed from block to flex for analysis view layout */
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
flex-shrink: 0;
|
||||
/* Prevent tabs from shrinking */
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
border-bottom: var(--glass-border);
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
/* ... existing tab-btn styles ... */
|
||||
|
||||
.tab-content {
|
||||
display: none;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
/* Crucial for nested flex scroll */
|
||||
animation: fadeIn 0.3s ease;
|
||||
}
|
||||
|
||||
.tab-content.active {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* Logs */
|
||||
/* Terminal / Log Window */
|
||||
.terminal-window {
|
||||
background: #000;
|
||||
border-radius: 0.75rem;
|
||||
padding: 1rem;
|
||||
background: #09090b;
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 1.5rem;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
min-height: 0;
|
||||
/* Crucial for nested flex scroll */
|
||||
border: var(--glass-border);
|
||||
font-family: 'JetBrains Mono', 'Menlo', monospace;
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 0.85rem;
|
||||
color: #4ade80;
|
||||
line-height: 1.5;
|
||||
color: #22c55e;
|
||||
box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
#logOutput {
|
||||
white-space: pre-wrap;
|
||||
.terminal-window::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
/* Report */
|
||||
.terminal-window::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/* Report Container */
|
||||
#reportContainer {
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
color: #1e293b;
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 2.5rem;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
background: white;
|
||||
color: #1e293b;
|
||||
border-radius: 0.75rem;
|
||||
padding: 2rem;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #94a3b8;
|
||||
height: 100%;
|
||||
color: rgba(255, 255, 255, 0.2);
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.empty-state i {
|
||||
font-size: 3rem;
|
||||
opacity: 0.5;
|
||||
font-size: 4rem;
|
||||
}
|
||||
|
||||
/* Markdown Styles Override for Report */
|
||||
.markdown-body img {
|
||||
max-width: 100%;
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.markdown-body h1,
|
||||
.markdown-body h2,
|
||||
.markdown-body h3 {
|
||||
margin-top: 1.5em;
|
||||
margin-bottom: 0.5em;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.markdown-body p {
|
||||
margin-bottom: 1em;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
/* New: Tools Grid */
|
||||
.tools-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 1.5rem;
|
||||
padding: 1rem 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.tool-card {
|
||||
background: var(--card-bg);
|
||||
/* Follow-up Chat */
|
||||
.chat-input-container {
|
||||
margin-top: 1rem;
|
||||
background: rgba(2, 6, 23, 0.4);
|
||||
border: var(--glass-border);
|
||||
border-radius: 1rem;
|
||||
padding: 1.5rem;
|
||||
transition: transform 0.2s;
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.tool-card:hover {
|
||||
transform: translateY(-2px);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.tool-icon {
|
||||
font-size: 2rem;
|
||||
color: var(--primary-color);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.tool-card h3 {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.tool-card p {
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 1.5rem;
|
||||
min-height: 3em;
|
||||
}
|
||||
|
||||
.tool-actions {
|
||||
.input-wrapper {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.input-sm {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border: var(--glass-border);
|
||||
color: white;
|
||||
padding: 0.5rem;
|
||||
border-radius: 0.5rem;
|
||||
flex: 1;
|
||||
#followUpInput {
|
||||
background: transparent;
|
||||
border: none;
|
||||
height: 50px;
|
||||
padding: 0.8rem;
|
||||
resize: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Help Styles */
|
||||
.help-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1.5rem;
|
||||
#sendFollowUpBtn {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: var(--radius-md);
|
||||
padding: 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.help-body {
|
||||
background: white;
|
||||
color: #1e293b;
|
||||
padding: 2rem;
|
||||
border-radius: 0.75rem;
|
||||
/* Gallery Grid */
|
||||
.gallery-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||
gap: 1.5rem;
|
||||
padding-bottom: 2rem;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.gallery-card {
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: var(--glass-border);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.gallery-card:hover {
|
||||
transform: translateY(-4px);
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.img-wrapper {
|
||||
height: 180px;
|
||||
overflow: hidden;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.img-wrapper img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: transform 0.5s;
|
||||
}
|
||||
|
||||
.img-wrapper:hover img {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.card-content h4 {
|
||||
font-family: 'Outfit', sans-serif;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.card-content .desc {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
/* Status Dot */
|
||||
.status-indicator {
|
||||
margin-top: auto;
|
||||
padding-top: 1.5rem;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.05);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.view-section {
|
||||
animation: fadeIn 0.4s ease-out;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
Reference in New Issue
Block a user