fix login issues

This commit is contained in:
2026-09-05 17:19:45 +08:00
parent d778ab12da
commit 8cacc20121
3 changed files with 51 additions and 9 deletions
+18 -4
View File
@@ -1,16 +1,30 @@
FROM node:20-slim
ENV TZ=Asia/Shanghai
# MPLBACKEND=Agg:让 matplotlib 使用非交互式后端,避免缺少显示设备报错。
# PYTHONUNBUFFERED=1:实时输出日志。
# TZ=Asia/Shanghai:统一时区。
ENV MPLBACKEND=Agg \
PYTHONUNBUFFERED=1 \
TZ=Asia/Shanghai
# 常用命令行工具:Agent 的 terminal 工具经常用到
RUN apt-get update -y && apt-get install -y --no-install-recommends \
ca-certificates curl git python3 python3-pip python3-venv python3-dev \
build-essential ripgrep procps unzip wget jq zip tree file \
ripgrep wget jq 7z unzip unar file \
libreoffice-writer libreoffice-calc libreoffice-impress \
fonts-noto-cjk fonts-dejavu fonts-stix \
poppler-utils qpdf ghostscript imagemagick \
tesseract-ocr tesseract-ocr-chi-sim \
ffmpeg sqlite3 libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir --break-system-packages \
requests beautifulsoup4 lxml pandas numpy openpyxl \
python-docx reportlab matplotlib Pillow pypdf python-dateutil
requests beautifulsoup4 lxml \
numpy matplotlib \
openpyxl python-docx python-pptx xlrd \
pymupdf pdfplumber pypdf reportlab \
Pillow python-dateutil python-magic \
loguru rich
WORKDIR /app
+19 -2
View File
@@ -3363,8 +3363,25 @@
bindChatScroll(); // 聊天区滚动跟随/右下角回底按钮(只绑一次)
selectMode('secretary'); // 默认选中【文秘助理】
setView('welcome');
loadSessionList();
loadDrawerUser(); // 侧边栏底部展示真实登录用户(未启用认证时静默回退默认占位)
// 页面加载时校验 cookie 身份:防止 localStorage 旧 token 通过 autoRestore 恢复错误用户
// 仅用 cookie 认证(不带 Basic auth),检测服务端实际认定的用户身份
(async () => {
try {
const res = await fetch('/api/me', { credentials: 'include', headers: { Authorization: '' } });
if (res.ok) {
const j = await res.json();
if (!j.user) {
// cookie 无效或用户已从配置中移除 → 彻底清理所有前端凭据并跳登录
localStorage.removeItem('agent_token');
sessionStorage.removeItem('agent_creds');
location.href = '/logout';
return;
}
}
} catch (_) { /* 网络错误放过,让后续请求正常走 */ }
loadSessionList();
loadDrawerUser(); // 侧边栏底部展示真实登录用户(未启用认证时静默回退默认占位)
})();
</script>
</body>
</html>
+14 -3
View File
@@ -9,7 +9,10 @@ You are a file / data / information processing assistant. The environment expose
**In scope**
- Understand images the user gives you: describe their content, OCR / extract text, read charts and screenshots.
- Deterministic image operations you can script yourself with Pillow: format conversion, resize / crop, compression, watermark / annotation, slicing / stitching, contact sheets.
- Charts and diagrams from data (matplotlib), documents (PDF / Markdown / Word / Excel), data processing, running scripts and commands, fetching and summarizing web information.
- Charts and diagrams from data (matplotlib), documents (PDF / Markdown / Word / Excel / PowerPoint), data processing, running scripts and commands, fetching and summarizing web information.
- Document conversion and processing: Word/Excel/PowerPoint to PDF via LibreOffice headless; PDF manipulation with poppler-utils, qpdf, ghostscript, pymupdf, pdfplumber; OCR with tesseract (including Chinese).
- Audio/video processing with ffmpeg (transcoding, extraction, basic editing).
- Database operations with SQLite (via `sqlite3` CLI or Python's `sqlite3` module).
- Generative media (text-to-image, text-to-video, image-to-video, etc.) when an MCP tool that supports it is available in the current session. Read the tool's own description for exact capabilities, parameters, size / format / duration limits, and how to pass reference images.
**Out of scope**
@@ -79,5 +82,13 @@ Skipping this step may lead to duplicated work and inefficient solutions.
- Runs in a Docker container. File access is limited to the working directory and temp directories.
- Python: use `python3`. To install Python packages: `pip3 install --break-system-packages <pkg>`.
- System packages: `apt-get update -y && apt-get install -y <pkg>`.
- Preinstalled system tools: curl, git, python3, pip3, ripgrep, procps, unzip, wget, jq, zip, tree, file, build-essential.
- Preinstalled Python packages: requests, beautifulsoup4, lxml, pandas, numpy, openpyxl, python-docx, reportlab, matplotlib, Pillow, pypdf, python-dateutil.
**Preinstalled system tools:**
`ca-certificates, curl, git, python3, pip3, ripgrep, procps, unzip, wget, jq, zip, tree, file, build-essential, 7z, unar, poppler-utils (pdftotext, pdfimages, etc.), qpdf, ghostscript, imagemagick, tesseract-ocr (with chi-sim), ffmpeg, sqlite3`
**Preinstalled Python packages:**
`requests, beautifulsoup4, lxml, pandas, numpy, openpyxl, python-docx, python-pptx, xlrd, reportlab, matplotlib (use `Agg` backend for headless), Pillow, pypdf, pymupdf, pdfplumber, python-dateutil, python-magic, loguru, rich`
**Document conversion notes:**
- LibreOffice (headless) is available for Word/Excel/PowerPoint → PDF conversion. Example: `libreoffice --headless --convert-to pdf --outdir /output /input.docx`
- For Chinese ZIP files with GBK filenames, prefer `unar` or `7z x` to avoid garbled names; if using Python, use the automatic encoding detection pattern.