File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1148,14 +1148,24 @@ public async Task<object> Post(CompleteArtifactClassificationTask request)
11481148
11491149 if ( request is { Objects : not null , Tags : not null , Ratings : not null } && artifact . Type == AssetType . Image )
11501150 {
1151- var prompt = await db . SqlScalarAsync < string ? > (
1152- db . From < WorkflowGeneration > ( )
1153- . Where ( x => x . Id == artifact . GenerationId )
1154- . Select ( x => x . Description ) ) ;
1151+ var gen = await db . AssertGenerationAsync ( artifact . GenerationId ) ;
1152+ var genResult = gen . Result ? . Assets ? . Find ( x => x . Url == artifact . Url ) ;
1153+ var prompt = gen . Args ? . GetValueOrDefault ( "positivePrompt" ) as string ?? gen . Description ;
11551154
11561155 artifact . Ratings = request . Ratings ;
11571156 var minRating = appData . GetMinRatingForPrompt ( prompt ) ;
11581157 artifact . Rating = artifact . ToAssetRating ( minRating ) ;
1158+
1159+ if ( genResult != null )
1160+ {
1161+ genResult . Rating = artifact . Rating ;
1162+ await db . UpdateOnlyAsync ( ( ) => new WorkflowGeneration
1163+ {
1164+ Result = gen . Result ,
1165+ ModifiedBy = userId ,
1166+ ModifiedDate = DateTime . UtcNow ,
1167+ } , where : x => x . Id == artifact . GenerationId ) ;
1168+ }
11591169 }
11601170 if ( artifact . Type == AssetType . Audio )
11611171 {
You can’t perform that action at this time.
0 commit comments