Skip to content

Conversation

@junaid88
Copy link

@junaid88 junaid88 commented Aug 25, 2025

Summary

Add first-class support for SAP AI Core as a selectable provider across types, API, extension messaging, and webview UI. Includes model selection, provider-specific validation, streaming support, and comprehensive unit tests.

Changes

Types

  • packages/types/src/provider-settings.ts - Extend provider settings to include SAP AI Core configuration fields (baseUrl, apiKey, org/project, model)
  • packages/types/src/providers/index.ts - Register and export the sapAiCore provider types
  • packages/types/src/providers/sapaicore.ts - New: typed definitions for SAP AI Core (request/response shapes, model metadata)

API

  • src/api/providers/sapaicore.ts - New: provider implementation with client construction, standardized request paths, streaming support, and error normalization
  • src/api/providers/index.ts - Export sapAiCore provider and add to provider factory/registry
  • src/api/index.ts - Surface sapAiCore through the main API where providers are selected/invoked

Extension messaging

  • src/shared/ExtensionMessage.ts - Add message variants for sapAiCore configuration and model fetch requests
  • src/shared/WebviewMessage.ts - Add webview message types for sapAiCore settings and model selection flows
  • src/core/webview/webviewMessageHandler.ts - Handle new message types; route config/model actions to API; return normalized results to UI

UI settings and model selection

  • webview-ui/src/components/settings/ApiOptions.tsx - Add SAP AI Core as selectable provider and show configuration form
  • webview-ui/src/components/settings/SapAiCoreModelPicker.tsx - New: model picker to list and select SAP AI Core models
  • webview-ui/src/components/settings/providers/SapAiCore.tsx - New: provider-specific settings form (base URL, API key, org/project, model)
  • webview-ui/src/components/settings/providers/index.ts - Register and export the new provider panel
  • webview-ui/src/components/settings/constants.ts - Add display metadata and validation constants for SAP AI Core
  • webview-ui/src/components/ui/hooks/useSapAiCoreModels.ts - New: hook to load and memoize models for picker UX
  • webview-ui/src/components/ui/hooks/useSelectedModel.ts - Update selected-model derivation and sync logic to include sapAiCore

i18n and validation

  • webview-ui/src/i18n/locales/en/settings.json - Add strings for labels, placeholders, and validation messages
  • webview-ui/src/utils/validate.ts - Add provider-specific validation (https baseUrl, required apiKey and model, org/project as required)
  • webview-ui/src/utils/tests/validate.test.ts - Updated validation tests

Tests

  • src/api/providers/tests/sapaicore.spec.ts - Validate base provider requests and error handling
  • src/api/providers/tests/sapaicore-test.spec.ts - Additional behavior and edge cases for configuration/response mapping
  • src/api/providers/tests/sapaicore-utils.spec.ts - Unit tests for provider-specific helpers
  • src/api/providers/tests/sapaicore-streaming.spec.ts - Ensure streaming protocol compatibility and token assembly
  • webview-ui/src/components/settings/tests/SapAiCoreModelPicker.spec.tsx - Verify model listing, loading states, and selection events
  • webview-ui/src/components/ui/hooks/tests/useSelectedModel.spec.ts - Confirm selected-model logic includes sapAiCore and persists correctly

Configuration

Provider ID: sapAiCore

Required Fields:

  • baseUrl (https required)
  • Client ID (required)
  • Client Secret (required)
  • Token URL (required)
  • Resource Group (optional)
  • model (required; selected via picker)

Validation errors are surfaced via i18n strings.

Backward Compatibility

No breaking changes for existing providers or defaults. sapAiCore is additive and only active when selected.

Security and Privacy

Reuses existing provider HTTP and secret handling pathways. No changes to telemetry behavior.

Testing Instructions

  1. In Settings, select SAP AI Core as the provider
  2. Enter SAP AI Core Base URL, SAP AI Core Client ID, SAP AI Core Client Secret, SAP AI Core Token URL and SAP AI Core Resource Group (if any available)
  3. Open Model Picker, fetch models, select a model
  4. Save the Settings.
  5. Send a prompt:
    • Verify non-streaming responses render
    • Verify streaming responses render progressively

Negative test cases:

  • Invalid URL shows validation errors
  • Missing API key/model blocks saving/applying
  • 4xx/5xx errors display meaningful messages

Checklist

  • Conventional Commits used; logically scoped commits
  • Unit tests added/updated (API provider, streaming, UI, validation)
  • i18n strings added/updated
  • Provider-specific validation added
  • Documentation via UI labels and inline validation copy
  • No breaking changes introduced
  • Follows existing provider patterns (types, API, messaging, UI)

Important

Adds SAP AI Core as a new provider with full integration into types, API, UI, validation, and tests.

  • Behavior:
    • Adds SAP AI Core as a selectable provider in ApiOptions.tsx and SapAiCore.tsx.
    • Supports model selection and provider-specific validation.
    • Implements streaming and non-streaming response handling in sapaicore.ts.
  • Types:
    • Extends provider-settings.ts to include SAP AI Core fields.
    • Adds sapaicore.ts for typed definitions.
  • API:
    • Implements SAP AI Core provider in sapaicore.ts with client construction and error handling.
    • Adds getSapAiCoreDeployedModels function.
  • UI:
    • Adds SapAiCoreModelPicker.tsx for model selection.
    • Updates useSelectedModel.ts to handle SAP AI Core models.
  • Validation:
    • Updates validate.ts to include SAP AI Core validation logic.
    • Adds tests in validate.test.ts for SAP AI Core validation.
  • Tests:
    • Adds unit tests for SAP AI Core in sapaicore.spec.ts, sapaicore-test.spec.ts, and sapaicore-utils.spec.ts.
    • Tests model picker in SapAiCoreModelPicker.spec.tsx.
    • Tests useSelectedModel hook for SAP AI Core in useSelectedModel.spec.ts.

This description was created by Ellipsis for 995f20f. You can customize this summary. It will automatically update as commits are pushed.

- Add comprehensive SAP AI Core provider
- Implement authentication using OAuth 2.0 client credentials flow
- Add deployment detection and model mapping for SAP AI Core services
- Include streaming support for real-time responses
- Add comprehensive test coverage for all provider functionality
- Implement UI components for SAP AI Core configuration and model selection
- Add model picker with deployment status indication
- Include validation for required configuration fields
- Add internationalization support for SAP AI Core settings
- Integrate with existing provider architecture and settings system

This enables users to connect to SAP AI Core's enterprise AI platform,
supporting both Azure OpenAI and GCP Vertex AI model deployments with
proper authentication and deployment management.

Aligns with roadmap goals:
- Enhanced AI provider support for enterprise platforms
- Reliable authentication and connection handling
- Improved user experience with clear deployment status
@junaid88 junaid88 requested review from cte, jr and mrubens as code owners August 25, 2025 08:59
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement New feature or request UI/UX UI/UX related or focused labels Aug 25, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 25, 2025
Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I've reviewed the SAP AI Core provider implementation and found several issues that need attention before merging. The integration follows the existing provider patterns well, but there are some security concerns and code quality improvements needed.

@junaid88 junaid88 closed this Aug 25, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 25, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Aug 25, 2025
@junaid88 junaid88 reopened this Aug 25, 2025
@github-project-automation github-project-automation bot moved this from Done to Triage in Roo Code Roadmap Aug 25, 2025
@github-project-automation github-project-automation bot moved this from Done to New in Roo Code Roadmap Aug 25, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 26, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 26, 2025
@daniel-lxs
Copy link
Member

Hey @junaid88, thank you for the time you put into this comprehensive SAP AI Core provider implementation. However, I did notice some architectural inconsistencies with our existing project patterns. For example, the implementation introduces custom webview message handlers that bypass our established fetchers interface, which could create technical debt. We'd love to see this refactored to align with our existing patterns (like using the standardized fetcher interface in src/api/providers/fetchers/) before resubmitting.

I will close this PR for now but feel free to let me know if you want to work on it and refactor it, I can reopen it for you.

@daniel-lxs daniel-lxs closed this Aug 27, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 27, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Aug 27, 2025
@junaid88
Copy link
Author

@daniel-lxs Thank you for your response. Please reopen the PR and also highlight any other architectural inconsistencies. I will address them.

@daniel-lxs daniel-lxs reopened this Aug 28, 2025
@github-project-automation github-project-automation bot moved this from Done to Triage in Roo Code Roadmap Aug 28, 2025
@github-project-automation github-project-automation bot moved this from Done to New in Roo Code Roadmap Aug 28, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Aug 28, 2025
@daniel-lxs daniel-lxs marked this pull request as draft August 28, 2025 00:19
@junaid88
Copy link
Author

Closing this PR.

@junaid88 junaid88 closed this Aug 28, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 28, 2025
@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Draft / In Progress size:XXL This PR changes 1000+ lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants