diff --git a/Apps.OpenAI/Actions/EditActions.cs b/Apps.OpenAI/Actions/EditActions.cs index f6dfbb0..df05d07 100644 --- a/Apps.OpenAI/Actions/EditActions.cs +++ b/Apps.OpenAI/Actions/EditActions.cs @@ -112,9 +112,13 @@ async Task> BatchTranslate(IEnumerable<(Unit Unit catch (Exception ex) when (neverFail) { errors.Add($"Error in batch {batchCounter} (size: {batchSize}): {ex.Message}"); - } + } - return allResults; + return idSegments.Select(idPair => + { + var updatedTranslation = allResults.FirstOrDefault(x => x.TranslationId == idPair.Key); + return updatedTranslation ?? new TranslationEntity { TranslationId = idPair.Key, TranslatedText = idPair.Value.GetTarget() }; + }); } var units = content.GetUnits(); diff --git a/Apps.OpenAI/Apps.OpenAI.csproj b/Apps.OpenAI/Apps.OpenAI.csproj index 822a1c1..c07bb24 100644 --- a/Apps.OpenAI/Apps.OpenAI.csproj +++ b/Apps.OpenAI/Apps.OpenAI.csproj @@ -4,7 +4,7 @@ net8.0 OpenAI Creating safe artificial general intelligence that benefits all of humanity - 2.8.19 + 2.8.20 Apps.OpenAI