원클릭으로
drsai-dev-skill
当用户需要启动、停止、重启、验证 DrSai 前端或后端开发服务,或排查登录/访问/CORS 等开发环境问题时立即使用。适用场景包括:初次部署、环境更换、服务异常排查、服务状态查询、本地登录排错等。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
当用户需要启动、停止、重启、验证 DrSai 前端或后端开发服务,或排查登录/访问/CORS 等开发环境问题时立即使用。适用场景包括:初次部署、环境更换、服务异常排查、服务状态查询、本地登录排错等。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Expert in building cross-platform desktop applications using web technologies (HTML/CSS/JS) with the Electron framework.
TypeScript and JavaScript expert with deep knowledge of type-level programming, performance optimization, monorepo management, migration strategies, and modern tooling.
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
Refine academic writing for computer science research papers targeting top-tier venues (NeurIPS, ICLR, ICML, AAAI, IJCAI, ACL, EMNLP, NAACL, CVPR, WWW, KDD, SIGIR, CIKM, and similar). Use this skill whenever a user asks to improve, polish, refine, edit, or proofread academic or research writing — including paper drafts, abstracts, introductions, related work sections, methodology descriptions, experiment write-ups, or conclusion sections. Also trigger when users paste LaTeX content and ask for writing help, mention "camera-ready", "rebuttal", "paper revision", or reference any academic venue or conference. This skill handles both full paper refinement and section-by-section editing.
The Baidu Baike Component is a knowledge service tool designed to query authoritative encyclopedia explanations for various nouns. Its core function is given a specific "noun" (object, person, location, concept, event, etc.) provided by the user, it returns a standardized, detailed entry explanation sourced from Baidu Baike.
Baidu Scholar Search - Search Chinese and English academic literature (journals, conferences, papers, etc.)
| name | drsai-dev-skill |
| description | 当用户需要启动、停止、重启、验证 DrSai 前端或后端开发服务,或排查登录/访问/CORS 等开发环境问题时立即使用。适用场景包括:初次部署、环境更换、服务异常排查、服务状态查询、本地登录排错等。 |
| allowed-tools | Bash(pm2:*) Bash(curl:*) Bash(yarn:*) Bash(node:*) Bash(drsai-ui:*) Bash(drsai:*) Bash(kill:*) Bash(lsof:*) Bash(ss:*) Bash(ip:*) Bash(bash:*) Bash(./drsai-dev.sh:*) |
drsai-dev.sh项目根目录提供统一管理脚本 drsai-dev.sh,优先用它管理开发环境,它封装了正确的
host/port、幂等预检和完整健康验证:
cd /path/to/drsai
./drsai-dev.sh start [backend|frontend|all] # 启动(默认 all)
./drsai-dev.sh stop [backend|frontend|all] # 停止
./drsai-dev.sh restart [backend|frontend|all] # 重启(重新读取端口/.env)
./drsai-dev.sh status # 进程状态 + 端口监听
./drsai-dev.sh verify # 完整健康链路 + 推荐访问地址
./drsai-dev.sh logs [backend|frontend] # 查看日志
drsai-ui ui --host 0.0.0.0 --port 4291 --reload(pm2 进程 drsai-dev-backend)GATSBY_DEV_PORT=4290 yarn develop(pm2 进程 drsai-dev-frontend)DRSAI_BACKEND_PORT、DRSAI_FRONTEND_PORT、DRSAI_CONDA_ENV
run_drsai_ui.sh现已是转发到./drsai-dev.sh start all的薄壳,保留向后兼容。
DEV 模式下前端(4290)与后端(4291)分离,前端如何找到后端:
getServerUrl()(frontend/src/components/utils.ts)在 DEV
下用 window.location.hostname —— 即你浏览器地址栏里的 host —— 拼出后端地址
http://<hostname>:4291/api。所以:
http://localhost:4290 访问 → 后端走 localhost:4291http://10.5.8.104:4290 访问 → 后端走 10.5.8.104:4291frontend/.env.development 里硬编码 GATSBY_API_URL,否则会覆盖上面的自动推导,
导致从其他 IP 访问时后端地址错误(参见 troubleshooting 的 Unexpected end of JSON input)。本项目常运行在 K8s Pod(Multus 多网卡)中:
| 网卡 | 示例 IP | MTU | 用途 |
|---|---|---|---|
eth0 | 10.42.x.x | 1450 | 集群 overlay 内网,非对外 |
net1 | 10.5.x.x | 1500 | 独立网卡,对外访问地址 |
./drsai-dev.sh verify 会自动选 MTU=1500 的独立网卡并打印推荐访问 URL。从浏览器请用这个
独立 IP(如 http://10.5.8.104:4290)访问,前端会自动把 API 指向同一 IP 的 4291。
容器内用
curl http://<eth0_ip>:端口自测能通不代表外部可访问,详见 references/network.md。
DEV 模式(.env 中 SERVICE_MODE="DEV")走本地账号登录,不需要 IHEP 统一认证。
后端启动时自动播种两个默认账号(deps.py::_seed_default_users,账号已存在则跳过):
| 账号 | 密码 | 角色 |
|---|---|---|
admin | admin123456 | 管理员 |
dev | dev123456 | 开发者 |
/login)选 「本地登录」 Tab,填上面任一组即可。.env 用 DRSAI_UI_DEFAULT_ADMIN_USER/PASSWORD、DRSAI_UI_DEFAULT_DEV_USER/PASSWORD
覆盖(config.py 的 Settings,前缀 DRSAI_UI_)。LoginPage.tsx → authAPI.login() → 后端 POST /api/umtlocal/login → 签发 JWT;
之后 RouteGuard 用 GET /api/auth/me 校验 token。drsai-dev.sh 会自动预检,缺失项会明确报错。手动核对见
references/prerequisites.md。要点:
.env:项目根必须有 .env(含密钥,不会自动创建),从 .env.example 复制并填 HEPAI_API_KEYSERVICE_MODE="DEV":启用本地登录与多用户drsai + drsai-ui 命令可用(drsai_ui 包已 editable 安装)frontend/node_modules(脚本会在缺失时 yarn install --legacy-peer-deps).env.development:缺失时脚本自动从 .env.example 复制(不要硬编码 GATSBY_API_URL)最简单:
./drsai-dev.sh verify
它按已验证的链路逐项检查并打印推荐访问地址:
GET /api/version == 200admin → 取得 JWTGET /api/auth/me(Bearer)→ 返回 user_idOrigin: http://<独立IP>:4290)→ allow-origin 匹配逐步手动验证见 references/verification.md。
若不便用脚本,等价手动命令:
# 后端(开发,热加载)
cd /path/to/drsai
source .env
conda activate drsai
drsai-ui ui --host 0.0.0.0 --port 4291 --reload
# 前端(HMR)
cd /path/to/drsai/frontend
yarn install --legacy-peer-deps # 首次
GATSBY_DEV_PORT=4290 yarn develop
| 后端参数 | 默认 | 说明 |
|---|---|---|
--host | 127.0.0.1(CLI 默认) | 开发须显式设 0.0.0.0 才能外部访问 |
--port | 8081(CLI 默认) | 项目约定 4291,须显式指定 |
--reload | 关 | editable 安装下代码变更自动重载 |
⚠️ 后端 host/port 是 CLI 参数,不读环境变量,必须显式
--host 0.0.0.0 --port 4291, 否则会绑到127.0.0.1:8081,前端连不上。这是drsai-dev.sh帮你保证的关键点。
./drsai-dev.sh stop all
# 或按端口强制
kill $(lsof -t -i :4291)
kill $(lsof -t -i :4290)
详见 references/troubleshooting.md,含:
Unexpected end of JSON inputdrsai-ui not found、前端依赖与 nvm 等