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
VideoModel
interface and its implementation classVideoModelImpl
.VideoClient
with fluent chaining and builder pattern support for parameter construction.2. Task Status Management
InMemoryVideoStorage
for task tracking.IN_QUEUE
→IN_PROGRESS
→SUCCEED
/FAILED
.VideoStorage
for 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
.VideoModel
to call the video service API.IN_QUEUE
.VideoStorage
persists task metadata.VideoTimer
periodically polls for task status updates.SUCCEED
orFAILED
.Usage Example
Configuration Options
ai.video.timer.enabled
true
ai.video.timer.timeout
300000
(5 minutes)ai.video.timer.ttl
86400000
(24h)ai.video.timer.interval
30000
(30 seconds)Compatibility
This module aligns with Spring AI design principles and integrates seamlessly with existing Spring AI components:
Model
interface.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.