feat: Add Spring AI Video Generation Extension Module #4540
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request: Add Spring AI Video Generation Extension Module
Overview
This PR introduces a complete video generation extension module for the Spring AI framework, providing video generation capabilities while adhering to Spring AI's core design philosophy and architectural standards. The module delivers an end-to-end solution covering video generation, task status management, and result storage.
Key Features
1. Core Video Generation
VideoModelinterface and its implementation classVideoModelImpl.VideoClientwith fluent chaining and builder pattern support for parameter construction.2. Task Status Management
InMemoryVideoStoragefor task tracking.IN_QUEUE→IN_PROGRESS→SUCCEED/FAILED.VideoStoragefor custom persistence implementations.3. Automated Polling Mechanism
VideoTimer, a scheduled task scanner that automatically polls for incomplete video generation tasks.4. Flexible Configuration
prompt,model,imageSize,negativePrompt,referenceImage, andseed.application.yaml.Architecture
Module Structure
Workflow
VideoClient.VideoModelto call the video service API.IN_QUEUE.VideoStoragepersists task metadata.VideoTimerperiodically polls for task status updates.SUCCEEDorFAILED.Usage Example
Configuration Options
ai.video.timer.enabledtrueai.video.timer.timeout300000(5 minutes)ai.video.timer.ttl86400000(24h)ai.video.timer.interval30000(30 seconds)Compatibility
This module aligns with Spring AI design principles and integrates seamlessly with existing Spring AI components:
Modelinterface.Future Enhancements
This module has been fully tested and is ready for integration into the Spring AI ecosystem, providing developers with robust video generation capabilities.