Skip to content

Custom instructions - #233

Merged
jgindin merged 4 commits into
mainfrom
custom-instructions
Sep 24, 2026
Merged

jgindin merged 4 commits into
mainfrom
custom-instructions

Conversation

@jgindin

@jgindin jgindin commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add custom instructions support with named presets

Support configuring, selecting, and persisting custom instructions presets in local storage.

Pre-launch Checklist

  • I signed the [CLA].
  • I read the [Contributors Guide].
  • I read the [Style Guide].
  • I have added updates to the [CHANGELOG].
  • I updated/added relevant documentation.
  • My code changes (if any) have tests.
  • If my branch is on fork, I have verified that scripts/e2e_test.sh passes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a custom instruction presets feature to the chat interface, allowing users to create, edit, select, and delete named instructions that are appended to the system prompt. It implements the CustomInstructionsDialog component, updates ChatPromptFactoryService to manage and persist the preset state in local storage, integrates the custom instructions link into the ChatPanel, and adds comprehensive unit, integration, and end-to-end tests. As there are no review comments provided, I have no feedback to offer on the changes.

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

⚡ A2UI Composer PR Preview

Your automated preview is successfully live (commit 1bd6761):
👉 Launch PR Preview

Note: This environment will be wiped automatically when the PR is merged or closed.

@suyangw-g suyangw-g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary (PR #233)

Reviewed against Google TypeScript/Angular readability (go/tsstyle), state invariants, and responsive layout/accessibility (go/a11y).

See inline comments for P1 findings.

@jgindin
jgindin force-pushed the custom-instructions branch from 16f26fc to e5bc08c Compare September 24, 2026 17:33
@jgindin
jgindin requested a review from suyangw-g September 24, 2026 17:36

@suyangw-g suyangw-g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Both P1 findings (onOptionChange edit/draft preservation across dropdown switches and .instructions-textarea responsive width) are cleanly resolved in e5bc08c. Leaving one non-blocking UX note on deletePreset().

Comment on lines +156 to +162
protected deletePreset(): void {
const idToDelete = this.selectedOption();
this.presets.update(list => list.filter(p => p.id !== idToDelete));
this.selectedOption.set(NONE_OPTION);
this.presetName.set('');
this.instructionsContent.set('');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2 — Minor UX Note] deletePreset() remains buffered in this.presets until Save is clicked (as codified in the new discards preset deletion when dialog is cancelled spec), while immediately switching the view to None (Off) ("Custom instructions are turned off..."). Because clicking a trash icon next to a preset looks like an immediate action, users who delete a preset and close the dialog via Cancel / Escape / backdrop may be surprised that the deleted preset reappears on next open. Non-blocking for this PR.

Support configuring, selecting, and persisting custom instructions
presets in local storage.

- Add CustomInstructionsDialog for managing and creating presets.
- Inject active custom instructions into Gemini chat prompts via
  ChatPromptFactoryService.
- Persist presets across session resets in ComposerShell.
- Update ChatPanel and ChatCoordinator with custom instructions state.
Inject ChatPromptFactoryService directly into ChatPanel for custom
instructions state and active preset management, removing redundant
pass-through properties and methods from ChatCoordinator.

Move ChatCoordinator.systemPrompt to the top of the class alongside
other readonly properties.

Declare custom instruction models using export declare interface in
ChatPromptFactoryService.
Set dialog width to 600px and configure textarea dimensions to match
SystemInstructionsDialog layout, avoiding shrink-to-fit collapse.
Add Playwright bounding box assertion.
Sync preset name and instruction content directly into the working
presets array on edit, and preserve draft preset state when toggling
between dropdown options to prevent silent data loss before save.

Update custom instructions textarea to width: 100% and min-width: 0 to
prevent horizontal overflow on narrow viewports.

Add unit tests covering edit and draft preservation across options.
@jgindin
jgindin force-pushed the custom-instructions branch from e5bc08c to 1bd6761 Compare September 24, 2026 18:42
@jgindin
jgindin merged commit 662a8b5 into main Sep 24, 2026
15 checks passed
@jgindin
jgindin deleted the custom-instructions branch September 24, 2026 18:55
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Sep 24, 2026
…derer

The catalog-aware system prompt now ends with main's custom instructions
(a2ui-project#233), the Assistant panel takes main's width settings (a2ui-project#231), and the
README drops the removed MCP sample while keeping the Slack sample.
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.

2 participants