-
Notifications
You must be signed in to change notification settings - Fork 163
Add AI Assistant Feature with OpenAI Integration #4873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Features: - Floating chat bubble widget on all dashboard pages - LLM-powered assistant with 12 HPC management tools - Job management (list, view details, delete) - File operations (browse, read, create, submit jobs) - Cluster status and interactive session monitoring - Inline implementation to bypass asset pipeline complexity Components: - AssistantController: Backend with OpenAI function calling - JavaScript widget: Vanilla JS chat interface - CSS styling: Purple gradient theme with dark mode support - Routes: POST /assistant/chat, GET /assistant/status Configuration: - Requires OPENAI_API_KEY environment variable - Supports custom model selection via OPENAI_MODEL - Tool-based architecture for extensibility Documentation: - DOCKER_SETUP.md: Container development environment guide - AI_ASSISTANT.md: Feature documentation and customization guide
|
Hi, thank you for your contribution and interest in this project! We're currently trying to finish 4.1 development, so it may take a bit for this to get looked at. One concern I've had with this idea is the It'll take me quite some time to look through the mutative actions that this controller can do. Beyond that, I don't think we need all the
This does seem wrong though, those are hypens ( |
- Remove unnecessary documentation files - Add comprehensive security documentation to controller - Document API key protection (server-side only, never exposed to browser) - Document user isolation (operations use CurrentUser permissions) - Add comments explaining mutative actions and security model
|
Hello, thank you for your quick response! I updated the code based on the points above. If there is any other concern or modification needed, feel free to let me know. |
|
Hey, we are putting this on hold for now while we finish up the next release, and will revisit it after the new year. The deadline for external contributions has passed for 4.1, so we will get back to you with reviews once we wrap this up. |
|
There is potential to add a voice interface to this which could provide a lot of capability for OOD access without the need for a keyboard for accessible or mobile use cases. |
|
@ktomko The feature sounds very useful. Would you be interested in working on this voice feature in this pr? |
|
@MarsPresLai To answer your question, no. I see an audio interface as a possible next step and think it makes sense to consider for a subsequent development effort. |
|
@ktomko I see. Thanks for your great suggestion. |
|
Thinking about this a bit more, my thinking is that interpreting an AI response and acting on it (mutating the system) is better suited to an AI agent. I'm weary of having lots of if/else blocks with regular expressions to do what effectively AI agents are built for. |
Summary
This PR adds a comprehensive AI-powered assistant to the Open OnDemand dashboard that helps users manage HPC tasks through natural language conversations. The assistant appears as a floating chat bubble in the bottom-right corner of all dashboard pages.
Motivation
New HPC users often face a steep learning curve when learning to manage jobs, navigate file systems, and understand cluster resources. This AI assistant provides:
Features
Core Capabilities
User Interface
Technical Implementation
Architecture
Configuration
Requirements
Setup
Optional Configuration
# Change OpenAI model (default: gpt-4o-mini) OPENAI_MODEL=gpt-4oTools Available
The assistant has access to 12 tools for HPC operations:
Read Operations:
list_jobs- List all jobs across clustersget_job_details- Get detailed job informationdelete_job- Delete/cancel jobs (with user confirmation)list_files- Browse directoriesread_file- Read text file contents (first 100 lines)get_file_info- Get file metadataget_cluster_status- View cluster informationlist_interactive_sessions- List active sessionsget_available_apps- List launchable appsWrite Operations:
10.
create_file- Create files with content11.
submit_batch_job- Submit existing job scripts12.
create_and_submit_job- Create script + submit in one stepUsage Examples
Example 1: Check Running Jobs
Example 2: Create and Submit Job
Example 3: Browse Files
Files Changed
New Files
apps/dashboard/app/controllers/assistant_controller.rb(465 lines) - Backend LLM agent with OpenAI integrationapps/dashboard/app/views/layouts/_assistant.html.erb(320 lines) - Inline widget with HTML/CSS/JSapps/dashboard/app/javascript/assistant.js(295 lines) - Modular JavaScript widget (for asset pipeline builds)apps/dashboard/app/assets/stylesheets/assistant.css(360 lines) - Widget styles with dark mode supportDOCKER_SETUP.md(265 lines) - Docker development environment guideapps/dashboard/AI_ASSISTANT.md(370 lines) - Complete feature documentationCOMMIT_SUMMARY.md(437 lines) - Detailed implementation notesModified Files
apps/dashboard/config/routes.rb- Added assistant routes (POST /assistant/chat,GET /assistant/status)apps/dashboard/app/assets/stylesheets/application.scss- Import assistant stylesapps/dashboard/app/javascript/application.js- Import assistant module.gitignore- Exclude cookies and session filesSecurity Considerations
Testing
All testing was performed manually in a Docker development environment.
Test Coverage
Test Scenarios Verified
Manual Test Commands
Documentation
Known Limitations
Future Enhancements
Potential improvements for future PRs:
Breaking Changes
None. This is a new optional feature that:
Deployment Notes
net/http,json)Code Style Compliance
This PR follows the OOD Contributing Guidelines:
Ruby Style
attr_reader(read-only objects)?suffix for boolean returnsbeginblocks in rescue statementsJavaScript Style
assistant.js)camelCasefor variables and functionsconstandlet(novar)CSS Style
ood-assistant-bubble)em,rem) over pixels where appropriateHTML Style
ood-assistant-input)Checklist
attr_readeronly)Additional Notes
Why Inline Partial Instead of Asset Pipeline?
This implementation uses an inline partial (
_assistant.html.erb) rather than fully compiled assets because:The trade-off is a slightly larger HTML payload (~10KB), but the benefit is significantly easier deployment and maintenance. The separate
.jsand.cssfiles are included for sites that prefer to use the asset pipeline.