A production-ready AI chat interface built on the SAP Cloud Application Programming Model (CAP) and SAPUI5, designed for enterprise deployment with SAP AI Core integration. This open-source project provides a complete foundation for building scalable, multi-model AI assistants on SAP Business Technology Platform.
OpenCAP AI Chat Studio is an enterprise-grade conversational AI platform that seamlessly integrates with SAP AI Core, enabling organizations to deploy and manage AI-powered chat interfaces with full control over model selection, configuration, and conversation management.
- Native SAP AI Core Support: Direct integration with SAP AI Core deployment endpoints
- Flexible Authentication: JWT token-based authentication with configurable resource groups
- Multi-Model Architecture: Support for multiple AI models with per-conversation model selection
- Dynamic Configuration: Runtime configuration of AI endpoints without code changes
- Conversation Management: Persistent conversation history with full CRUD operations
- Model Configuration: Centralized management of AI model deployments and system prompts
- User Interface: Professional SAPUI5-based interface with responsive design
- Theme Support: Light, dark, and system-synchronized themes
- Message Operations: Copy, edit, and delete message capabilities
- SAP CAP Backend: Robust service layer following SAP Clean Core principles
- SAPUI5 Frontend: Modern, responsive UI built with SAP's enterprise UI framework
- RESTful API: OData v4 services for seamless integration
- Database Flexibility:
- Development: SQLite for local development
- Production: SAP HANA Cloud for enterprise deployment
- Automatic database switching based on environment
- Streaming Display: Progressive message rendering for enhanced user experience
- Node.js: v18 or higher (v20 LTS recommended)
- SAP CDS Development Kit:
npm install -g @sap/cds-dk - Visual Studio Build Tools (Windows): Required for SQLite native module compilation
- SAP BTP Account: Cloud Foundry environment
- SAP HANA Cloud: Database service (hdi-shared plan minimum)
- Cloud Foundry CLI: For deployment (
cfcommand) - MTA Build Tool: For multi-target application builds (
mbtcommand)
- SAP AI Core Access: For production AI model integration
- SAP Destination Service: For secure credential management
git clone https://github.com/OpenCAPai/opencapai-chat-studio.git
cd opencapai-chat-studionpm installNote for Windows users: If you encounter native module compilation errors, install Visual Studio Build Tools first.
Create a .env file in the project root:
AICORE_ENDPOINT="https://api.ai.prod-eu20.<REGION>.azure.ml.hana.ondemand.com/v2/inference/deployments/<YOUR_DEPLOYMENT_ID>/v2/completion"
AICORE_RESOURCE_GROUP="default"
AICORE_TOKEN="your-jwt-token-here"Alternatively, configure AI Core credentials through the application's Settings UI after startup.
npm run watchThe application will be available at:
- Access Settings: Click the settings icon (⚙️) in the application header
- Configure AI Core:
- Endpoint URL: Your SAP AI Core deployment endpoint
- Resource Group: The resource group name (typically "default")
- Authentication Token: Your JWT token for AI Core authentication
- Save Configuration: Click "Save AI Core Configuration"
Configure AI models in the Settings dialog:
- Model ID: Unique identifier for the model
- Display Name: User-friendly name shown in the UI
- Deployment URL: SAP AI Core deployment endpoint
- System Prompt: Base instructions defining the AI's behavior and personality
opencapai-chat-studio/
├── app/ # SAPUI5 Frontend Application
│ ├── webapp/
│ │ ├── controller/ # UI Controllers
│ │ ├── view/ # XML Views
│ │ └── Component.js # Application Component
│ └── index.cds # UI Annotations
├── db/ # Database Schema
│ └── schema.cds # Entity Definitions
├── srv/ # CAP Service Layer
│ ├── chat-service.cds # Service Definitions
│ └── chat-service.js # Service Implementation
├── .env # Environment Configuration (not in repo)
├── package.json # Dependencies and Scripts
└── README.md # This file
npm run watchStarts the application with hot-reload enabled for both backend and frontend changes.
npm run buildnpm testThe application automatically adapts to the environment:
# Default configuration - uses SQLite
npm run watch# Deploy schema to HANA
cds deploy --to hana --store-credentials
# Start with production profile
NODE_ENV=production npm startThe application automatically uses HANA when deployed to SAP BTP Cloud Foundry with the HANA service bound.
The recommended deployment method uses Multi-Target Application (MTA) for automated service provisioning:
# Install MTA Build Tool
npm install -g mbt
# Build MTA archive
mbt build
# Deploy to Cloud Foundry
cf deploy mta_archives/opencapai-chat-studio_*.mtarThis automatically:
- Creates and configures SAP HANA HDI container
- Deploys database schema
- Sets up XSUAA authentication
- Deploys the application
- Configures all service bindings
For step-by-step manual deployment:
-
Create Services:
cf create-service hana hdi-shared opencapai-chat-studio-db cf create-service xsuaa application opencapai-chat-studio-uaa -c xs-security.json
-
Build and Deploy:
npm run build cf push
For comprehensive deployment instructions including:
- HANA Cloud setup
- Environment configuration
- Security setup
- Monitoring and troubleshooting
- GET
/odata/v4/chat/Conversations- List all conversations - GET
/odata/v4/chat/Messages- List all messages - POST
/odata/v4/chat/sendMessage- Send a message and receive AI response - GET
/odata/v4/chat/getAICoreConfig- Retrieve current AI Core configuration - POST
/odata/v4/chat/saveAICoreConfig- Update AI Core configuration
For complete API documentation, access the service metadata at: http://localhost:4004/odata/v4/chat/$metadata
We welcome contributions from the community !
- Follow SAP CAP best practices
- Maintain code quality with ESLint
- Write comprehensive tests for new features
- Update documentation for API changes
- Authentication: Implement proper authentication mechanisms for production use
- Token Management: Store AI Core tokens securely using SAP Destination Service or credential stores
- Data Privacy: Ensure compliance with data protection regulations (GDPR, etc.)
- API Security: Use HTTPS in production and implement rate limiting
Module compilation errors on Windows
- Install Visual Studio Build Tools 2022
AI Core connection failures
- Verify endpoint URL and token validity
- Check network connectivity and firewall settings
- Ensure resource group name is correct
Database errors (Local)
- Delete
node_modulesand runnpm installagain - Check SQLite installation
- Ensure Visual Studio Build Tools are installed (Windows)
Database errors (Production)
- Verify HANA service is bound:
cf services - Check database deployer logs:
cf logs opencapai-chat-studio-db-deployer --recent
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Built with:
- Issues: Report bugs and request features via GitHub Issues
- Discussions: Join the community in GitHub Discussions
- Documentation: Comprehensive guides in the repository root
OpenCAP AI Chat Studio - Enterprise AI Chat Platform for SAP Ecosystems