Skip to content

Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.

fix(chatbot): size the artifact preview/source switch like its toolbar buttons (#465)

fx-kurumi44a862cd9e83
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f79c170d..31d26437 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ Platform releases use `vX.Y.Z` tags and publish `ghcr.io/tencent/loopforge`. Loo
- Run logs and telemetry redact every environment variable ending in `_API_KEY`, `_TOKEN`, `_SECRET` or `_PASSWORD`. Agent CLI keys such as `DEEPSEEK_API_KEY`, and `AGENTFLOW_CLI_API_KEY` used with a custom Base URL, used to appear in clear text in the `docker exec` line of an SOP run log, readable by project members. Rotate a key that ran an SOP role before this release.
- Upgrading with `./start.sh pull` now re-applies the schema pieces gorm AutoMigrate cannot create: the `run_telemetry.adapter` and `run_logs.level` generated columns from `migrations/001_run_obs_generated_columns.sql`, and the `INSERT IGNORE` starter catalog. A data volume from an older release no longer fails with `Error 1054 Unknown column 'adapter'` the first time someone opens a run detail. The installer and the upgrade command share one script, `scripts/install-schema-extensions.sh`, and a failed step stops the command with the migration file an operator has to run by hand.
- `docs/deployment.md` splits `migrations/` into scripts the installer already covers, scripts an upgrade must run once, and scripts that only backfill existing rows.
+- The 预览/源码 switch in the chat artifact preview now matches the 30px copy and download buttons beside it (36px on narrow screens) instead of using the 48px page-level tab size.
- Repository clone URLs no longer carry credentials. Saving a `cloneUrl` with a user name or password, such as `https://user:[email protected]/acme/app.git`, is rejected with a pointer to the Git token in personal settings; the repositories API, bootstrap payload, run, task and requirement views, and the runner task management list strip credentials from `cloneUrl` and `webUrl` of rows saved earlier; a `webUrl` with credentials is rejected on save; runner clone errors and redacted Git output mask them. `ssh://git@host/...` and `git@host:path` remotes are still accepted.
diff --git a/chatbot/src/artifact-preview.css b/chatbot/src/artifact-preview.css
index a819aa77..8000da24 100644
--- a/chatbot/src/artifact-preview.css
+++ b/chatbot/src/artifact-preview.css
@@ -76,6 +76,31 @@
flex: 0 1 auto;
min-width: 0;
}
+/* The preview/source switch is a secondary control: size it like the 30px
+ * icon actions beside it instead of the 48px page-level segmented tabs. */
+.artifact-preview .artifact-preview-view-options.sliding-tabs[data-sliding-tabs] {
+ display: inline-flex !important;
+ height: 30px !important;
+ min-height: 30px !important;
+ padding: 2px !important;
+ border-radius: 8px !important;
+}
+.artifact-preview
+ .artifact-preview-view-options.sliding-tabs[data-sliding-tabs]
+ > [data-sliding-indicator] {
+ border-radius: 6px;
+}
+.artifact-preview
+ .artifact-preview-view-options.sliding-tabs[data-sliding-tabs]
+ > [data-sliding-tab] {
+ flex: 0 0 auto;
+ height: 26px !important;
+ min-height: 26px !important;
+ padding: 0 10px !important;
+ border-radius: 6px !important;
+ font-size: 12px !important;
+ line-height: 26px !important;
+}
.artifact-preview .artifact-preview-actions {
display: flex;
min-width: 0;
@@ -142,6 +167,17 @@ html[data-theme="dark"] .artifact-preview .artifact-preview-actions a:hover {
height: 36px;
min-width: 36px;
}
+ .artifact-preview .artifact-preview-view-options.sliding-tabs[data-sliding-tabs] {
+ height: 36px !important;
+ min-height: 36px !important;
+ }
+ .artifact-preview
+ .artifact-preview-view-options.sliding-tabs[data-sliding-tabs]
+ > [data-sliding-tab] {
+ height: 32px !important;
+ min-height: 32px !important;
+ line-height: 32px !important;
+ }
.artifact-preview .artifact-preview-stage {
padding: 12px;
}
diff --git a/chatbot/tests/artifact-preview-toolbar.test.mjs b/chatbot/tests/artifact-preview-toolbar.test.mjs
new file mode 100644
index 00000000..57c3de4f
--- /dev/null
+++ b/chatbot/tests/artifact-preview-toolbar.test.mjs
@@ -0,0 +1,54 @@
+// @vitest-environment node
+import { test } from "vitest";
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+
+const styles = readFileSync(
+ new URL("../src/artifact-preview.css", import.meta.url),
+ "utf8",
+);
+const [desktop, mobile] = styles.split("@media (max-width: 767px)");
+
+function rule(selector, source) {
+ const escaped = selector
+ .replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
+ .replace(/\s+/g, "\\s+");
+ const match = source.match(
+ new RegExp(`(?:^|\\n|\\})\\s*${escaped}\\s*\\{([^}]*)\\}`),
+ );
+ assert.ok(match, `missing rule for ${selector}`);
+ return match[1];
+}
+
+const tabs =
+ ".artifact-preview .artifact-preview-view-options.sliding-tabs[data-sliding-tabs]";
+const tab = `${tabs} > [data-sliding-tab]`;
+
+function px(body, property) {
+ const match = body.match(new RegExp(`(?:^|[;\\s])${property}:\\s*(\\d+)px`));
+ assert.ok(match, `missing ${property}`);
+ return Number(match[1]);
+}
+
+test("the preview/source switch matches the height of the icon actions beside it", () => {
+ const icon = rule(".artifact-preview .artifact-preview-icon-action", desktop);
+ assert.equal(px(rule(tabs, desktop), "height"), px(icon, "height"));
+ assert.equal(px(rule(tabs, desktop), "min-height"), px(icon, "height"));
+});
+
+test("the preview/source switch uses compact text instead of the 14px page tabs", () => {
+ const body = rule(tab, desktop);
+ assert.ok(px(body, "font-size") <= 13);
+ assert.ok(px(body, "height") < px(rule(tabs, desktop), "height"));
+ assert.match(body, /flex:\s*0 0 auto/);
+});
+
+test("the switch sizes to its labels rather than stretching across the toolbar", () => {
+ assert.match(rule(tabs, desktop), /display:\s*inline-flex/);
+});
+
+test("on narrow screens the switch grows with the 36px touch targets", () => {
+ const icon = rule(".artifact-preview .artifact-preview-icon-action", mobile);
+ assert.equal(px(rule(tabs, mobile), "height"), px(icon, "height"));
+ assert.ok(px(rule(tab, mobile), "height") < px(icon, "height"));
+});