Skip to content

feat: polish provider settings and picker behavior#48

Merged
lsave merged 2 commits intomainfrom
codex/providers-settings-polish
Mar 28, 2026
Merged

feat: polish provider settings and picker behavior#48
lsave merged 2 commits intomainfrom
codex/providers-settings-polish

Conversation

@lsave
Copy link
Copy Markdown
Contributor

@lsave lsave commented Mar 28, 2026

Summary:

  • streamline the provider settings list so vendors are surfaced directly, with simpler status/default affordances and updated locale copy
  • tighten the model settings section spacing and keep the release notes copy in sync with the current wording
  • keep slash skill picker keyboard navigation scrolled into view while moving through long result lists

Validation:

  • pnpm exec eslint src/components/settings/ProvidersSettings.tsx
  • pnpm exec tsc --noEmit --pretty false

Copy link
Copy Markdown

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

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 refactors the AI Providers settings page to introduce a sidebar with active accounts and inactive placeholders, adds a delete confirmation modal, and enhances the provider addition flow. In the chat interface, it implements automatic scrolling for the skill picker to keep the highlighted item in view. Feedback focuses on improving the maintainability of provider authentication logic and simplifying the scrolling implementation by using the native scrollIntoView API.

Comment on lines +608 to +616
const authModes: ProviderAccount['authMode'][] = vendor?.supportedAuthModes.length
? vendor.supportedAuthModes
: vendorId === 'ollama'
? ['local']
: vendorId === 'openai' || vendorId === 'google'
? ['oauth_browser', 'api_key']
: typeInfo?.isOAuth
? (typeInfo.supportsApiKey ? ['oauth_device', 'api_key'] : ['oauth_device'])
: ['api_key'];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This logic for determining authModes includes hardcoded fallbacks for specific providers. This could become a maintenance issue if provider definitions change or new ones are added. To improve maintainability, it would be better to rely on a single source of truth for provider capabilities, such as the vendor.supportedAuthModes property. If vendor can be undefined, perhaps we should ensure it's always populated from a consolidated provider registry.

Comment on lines +1113 to +1127
useEffect(() => {
if (!skillPickerVisible || filteredSlashItems.length === 0) {
return;
}

const container = skillPickerListRef.current;
const boundedHighlightedIndex = Math.min(highlightedSkillIndex, filteredSlashItems.length - 1);
const selectedItem = skillPickerItemRefs.current[boundedHighlightedIndex];

if (!container || !selectedItem) {
return;
}

scrollElementIntoScrollableView(container, selectedItem);
}, [filteredSlashItems.length, highlightedSkillIndex, skillPickerVisible]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This useEffect and the helper function scrollElementIntoScrollableView can be simplified by using the standard Element.scrollIntoView() method. This is more declarative and removes the need for manual scroll calculations and the skillPickerListRef.

Here's a suggested simplification for this useEffect block. You can then remove the scrollElementIntoScrollableView function and the skillPickerListRef.

  useEffect(() => {
    if (!skillPickerVisible || filteredSlashItems.length === 0) {
      return;
    }

    const boundedHighlightedIndex = Math.min(highlightedSkillIndex, filteredSlashItems.length - 1);
    const selectedItem = skillPickerItemRefs.current[boundedHighlightedIndex];

    if (selectedItem) {
      selectedItem.scrollIntoView({ block: 'nearest' });
    }
  }, [filteredSlashItems.length, highlightedSkillIndex, skillPickerVisible]);

@lsave
Copy link
Copy Markdown
Contributor Author

lsave commented Mar 28, 2026

/gemini review

Copy link
Copy Markdown

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

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 updates AI provider metadata, including names and icons, and significantly refactors the provider settings UI to display both active accounts and inactive placeholders. It also introduces a deletion confirmation dialog and improves the chat input skill picker by ensuring highlighted items scroll into view. Feedback suggests refactoring a hardcoded name map in the OAuth manager to utilize central provider definitions, which would improve maintainability and prevent data duplication.

const nameMap: Record<OAuthProviderType, string> = {
'minimax-portal': 'MiniMax (Global)',
'minimax-portal-cn': 'MiniMax (CN)',
'minimax-portal-cn': 'MiniMax',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

While this change correctly aligns the provider name, this nameMap duplicates information that is already present in PROVIDER_DEFINITIONS. To improve maintainability and avoid potential inconsistencies, consider refactoring to remove this map. You could instead retrieve the provider name directly from the definitions using getProviderDefinition from ./provider-registry when constructing nextAccount.

@lsave lsave merged commit baf14ed into main Mar 28, 2026
2 checks passed
@lsave lsave deleted the codex/providers-settings-polish branch March 28, 2026 04:57
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.

1 participant