Skip to content

feat: ship the B/S edition with Docker and manual GitHub releases - #9

Merged
Onweekendd merged 79 commits into
mainfrom
feat/bs-pg-p0
Oct 25, 2026
Merged

Onweekendd merged 79 commits into
mainfrom
feat/bs-pg-p0

Conversation

@Onweekendd

@Onweekendd Onweekendd commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

将大屏编辑器切换为可独立部署的 B/S 版本:Nginx 提供前端并转发 API、AI 和素材请求,API / Mastra AI / 生成 worker 共用 Node 镜像,业务与会话数据使用 PostgreSQL,素材使用对象存储。包含 AI 对话、图片与视频上传和生成工具的配套调整。

GitHub Actions 在 PR 中使用隔离的 PostgreSQL、组件目录种子和 Redis 检查迁移、类型、测试及两个 Linux 镜像的冷构建。server 镜像包含 pnpm、FFmpeg 和 ffprobe,并实际运行检查。main 检查通过后发布带完整提交 SHA 的 server / web 镜像到 GHCR;生产部署通过 Release 的 deploy 选项手动触发,仅允许 main。SSH 部署先备份数据库,再迁移、更新应用并检查健康状态;失败时回退应用镜像,数据库不自动回滚。

移除未接入产品的 JobRunner 学习练习,修复服务目录调整后失效的测试引用,并将旧测试素材中的已下线图表类型更新为当前支持的条形图。

验证:

  • GitHub CI 全部通过:check、images (server)、images (web) 均成功。
  • 本地 Turbo 的 24 项构建、类型检查与测试任务全部通过,包含前端 844 个测试、后端 1174 个测试(含 5 个真实 Redis 队列测试)。
  • 部署脚本的成功、备份失败、迁移失败和健康检查回退四项测试通过。
  • Actionlint、ShellCheck 和修改文件的 ESLint 检查通过。
  • 首次本机构建的 Linux 镜像已在独立服务器实例验证启动、登录、素材访问和 AI 鉴权;数据库备份脚本也已在服务器验证。

数据库迁移需要备份后执行。此 PR 不开启自动生产部署;main 发布镜像,生产仍需手动触发 Release。

Onweekendd and others added 30 commits September 16, 2026 20:24
Drop the legacy message-channel action types (SendUe4Msg, SendAIManMsg,
SwitchTCState), their config panels, composables and type/schema
definitions, along with the unused controlEncodes editor.
…er/row schema

Replace the flat seriesX/seriesY option arrays of swScroll with nested
columns/header/rowStyle/rowIndex/scroll config, simplify the renderer and
editor panels accordingly, and update schema docs, module seed data and
the preview image.
Introduce seriesAlignmentSuperRefine for chart data/option series matching
and a per-component componentSuperRefineMap (starting with swFlopPerformance
toggle/value linkage), applied only on the runtime validation path so
historical data does not break schema consistency tests.
AiModel 增加 "image" 角色(走 images.generations 接口),新建
GeneratedImage 表以 promptHash 做幂等键避免重复生图;前端设置页
同步补上生图角色的配置项。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
支持"先生一张效果图、用户挑定后再落屏"的流程:vision 划区 → 生成
整屏底图与卡片框素材 → 按图表形态选组件并造 mock 数据 → 逐个推进
画布。配套新增 create_image 工具、效果图分析 agent,并接入 sw-agent
与 mastra 入口;同时修复 requirement-to-bi 装配阶段 zIndex 全为 0
导致组件互相遮挡的问题。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
createImageTool 的结果直接在对话里出图(el-image 预览);edit_files
执行期间在画布上对目标组件叠加扫光效果,让用户能看到 agent 正在改
哪个组件,改完自动消失。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
叶子节点没有 children,放在循环末尾判断会先空跑一次 children 遍历;
提前到循环开头判断并 continue,逻辑更清晰也避免无意义遍历。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
按《原子组件迁移方案》:字段名与取值改用 CSS 词汇,复合属性合并为完整 CSS
字符串(textShadow/filter/transform/animation 等);新增矩形 swBox;
echartcommon 增加 echartsOption JSON 主通道,echartFormatter 降级为兜底;
新增 upgradeComponent 纯函数在读取时把旧数据自动升级到 v2,并配套单测。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
按 CSS 语义重写文字组件渲染(渐变文字走 background-clip:text,阴影与
渐变冲突时转 filter:drop-shadow);跑马灯/超链接/普通文字改由字段是否
存在区分,不再依赖 type 枚举;下架不再需要的多层渐变图层面板与
loading 特效面板。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
图片组件按 CSS 语义重写(九宫格用 border-image、filter/transform/
animation 均为完整 CSS 字符串),合并 swimgBorder 能力;新增矩形 swBox
组件用于蒙层/渐变块/发光边框/毛玻璃底板;新增全局预设动画关键帧样式
与 atomicCssComposers 面板双向转换工具;下架不再需要的毛玻璃面板。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
echartcommon 支持 echartsOption JSON 主通道并兼容旧 echartFormatter;
componentEntry 类型与属性面板渲染逻辑适配 swtext/swimg/swBox 新面板
结构;补充 swtext/swimg/swBox/echartcommon 的单元测试。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
pickForAsset/pickForText/pickForChart 改为写入 swtext/swimg v2 与
echartcommon 的 echartsOption 字段;modules 表种子数据同步更新到 v2;
配套更新工作流单测。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Prisma provider 改 postgresql,适配器换 @prisma/adapter-pg;toolNames 还原 String[],
  还原 6 处 mode: insensitive
- 迁移重新基线为 PG 版 0_init(prisma migrate diff 生成)
- Mastra 记忆/线程/追踪换 PostgresStore,组件向量换 PgVector(@mastra/pg 1.25.0,
  与 core 1.66 兼容),schema 由 MASTRA_DATABASE_SCHEMA 指定(默认 mastra)
- 移除 sqlite-url / better-sqlite3 / libsql 依赖
- 新增 docker-compose.dev.yml(pgvector/pg16),更新 .env.example 与 prisma README
- 删除 apps/desktop、release-desktop 工作流、.env.desktop、桌面标题栏与 platform 工具
- 前端去掉 Tauri 下载/预览子窗口分支(downFile 恢复为浏览器原生下载)
- 去掉 @tauri-apps 依赖与 dev:desktop/build:desktop 等脚本、turbo 任务
- 服务端 CORS 去掉 tauri origin,CORS_ORIGIN 支持逗号分隔多源
- 新增 lib/auth:scrypt 口令哈希、HS256 JWT 签发/校验(生产环境强制 JWT_SECRET)
- authMiddleware 改为真实校验(X-Access-Token / Bearer),已鉴权请求跳过重复验签,
  分享预览相关 open 接口允许匿名
- 新增 POST /user/login(防账号枚举、校验禁用/未审核/到期)
- /customApi/* 与 Mastra 内置 /api/* 全部纳入鉴权
- seed-bi-user 写入真实口令哈希,已设置口令的账号不被覆盖
- 补充 password/token/auth 中间件/login 的单元测试
- 新增登录页与 /login 路由;路由守卫:未登录跳登录页并带 redirect,分享预览 /view 匿名可访问
- user store 增加 login/logout;退出整页跳转以重置内存状态
- axios 服务、Mastra 客户端、Hono RPC 客户端、cache worker 统一带 X-Access-Token;
  401 统一清登录态并跳登录页(登录接口自身 401 与公开页除外)
- 新增 utils/session(纯函数,避免与 router 循环依赖;redirect 白名单防开放重定向)并配单测
- 用户头像弹层提供退出登录;README 更新为 B/S + PostgreSQL
- 新增 ROLE=api|ai|worker|all(默认 all,server:dev 行为不变):同一份代码按角色挂载路由/后台任务,
  api 不加载 Mastra,worker 不加载 HTTP 路由(tests/entry/role-isolation 用 esbuild 依赖图校验)
- 三个角色共用同一个 JWT_SECRET 和 PG;新增 /healthz 存活探针
- 新增 src/queue:BullMQ 队列层。生图改为入队、独立 worker 进程执行;任务 id = promptHash,
  重复入队自动合并,失败的旧任务重试时会被清掉;worker 每个任务前 warmModelConfigs 避免读到旧模型配置
- 新增 GET /customApi/jobs/image/:id 查询任务状态;没配 REDIS_URL 时自动 inline 执行
- docker-compose.dev.yml 增加 Redis(宿主机 6380);增加 api:dev/ai:dev/worker:dev 脚本
- 补充 role / queue 配置 / 任务 id / worker / 路由单测,以及连真 Redis 的集成测试(需 TEST_REDIS_URL)
- 根目录 Dockerfile 多目标:server(同一镜像按 ROLE 起 api/ai/worker,也跑 migrate)与 web(nginx 托管前端 + 按路径分流)
  依赖安装与源码分层缓存;server 用 pnpm deploy 只带生产依赖;镜像内预生成 skills/overviews
- docker-compose.yml:web / api / ai / worker / migrate / postgres(pgvector) / redis / minio(+minio-init 建桶并设公开读),
  项目名固定为 screenwright,避免与同机其他项目的命名卷重名;MinIO 镜像固定版本
- docker/nginx.conf:/customApi /api /artifact-apps → ai(SSE 关缓冲、WebSocket 升级),/user /bi-system /online /blobs → api,
  /screenwright/ → MinIO 同域转发,其余 SPA 回落
- docker/migrate.sh:迁移 → 组件库 → 超管 → (配了嵌入模型才)组件向量,全部幂等;docker/server-entrypoint.sh 同步 agent-workspace 模板进持久卷
- 前端:新增 resolveApiBase,VITE_FUNAI_API_URL 配成空串表示同源;apps/app/.env.production;RPC 客户端同步支持
- prisma 移入 dependencies(容器内跑 migrate deploy);README 增加容器部署说明
后端 /customApi/* 加了鉴权后,agent-trace 在 Next 服务端直接调接口没带令牌,会话列表恒为 401。
新增 funai-session:读取 FUNAI_USERNAME/FUNAI_PASSWORD 登录并缓存令牌,并发请求共用一次登录,
遇 401 重新登录重试一次;server-rpc 的 hono 客户端统一走 authedFetch。README 补充配置与端口占用说明。
- 删除什么都不渲染的首页;会话记录页面与数据层移到根路由,侧边栏去掉「首页」项,面包屑映射同步
- 评估结果里「看对话」、评估批次里「回到真实用户会话」等内部链接改指向 /
- next.config 保留 /sessions → / 的临时重定向(带参数),老书签与外部链接仍可用
画布相机(平移 + 缩放)抽到 @funbi/core 的 viewport,buildRender / 编码编辑器 / 面板编辑器
三个渲染器统一挂在 buildInfiniteCanvas 下;去掉 vue3-sketch-ruler 依赖和画布的 box-shadow。
渐变文字靠 background-image + background-clip: text 渲染,color 为渐变时不再写 background;
schema 与组件文档同步说明 background 在渐变时不生效。
尺寸下拉框改为按字符串回传宽高,与 schema 一致;修 info.json 时 ScreenReader 改用待写入的内容校验,
不再先读磁盘上那份坏数据把修复本身拦下。
- 读图:inlineImagesMiddleware 把用户消息里的本系统图片转成二进制交给模型;工具结果里的
  imagesForModel 在 tool 消息之后补一条 user 图片消息(DeepSeek 只认 user 消息里的图),最多注入最近 3 张
- capture_canvas:挂起到前端截取画布(整屏 / 指定组件 / 任意区域),可叠坐标网格、按边框线吸附裁切;
  截图固定 dpr 1、剥掉根节点阴影,图片像素与设计稿坐标严格成比例
- 设计蓝图:save_blueprint / read_blueprint 保存结构树 + 素材清单(design_blueprint 表),
  校验结构并推导素材目标尺寸与叠放顺序;prepare_assets 批量生图 / 从效果图裁切 / 复用,
  单项失败不中断,结果拼成一张总览图给模型;新增「效果图 → 大屏工作流」提示词
- create_component 支持一次批量创建,前端逐项回执,组件由后端校验后落盘
- 生图兼容 gpt-image 等 OpenAI 兼容服务商(image-provider),参考图预处理压到长边 1280
整屏效果图改由主模型看图写设计蓝图后组装,Codia 这条路不再使用:
- 删除 codiaToBIWorkflow、Codia 适配器(image_to_design / 图片转存 / yoga 布局解算)、
  只为它服务的语义区域分析步骤与 semantic-layout-agent,以及对应测试
- 去掉 CODIA_* 环境变量、相关 StepEnum、yoga-layout 依赖和 fetchChatImageBuffer
- 前端建屏工作流名单、交付步映射与各处注释同步更新
@gitguardian

gitguardian Bot commented Oct 25, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 3 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
38942787 Triggered Generic Password a44245a docker-compose.dev.yml View secret
38942788 Triggered Username Password 12eb6cc servers/server/tests/services/user-login.test.ts View secret
38942789 Triggered Generic Password 12eb6cc servers/server/scripts/seed-bi-user.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@Onweekendd
Onweekendd marked this pull request as ready for review October 25, 2026 09:41
@Onweekendd
Onweekendd merged commit d0a1e46 into main Oct 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant