Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaoai-video
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚珂
yaoai-video
Commits
b29011ef
Commit
b29011ef
authored
Apr 28, 2026
by
yaoke.yk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(storyboard): harden prompt persistence and invalidation
parent
a19ab7b9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
12 deletions
+36
-12
StoryboardPipelineServiceImplTest.java
...eline/service/impl/StoryboardPipelineServiceImplTest.java
+0
-0
StoryboardPipelineServiceImpl.java
.../pipeline/service/impl/StoryboardPipelineServiceImpl.java
+36
-12
No files found.
yaoai-comic-studio/yaoai-bootstrap/src/test/java/com/yaoai/pipeline/service/impl/StoryboardPipelineServiceImplTest.java
View file @
b29011ef
This diff is collapsed.
Click to expand it.
yaoai-comic-studio/yaoai-pipeline/src/main/java/com/yaoai/pipeline/service/impl/StoryboardPipelineServiceImpl.java
View file @
b29011ef
...
@@ -23,6 +23,7 @@ import com.yaoai.pipeline.service.StoryboardPipelineService;
...
@@ -23,6 +23,7 @@ import com.yaoai.pipeline.service.StoryboardPipelineService;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
...
@@ -193,6 +194,7 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
...
@@ -193,6 +194,7 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
}
}
@Override
@Override
@Transactional
public
Storyboard
update
(
Long
id
,
Long
tenantId
,
Storyboard
patch
)
{
public
Storyboard
update
(
Long
id
,
Long
tenantId
,
Storyboard
patch
)
{
Storyboard
existing
=
storyboardMapper
.
selectById
(
id
);
Storyboard
existing
=
storyboardMapper
.
selectById
(
id
);
if
(
existing
==
null
||
!
tenantId
.
equals
(
existing
.
getTenantId
()))
{
if
(
existing
==
null
||
!
tenantId
.
equals
(
existing
.
getTenantId
()))
{
...
@@ -202,7 +204,10 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
...
@@ -202,7 +204,10 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
boolean
bodyFieldsChanged
=
hasStoryboardBodyChanges
(
existing
,
patch
);
boolean
bodyFieldsChanged
=
hasStoryboardBodyChanges
(
existing
,
patch
);
patch
.
setId
(
id
);
patch
.
setId
(
id
);
patch
.
setTenantId
(
tenantId
);
patch
.
setTenantId
(
tenantId
);
storyboardMapper
.
updateById
(
patch
);
int
updatedRows
=
storyboardMapper
.
updateById
(
patch
);
if
(
updatedRows
!=
1
)
{
throw
new
BizException
(
ErrorCode
.
INTERNAL_ERROR
,
"Failed to update storyboard"
);
}
if
(
bodyFieldsChanged
)
{
if
(
bodyFieldsChanged
)
{
clearVideoPrompt
(
id
,
tenantId
);
clearVideoPrompt
(
id
,
tenantId
);
}
}
...
@@ -226,6 +231,7 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
...
@@ -226,6 +231,7 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
}
}
@Override
@Override
@Transactional
public
String
generatePrompt
(
Long
storyboardId
,
Long
tenantId
)
{
public
String
generatePrompt
(
Long
storyboardId
,
Long
tenantId
)
{
Storyboard
storyboard
=
storyboardMapper
.
selectById
(
storyboardId
);
Storyboard
storyboard
=
storyboardMapper
.
selectById
(
storyboardId
);
if
(
storyboard
==
null
||
!
tenantId
.
equals
(
storyboard
.
getTenantId
()))
{
if
(
storyboard
==
null
||
!
tenantId
.
equals
(
storyboard
.
getTenantId
()))
{
...
@@ -271,7 +277,7 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
...
@@ -271,7 +277,7 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
userMsg
.
append
(
String
.
format
(
userMsg
.
append
(
String
.
format
(
"- @%s (%s): %s%n"
,
"- @%s (%s): %s%n"
,
nullSafe
(
scene
.
getName
()),
nullSafe
(
scene
.
getName
()),
"indoor"
.
equals
(
scene
.
getSceneType
())
?
"indoor"
:
"outdoor"
,
sceneTypeLabel
(
scene
.
getSceneType
())
,
nullSafe
(
scene
.
getDescription
())
nullSafe
(
scene
.
getDescription
())
));
));
}
}
...
@@ -331,11 +337,6 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
...
@@ -331,11 +337,6 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
String
prompt
=
llmService
.
chat
(
request
);
String
prompt
=
llmService
.
chat
(
request
);
Storyboard
promptUpdate
=
new
Storyboard
();
promptUpdate
.
setId
(
storyboard
.
getId
());
promptUpdate
.
setVideoPrompt
(
prompt
);
storyboardMapper
.
updateById
(
promptUpdate
);
billingService
.
charge
(
BillingChargeRequest
.
builder
()
billingService
.
charge
(
BillingChargeRequest
.
builder
()
.
tenantId
(
tenantId
)
.
tenantId
(
tenantId
)
.
userId
(
UserContext
.
require
())
.
userId
(
UserContext
.
require
())
...
@@ -348,6 +349,14 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
...
@@ -348,6 +349,14 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
.
unitCount
(
1
)
.
unitCount
(
1
)
.
refId
(
String
.
valueOf
(
storyboardId
))
.
refId
(
String
.
valueOf
(
storyboardId
))
.
build
());
.
build
());
Storyboard
promptUpdate
=
new
Storyboard
();
promptUpdate
.
setId
(
storyboard
.
getId
());
promptUpdate
.
setVideoPrompt
(
prompt
);
int
updatedRows
=
storyboardMapper
.
updateById
(
promptUpdate
);
if
(
updatedRows
!=
1
)
{
throw
new
BizException
(
ErrorCode
.
INTERNAL_ERROR
,
"Failed to persist storyboard prompt"
);
}
return
prompt
;
return
prompt
;
}
}
...
@@ -388,7 +397,7 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
...
@@ -388,7 +397,7 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
context
.
append
(
String
.
format
(
context
.
append
(
String
.
format
(
"- @%s (%s): %s%n"
,
"- @%s (%s): %s%n"
,
nullSafe
(
scene
.
getName
()),
nullSafe
(
scene
.
getName
()),
"indoor"
.
equals
(
scene
.
getSceneType
())
?
"indoor"
:
"outdoor"
,
sceneTypeLabel
(
scene
.
getSceneType
())
,
nullSafe
(
scene
.
getDescription
())
nullSafe
(
scene
.
getDescription
())
));
));
}
}
...
@@ -412,17 +421,19 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
...
@@ -412,17 +421,19 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
private
StoryboardRefs
splitStoryboardRefs
(
String
rawRefs
,
Set
<
String
>
sceneRefs
)
{
private
StoryboardRefs
splitStoryboardRefs
(
String
rawRefs
,
Set
<
String
>
sceneRefs
)
{
List
<
String
>
refs
=
parseRefs
(
rawRefs
);
List
<
String
>
refs
=
parseRefs
(
rawRefs
);
List
<
String
>
characterRefs
=
new
ArrayList
<>();
List
<
String
>
characterRefs
=
new
ArrayList
<>();
List
<
String
>
matchedSceneRefs
=
new
ArrayList
<>()
;
String
sceneRef
=
null
;
for
(
String
ref
:
refs
)
{
for
(
String
ref
:
refs
)
{
if
(
sceneRefs
.
contains
(
ref
))
{
if
(
sceneRefs
.
contains
(
ref
))
{
matchedSceneRefs
.
add
(
ref
);
if
(
sceneRef
==
null
)
{
sceneRef
=
ref
;
}
}
else
{
}
else
{
characterRefs
.
add
(
ref
);
characterRefs
.
add
(
ref
);
}
}
}
}
return
new
StoryboardRefs
(
joinRefs
(
characterRefs
),
joinRefs
(
matchedSceneRefs
)
);
return
new
StoryboardRefs
(
joinRefs
(
characterRefs
),
sceneRef
);
}
}
private
StoryboardRefs
promptRefsForCurrentShot
(
Storyboard
storyboard
,
List
<
Scene
>
projectScenes
)
{
private
StoryboardRefs
promptRefsForCurrentShot
(
Storyboard
storyboard
,
List
<
Scene
>
projectScenes
)
{
...
@@ -459,13 +470,16 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
...
@@ -459,13 +470,16 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
}
}
private
void
clearVideoPrompt
(
Long
storyboardId
,
Long
tenantId
)
{
private
void
clearVideoPrompt
(
Long
storyboardId
,
Long
tenantId
)
{
storyboardMapper
.
update
(
int
updatedRows
=
storyboardMapper
.
update
(
null
,
null
,
new
UpdateWrapper
<
Storyboard
>()
new
UpdateWrapper
<
Storyboard
>()
.
eq
(
"id"
,
storyboardId
)
.
eq
(
"id"
,
storyboardId
)
.
eq
(
"tenant_id"
,
tenantId
)
.
eq
(
"tenant_id"
,
tenantId
)
.
set
(
"video_prompt"
,
null
)
.
set
(
"video_prompt"
,
null
)
);
);
if
(
updatedRows
!=
1
)
{
throw
new
BizException
(
ErrorCode
.
INTERNAL_ERROR
,
"Failed to clear storyboard prompt"
);
}
}
}
private
boolean
hasStoryboardBodyChanges
(
Storyboard
existing
,
Storyboard
patch
)
{
private
boolean
hasStoryboardBodyChanges
(
Storyboard
existing
,
Storyboard
patch
)
{
...
@@ -508,6 +522,16 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
...
@@ -508,6 +522,16 @@ public class StoryboardPipelineServiceImpl implements StoryboardPipelineService
return
value
!=
null
?
value
:
""
;
return
value
!=
null
?
value
:
""
;
}
}
private
String
sceneTypeLabel
(
String
sceneType
)
{
if
(
"indoor"
.
equals
(
sceneType
))
{
return
"indoor"
;
}
if
(
"outdoor"
.
equals
(
sceneType
))
{
return
"outdoor"
;
}
return
""
;
}
private
record
StoryboardRefs
(
String
characters
,
String
sceneRef
)
{
private
record
StoryboardRefs
(
String
characters
,
String
sceneRef
)
{
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment