Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(model-hub): open the add-hop picker rightward from its trigger (#2209)

Call White12972d6349c2
diff --git a/ui/e2e/model-catalog/route-direct-edit.spec.ts b/ui/e2e/model-catalog/route-direct-edit.spec.ts
index d6e3e2e2f..7c3e2cbd4 100644
--- a/ui/e2e/model-catalog/route-direct-edit.spec.ts
+++ b/ui/e2e/model-catalog/route-direct-edit.spec.ts
@@ -314,15 +314,19 @@ for (const lang of ['en', 'zh'] as const) {
// engine reports is on screen; this is that reading on the other axis, so the
// assertion is the one the screenshot would have failed: both edges inside the
// viewport, at every width a phone actually is.
-for (const [label, width] of [['small', 390], ['large', 430]] as const) {
- test(`MH-ROUTING-007: the edit picker stays on screen on a ${label} phone`, async ({ page }) => {
+// The Add trigger sits at the left of the tools instead, so its panel hangs
+// right from there; aligned to the trigger's end it had only the trigger's own
+// width to the padding line and shrank to a sliver.
+for (const [label, width] of [['small', 390], ['large', 430]] as const) for (const picker of ['edit', 'add'] as const) {
+ test(`MH-ROUTING-007: the ${picker} picker stays on screen on a ${label} phone`, async ({ page }) => {
const copy = (key: string) => hub(key, {}, 'zh');
await page.setViewportSize({ width, height: 844 });
await page.goto('/e2e/model-catalog/fixture.html?view=route&backend=codex&lang=zh&stocked=1');
await page.getByRole('button', { name: 'Open route', exact: true }).click();
const dialog = page.locator('.model-hub-route-dialog');
await enterCustom(dialog, copy);
- await hopAction(dialog, copy, 'editHop');
+ if (picker === 'edit') await hopAction(dialog, copy, 'editHop');
+ else await dialog.getByRole('button', { name: copy('routeDialog.addHop'), exact: true }).click();
const selector = page.locator('.model-hub-route-selector');
await expect(selector).toBeVisible();
await settled(selector);
@@ -332,7 +336,7 @@ for (const [label, width] of [['small', 390], ['large', 430]] as const) {
expect(panel.x + panel.width).toBeLessThanOrEqual(width);
// Contained by shrinking, not by collapsing: a panel bounded to nothing
// would satisfy the edges above and still be unusable.
- expect(panel.width).toBeGreaterThanOrEqual(240);
+ expect(panel.width).toBeGreaterThanOrEqual(Math.min(420, width - 64));
// And the column that was being cut is the one that has to survive: its
// left edge is what leaves the viewport first.
const head = (await selector.locator('.model-hub-route-selector-list').boundingBox())!;
diff --git a/ui/src/components/settings/models/RouteCandidatePopover.tsx b/ui/src/components/settings/models/RouteCandidatePopover.tsx
index 6a4ab04ff..e69aa919c 100644
--- a/ui/src/components/settings/models/RouteCandidatePopover.tsx
+++ b/ui/src/components/settings/models/RouteCandidatePopover.tsx
@@ -36,6 +36,9 @@ export const RouteCandidatePopover: React.FC<{
onReturnFocus?: () => void;
trigger: React.ReactElement;
width: "route" | "trigger";
+ /** Which trigger edge a route-width panel lines up with: a row action sits at
+ * the right of its row, the Add trigger at the left of the tools. */
+ align?: "start" | "end";
/** Opened by another control (a phone's row menu) instead of `trigger`,
* which is then only the anchor the panel hangs from. */
open?: boolean;
@@ -50,6 +53,7 @@ export const RouteCandidatePopover: React.FC<{
onReturnFocus,
trigger,
width,
+ align = "end",
open: controlledOpen,
onOpenChange,
}) => {
@@ -170,7 +174,7 @@ export const RouteCandidatePopover: React.FC<{
<PopoverContent
side="bottom"
avoidCollisions={false}
- align={width === "route" ? "end" : "start"}
+ align={width === "route" ? align : "start"}
sideOffset={6}
collisionPadding={16}
className={cn(
diff --git a/ui/src/components/settings/models/RouteChainDialog.tsx b/ui/src/components/settings/models/RouteChainDialog.tsx
index 93b759944..527780658 100644
--- a/ui/src/components/settings/models/RouteChainDialog.tsx
+++ b/ui/src/components/settings/models/RouteChainDialog.tsx
@@ -1281,6 +1281,7 @@ export const RouteChainDialog: React.FC<{
confirmLabel={t("settings.models.routeDialog.add.confirm") as string}
label={t("settings.models.routeDialog.addHop") as string}
width="route"
+ align="start"
onApply={addCandidate}
onReturnFocus={() => addButtonRef.current?.focus()}
trigger={
diff --git a/ui/src/components/settings/models/modelHubSurface.css b/ui/src/components/settings/models/modelHubSurface.css
index c871b6489..e9766764e 100644
--- a/ui/src/components/settings/models/modelHubSurface.css
+++ b/ui/src/components/settings/models/modelHubSurface.css
@@ -1212,8 +1212,9 @@
`size` is not gated (`@radix-ui/react-popper` applies it unconditionally), so
the available-width report survives, and for a `bottom`/`end` placement
floating-ui computes it as `width - overflow.left`: exactly the width whose
- left edge lands on the padding line. Bounding by it contains the panel
- without restoring the flip. Where the room is ampler than the design width —
+ left edge lands on the padding line; the Add trigger's `start` placement
+ reads `width - overflow.right` the same way. Bounding by it contains the
+ panel without restoring the flip. Where the room is ampler than the design width —
every desktop placement — the min is the design width and nothing moves. */
.model-hub-route-selector--width-route {
--model-hub-route-selector-inline-max: 420px;