Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(ci): plan ui-preview recordings via AtlasCloud glm-5.3

t8y2aa2cac1948a3
diff --git a/.github/ui-preview/README.md b/.github/ui-preview/README.md
index 08cdf6b3af..0db2456ac1 100644
--- a/.github/ui-preview/README.md
+++ b/.github/ui-preview/README.md
@@ -36,8 +36,11 @@ carries the `ui-preview` label), the workflow does this:
Security: the recording job runs the PR's code without asking anyone — its frontend build
scripts, and in the rust lane the PR's backend itself. Any PR's code can therefore read
-`DEEPSEEK_API_KEY` (environment `ui-preview`), so the key there should have a low spending
-limit. That job has no write access, and the job that writes never runs the PR's code.
+the planner's API key (`PLAN_API_KEY`, environment `ui-preview`), so the key there should
+have a low spending limit. That job has no write access, and the job that writes never
+runs the PR's code. The planner talks to any OpenAI-compatible endpoint
+(`PLAN_API_URL`, default AtlasCloud; `PLAN_MODEL`, overridable via the
+`UI_PREVIEW_PLAN_MODEL` repo variable).
Known limits: the recording is of the web build, so desktop-shell behaviour (detached tabs,
OS dialogs) is not covered; in the web lane the backend is the released dbx-web, so a PR
@@ -49,7 +52,7 @@ the starting):
```sh
cd .github/ui-preview && npm install && npx playwright install chromium
-DBX_URL=http://127.0.0.1:4280 DEEPSEEK_API_KEY=… DIFF_FILE=pr.diff PR_TITLE=… \
+DBX_URL=http://127.0.0.1:4280 PLAN_API_KEY=… DIFF_FILE=pr.diff PR_TITLE=… \
OUT_DIR=/tmp/out SRC_DIR=../.. node record.mjs # a plan from DeepSeek
PLAN_FILE=plan.json DBX_URL=… … node record.mjs # or a hand-written plan
```
diff --git a/.github/ui-preview/record.mjs b/.github/ui-preview/record.mjs
index 663d05f229..79e6808f5f 100755
--- a/.github/ui-preview/record.mjs
+++ b/.github/ui-preview/record.mjs
@@ -91,17 +91,22 @@ async function checkLeak(page, where) {
}
}
-async function deepseek(messages) {
+// any OpenAI-compatible endpoint; PLAN_API_URL/PLAN_API_KEY/PLAN_MODEL move
+// it off DeepSeek (AtlasCloud and friends) without touching this file
+const API_URL = env("PLAN_API_URL", "https://api.deepseek.com/v1/chat/completions");
+const API_KEY = env("PLAN_API_KEY") || env("DEEPSEEK_API_KEY");
+
+async function askPlanner(messages) {
// a reply cut short or not JSON is asked for again
let last;
for (let i = 0; i < 3; i++) {
- const res = await fetch("https://api.deepseek.com/v1/chat/completions", {
+ const res = await fetch(API_URL, {
method: "POST",
- headers: { "Content-Type": "application/json", Authorization: `Bearer ${env("DEEPSEEK_API_KEY")}` },
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}` },
body: JSON.stringify({ model: MODEL, messages, response_format: { type: "json_object" }, max_tokens: 16000 }),
signal: AbortSignal.timeout(240e3),
});
- if (!res.ok) throw new Error(`DeepSeek ${res.status}: ${(await res.text()).slice(0, 300)}`);
+ if (!res.ok) throw new Error(`planner API ${res.status}: ${(await res.text()).slice(0, 300)}`);
const j = await res.json();
const text = j.choices?.[0]?.message?.content ?? "";
try { return JSON.parse(text.replace(/^```(?:json)?\s*|\s+```$/g, "")); }
@@ -542,7 +547,7 @@ async function main() {
(code ? `\n\n=== the changed frontend files (the PR's version) ===\n${code}` : "") },
];
let plan;
- try { plan = env("PLAN_FILE") ? JSON.parse(await fs.readFile(env("PLAN_FILE"), "utf8")) : await deepseek(ask); }
+ try { plan = env("PLAN_FILE") ? JSON.parse(await fs.readFile(env("PLAN_FILE"), "utf8")) : await askPlanner(ask); }
catch (e) { plan = null; manifest.errors.push(`plan: ${e.message}`); }
if (!plan || plan.ui_change === false || !plan.scenes?.length) {
manifest.summary = plan?.summary || "";
@@ -602,7 +607,7 @@ async function main() {
repairs++;
// the page as it is now, and what went wrong: the rest of the scene again
try {
- const fix = await deepseek([...ask, { role: "assistant", content: JSON.stringify(plan) },
+ const fix = await askPlanner([...ask, { role: "assistant", content: JSON.stringify(plan) },
{ role: "user", content: `Step ${i + 1} of scene "${scene.title}" failed: ${e.message.split("\n")[0]}\nThe page now:\n${await page.evaluate(outline)}\n\nIf the failed selector came from the diff, remember the changed-file paths above say which dialog, panel or component holds it — a different one may have to be opened (or closed) first, not just a different selector for this page. Reply with JSON {"steps": [...]}: the steps to do instead of that one and the ones after it in this scene.` }]);
if (Array.isArray(fix.steps)) { steps = [...steps.slice(0, i + 1), ...fix.steps.slice(0, 20)]; log("repaired:", JSON.stringify(fix.steps)); }
} catch (e2) { manifest.errors.push(`repair: ${e2.message}`); }
diff --git a/.github/workflows/ui-preview.yml b/.github/workflows/ui-preview.yml
index 6a5d2aeeab..66d782e065 100644
--- a/.github/workflows/ui-preview.yml
+++ b/.github/workflows/ui-preview.yml
@@ -7,7 +7,7 @@ name: UI preview
#
# Pull requests come from forks, so this runs on pull_request_target with
# the scripts from main. The PR's code is only built and run in the record
-# job, which holds the DeepSeek key (environment ui-preview, no approval
+# job, which holds the planner's API key (environment ui-preview, no approval
# asked: any PR's code can read it, so the key there is one with a low
# limit) and nothing that can write to the repo. The publish job, which can
# write, never runs the PR's code.
@@ -149,7 +149,9 @@ jobs:
npx playwright install --with-deps chromium
- name: Record
env:
- DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
+ PLAN_API_URL: https://api.atlascloud.ai/v1/chat/completions
+ PLAN_API_KEY: ${{ secrets.PLAN_API_KEY }}
+ PLAN_MODEL: ${{ vars.UI_PREVIEW_PLAN_MODEL || 'zai-org/glm-5.3' }}
DIFF_FILE: ${{ github.workspace }}/pr-info/pr.diff
PR_BODY_FILE: ${{ github.workspace }}/pr-info/body.txt
DIST_DIR: ${{ github.workspace }}/pr/dist