Commit Graph

3 Commits

Author SHA1 Message Date
George·Dong
826414e821
feat(provider-settings): support viewing detailed error messages (#12423)
* feat(error): add clickable error detail modal for model detection

- Add onErrorClick callback to HealthStatusIndicator component
- Make error icon clickable to show detailed error modal
- Export ErrorDetailModal for reuse across components
- Use SerializedError type for better error information display
- Fix tooltip i18n keys and flex layout for consistent spacing

* fix(error): only show clickable error indicator when failed results exist

- Only pass onErrorClick callback when there are failed results
- Conditionally render ErrorDetailModal only when needed
- Improve performance by avoiding unnecessary state for success cases

* refactor(error): extract serializeHealthCheckError utility function

- Extract duplicated error serialization logic into serializeHealthCheckError()
  utility function in error.ts
- Update HealthCheckService.ts, hook.ts, and ProviderSetting.tsx to use
  the new utility function
- Fix invalid CSS values: align-items: left -> center, align: left -> flex-start
- Use HealthStatus.FAILED constant instead of hardcoded 'failed' string

* fix(settings): update tooltip message key for API check

Change the tooltip fallback translation key from the provider
API check to the models check. This ensures the displayed
message matches the new i18n key and avoids showing an
incorrect/provider-specific string when the API key
connectivity error message is absent.

* refactor(error): extract ErrorDetailModal as independent component

* refactor(error): extract ErrorDetailModal as independent component

* refactor(error): update ErrorDetailModal with full features from ErrorBlock

* refactor(error): fix export duplication and add React performance optimizations

* refactor(error): add React performance optimizations

- Memoize ErrorDetailModal child components (BuiltinError, AiSdkErrorBase, TruncatedCodeViewer, AiSdkError)
- Add useCallback for handleErrorClick in HealthStatusIndicator
- Add useCallback for copyErrorDetails in ErrorDetailModal
- Optimize ModelListItem button inline functions with useCallback

* refactor(health): move HealthStatusIndicatorProps back to indicator.tsx

- HealthStatusIndicatorProps was only used in indicator.tsx, no need to export
- Keep HealthResult in types.ts as it's used by useHealthStatus hook

* fix(health): import HealthResult from types instead of redefining

- useHealthStatus depends on HealthResult from ./types
- Only HealthStatusIndicatorProps belongs to indicator.tsx

* refactor(health): move click handler to outer wrapper

* fix(lint): resolve react-hooks/exhaustive-deps warnings in ModelListItem

- wrap healthResults in useMemo to avoid unnecessary re-renders
- remove redundant ErrorDetailModal export from ErrorBlock

* refactor(error): optimize ErrorDetailModal and replace duplicate code

- Use parseDataUrl from @shared/utils instead of manual base64 detection
- Replace duplicate ErrorDetailModal in ErrorBlock with the shared component
- Optimize onErrorClick with useMemo for better performance
2026-01-23 14:26:33 +08:00
fullex
dc06c103e0
chore[lint]: add import type lint (#11091)
chore: add import type lint
2025-11-01 10:40:02 +08:00
one
2b0c46bfdb
refactor: model list and health check (#7997)
* refactor(ProviderSetting): add a backtop to provider setting

* refactor: decouple ModelList from ProviderSetting

* refactor: move modellist to a single dir

* refactor: allow more props for CollapsibleSearchBar

* refactor: split ModelList into ModelList, ModelListGroup and ModelListItem

* refactor: simplify health check types, improve file structure

* refactor: split HealthStatusIndicator from list items

* refactor: better indicator tooltip

* refactor: improve model search, simplify some expressions

* refactor: further simplify ModelList by extracting onHealthCheck

* refactor: remove double scroller from EditModelsPopup

* revert: remove backtop

* fix: i18n order

* refactor: sort buttons
2025-07-21 15:57:08 +08:00