Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/web-ui/src/app/scenes/settings/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ Keep trusted navigation contributions separate from controller-local preferences
device-scoped MiniApp pins. These tests simulate Peer activation and capability gates;
they do not establish live SSH, Remote Control, Peer Device or Detached Dispatch behavior.

Model connection and detail editors use the shared `Dialog preset="panel"`
with a centered provider identity and the panel's top/bottom spacing. Keep the
editor footer `appearance="floating"` for centered actions. This presentation is
intentional; form controls inside still follow the standard shared sizing and
field-surface contracts.

For model-pool strategy selection, member search/multi-selection, nested-dialog
dismissal, preserved records and device-switch isolation, run:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ describe('ModelSettingsPage loading and provider actions', () => {
expect(editor()!.textContent).not.toContain('bigmodel.cn');
expect(editor()!.querySelector('.openbitfun-model-settings__resolved-url')).toBeNull();
expect(editorDraft().dirty).toBe(false);
expect(editor()!.getAttribute('data-preset')).toBe('default');
expect(editor()!.getAttribute('data-size')).toBe('lg');
expect(editor()!.getAttribute('data-preset')).toBe('panel');
expect(editor()!.getAttribute('data-size')).toBe('xl');
expect(endpoint.closest('[data-field-surface]')?.getAttribute('data-field-surface')).toBe('filled');
await act(async () => editor()!.querySelector<HTMLButtonElement>('[data-testid="settings-model-advanced-toggle"] button')!.click());
expect(editorDraft().dirty).toBe(false);
Expand Down Expand Up @@ -1063,7 +1063,7 @@ describe('ModelSettingsPage loading and provider actions', () => {
const editor = document.querySelector<HTMLElement>('.openbitfun-model-settings__editor-dialog')!;
const brand = editor.querySelector<HTMLElement>('[data-testid="settings-provider-editor-brand"]')!;
expect(brand.getAttribute('aria-label')).toBe(model.name);
expect(editor.getAttribute('data-preset')).toBe('default');
expect(editor.getAttribute('data-preset')).toBe('panel');
expect(editor.querySelector('[data-openbitfun-part="title"]')?.classList.contains('sr-only')).toBe(true);
expect(brand.closest('[data-openbitfun-part="heading"]')).not.toBeNull();
if (kind === 'subscription') expect(brand.querySelector<HTMLElement>('[data-product-logo="codex"]')?.style.width).toBe('64px');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1823,9 +1823,9 @@
&__provider-editor-brand {
display: flex;
align-items: center;
justify-content: flex-start;
justify-content: center;
color: var(--openbitfun-color-content-primary);
text-align: start;
text-align: center;
overflow-wrap: anywhere;
font-family: var(--openbitfun-type-heading-dialog-font-family);
font-size: var(--openbitfun-type-heading-dialog-font-size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5446,8 +5446,7 @@ const ModelSettingsPage: React.FC = () => {
}
}}
className="openbitfun-model-settings__editor-dialog"
preset="default"
size="lg"
preset="panel"
>
<DialogHeader>
{(modelPanelDraft || managingSubscriptionProvider) && !reasoningPanelDraft && (
Expand Down Expand Up @@ -5536,7 +5535,7 @@ const ModelSettingsPage: React.FC = () => {
) : renderEditingForm()}
</DialogBody>
{!reasoningPanelDraft && (
<DialogFooter>
<DialogFooter appearance="floating">
{managingSubscriptionProvider ? (
<Button variant="primary" size="sm" onClick={finishSubscriptionManagement} disabled={!!loggingInProvider}>
{t('actions.done')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const styles = readFileSync(
);

describe('ModelSettingsPage dialog presentation', () => {
it('uses a content-sized editor and panel dialogs for model browsing workflows', () => {
it('uses the shared panel preset throughout model management workflows', () => {
const owners = [
'../../../app/scenes/settings/pages/ai/ModelSettingsPage.tsx',
'../../../app/scenes/settings/pages/ai/ModelDiscoveryPicker.tsx',
Expand All @@ -29,10 +29,7 @@ describe('ModelSettingsPage dialog presentation', () => {
const visit = (node: ts.Node) => {
if ((ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) && node.tagName.getText(tree) === 'Dialog') {
const preset = node.attributes.properties.find(property => ts.isJsxAttribute(property) && property.name.getText(tree) === 'preset');
const editor = node.attributes.properties.some(property => ts.isJsxAttribute(property)
&& property.name.getText(tree) === 'className'
&& property.initializer?.getText(tree) === '"openbitfun-model-settings__editor-dialog"');
expect(preset?.getText(tree), owner).toBe(editor ? 'preset="default"' : 'preset="panel"');
expect(preset?.getText(tree), owner).toBe('preset="panel"');
dialogs += 1;
}
ts.forEachChild(node, visit);
Expand All @@ -42,7 +39,7 @@ describe('ModelSettingsPage dialog presentation', () => {
}
});

it('keeps model configuration editors at a moderate responsive size', () => {
it('keeps model editors on the shared centered panel spacing and floating actions', () => {
const editorDialogStart = source.indexOf('open={isEditing && !!editingConfig}');
const editorDialog = source.slice(editorDialogStart, source.indexOf('<ConfirmDialog', editorDialogStart));
const editingFormStart = source.indexOf('const renderEditingForm = () => {');
Expand All @@ -54,15 +51,15 @@ describe('ModelSettingsPage dialog presentation', () => {
expect(editorDialogStart).toBeGreaterThan(-1);
expect(editingFormStart).toBeGreaterThan(-1);
expect(editorDialog).toContain('className="openbitfun-model-settings__editor-dialog"');
expect(editorDialog).toContain('preset="default"');
expect(editorDialog).toContain('size="lg"');
expect(editorDialog).toContain('preset="panel"');
expect(editorDialog).not.toContain('size="lg"');
expect(editorDialog).toContain('<DialogHeaderLeading>');
expect(editorDialog).toContain('<DialogHeaderActions>');
expect(editorDialog).not.toContain('size="2xl"');
expect(editorDialog).toMatch(
/\{!reasoningPanelDraft && \(\s*<DialogFooter>/,
/\{!reasoningPanelDraft && \(\s*<DialogFooter appearance="floating">/,
);
expect(editorDialog).not.toContain('appearance="floating"');
expect(editorDialog).toContain('appearance="floating"');
expect(editorDialog).toContain(
'<Button variant="fill" size="sm" onClick={modelPanelDraft ? cancelModelPanel : requestCloseEditingModal} disabled={isEditorSaving}>',
);
Expand Down
Loading