diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEdit.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEdit.g.cs index ba9a8e2f..ee10104e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEdit.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEdit.g.cs @@ -168,9 +168,94 @@ partial void ProcessCreateImageEditResponseContent( } var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.Image.ToString() ?? string.Empty), - name: "\"image\""); + if (request.Image.TryPickValue1(out var __valueImage1)) + { + + var __fileNameImage1 = "file.bin"; + var __contentImage1 = new global::System.Net.Http.ByteArrayContent(__valueImage1 ?? global::System.Array.Empty()); + __contentImage1.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameImage1 is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameImage1) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentImage1, + name: "\"image\"", + fileName: $"\"{__fileNameImage1}\""); + if (__contentImage1.Headers.ContentDisposition != null) + { + __contentImage1.Headers.ContentDisposition.FileNameStar = null; + } + } + else if (request.Image.TryPickValue2(out var __valueImage2)) + { + + for (var __iImage2 = 0; __iImage2 < (__valueImage2!).Count; __iImage2++) + { + + var __fileNameImage2Item = $"file{__iImage2}.bin"; + var __contentImage2Item = new global::System.Net.Http.ByteArrayContent((__valueImage2!)[__iImage2] ?? global::System.Array.Empty()); + __contentImage2Item.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameImage2Item is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameImage2Item) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentImage2Item, + name: "\"image\"", + fileName: $"\"{__fileNameImage2Item}\""); + if (__contentImage2Item.Headers.ContentDisposition != null) + { + __contentImage2Item.Headers.ContentDisposition.FileNameStar = null; + } + } + } __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEditAsStream.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEditAsStream.g.cs index 3da13183..93197ecd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEditAsStream.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEditAsStream.g.cs @@ -137,9 +137,94 @@ partial void ProcessCreateImageEditAsStreamResponse( } var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.Image.ToString() ?? string.Empty), - name: "\"image\""); + if (request.Image.TryPickValue1(out var __valueImage1)) + { + + var __fileNameImage1 = "file.bin"; + var __contentImage1 = new global::System.Net.Http.ByteArrayContent(__valueImage1 ?? global::System.Array.Empty()); + __contentImage1.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameImage1 is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameImage1) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentImage1, + name: "\"image\"", + fileName: $"\"{__fileNameImage1}\""); + if (__contentImage1.Headers.ContentDisposition != null) + { + __contentImage1.Headers.ContentDisposition.FileNameStar = null; + } + } + else if (request.Image.TryPickValue2(out var __valueImage2)) + { + + for (var __iImage2 = 0; __iImage2 < (__valueImage2!).Count; __iImage2++) + { + + var __fileNameImage2Item = $"file{__iImage2}.bin"; + var __contentImage2Item = new global::System.Net.Http.ByteArrayContent((__valueImage2!)[__iImage2] ?? global::System.Array.Empty()); + __contentImage2Item.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameImage2Item is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameImage2Item) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentImage2Item, + name: "\"image\"", + fileName: $"\"{__fileNameImage2Item}\""); + if (__contentImage2Item.Headers.ContentDisposition != null) + { + __contentImage2Item.Headers.ContentDisposition.FileNameStar = null; + } + } + } __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateContainerFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateContainerFile.g.cs index 1e22064c..a76faa60 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateContainerFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateContainerFile.g.cs @@ -114,7 +114,7 @@ partial void ProcessCreateContainerFileResponseContent( var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { @@ -151,12 +151,65 @@ partial void ProcessCreateContainerFileResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); + + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(containerId ?? string.Empty), + name: "\"container_id\""); + + if (request.FileId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.FileId ?? string.Empty), + name: "\"file_id\""); + + } + if (request.File != default) + { + + var __contentFile = new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty()); + __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Filename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentFile, + name: "\"file\"", + fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty); + if (__contentFile.Headers.ContentDisposition != null) + { + __contentFile.Headers.ContentDisposition.FileNameStar = null; + } + + } + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkill.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkill.g.cs index 5730686a..8429b430 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkill.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkill.g.cs @@ -141,9 +141,94 @@ partial void ProcessCreateSkillResponseContent( } var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.Files.ToString() ?? string.Empty), - name: "\"files\""); + if (request.Files.TryPickValue1(out var __valueFiles1)) + { + + for (var __iFiles1 = 0; __iFiles1 < (__valueFiles1!).Count; __iFiles1++) + { + + var __fileNameFiles1Item = $"file{__iFiles1}.bin"; + var __contentFiles1Item = new global::System.Net.Http.ByteArrayContent((__valueFiles1!)[__iFiles1] ?? global::System.Array.Empty()); + __contentFiles1Item.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameFiles1Item is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameFiles1Item) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentFiles1Item, + name: "\"files\"", + fileName: $"\"{__fileNameFiles1Item}\""); + if (__contentFiles1Item.Headers.ContentDisposition != null) + { + __contentFiles1Item.Headers.ContentDisposition.FileNameStar = null; + } + } + } + else if (request.Files.TryPickValue2(out var __valueFiles2)) + { + + var __fileNameFiles2 = "file.bin"; + var __contentFiles2 = new global::System.Net.Http.ByteArrayContent(__valueFiles2 ?? global::System.Array.Empty()); + __contentFiles2.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameFiles2 is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameFiles2) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentFiles2, + name: "\"files\"", + fileName: $"\"{__fileNameFiles2}\""); + if (__contentFiles2.Headers.ContentDisposition != null) + { + __contentFiles2.Headers.ContentDisposition.FileNameStar = null; + } + } __httpRequest.Content = __httpRequestContent; diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkillVersion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkillVersion.g.cs index 8c2fa44d..3184d0b6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkillVersion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkillVersion.g.cs @@ -156,10 +156,94 @@ partial void ProcessCreateSkillVersionResponseContent( __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(skillId ?? string.Empty), name: "\"skill_id\""); + if (request.Files.TryPickValue1(out var __valueFiles1)) + { - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.Files.ToString() ?? string.Empty), - name: "\"files\""); + for (var __iFiles1 = 0; __iFiles1 < (__valueFiles1!).Count; __iFiles1++) + { + + var __fileNameFiles1Item = $"file{__iFiles1}.bin"; + var __contentFiles1Item = new global::System.Net.Http.ByteArrayContent((__valueFiles1!)[__iFiles1] ?? global::System.Array.Empty()); + __contentFiles1Item.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameFiles1Item is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameFiles1Item) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentFiles1Item, + name: "\"files\"", + fileName: $"\"{__fileNameFiles1Item}\""); + if (__contentFiles1Item.Headers.ContentDisposition != null) + { + __contentFiles1Item.Headers.ContentDisposition.FileNameStar = null; + } + } + } + else if (request.Files.TryPickValue2(out var __valueFiles2)) + { + + var __fileNameFiles2 = "file.bin"; + var __contentFiles2 = new global::System.Net.Http.ByteArrayContent(__valueFiles2 ?? global::System.Array.Empty()); + __contentFiles2.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameFiles2 is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameFiles2) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentFiles2, + name: "\"files\"", + fileName: $"\"{__fileNameFiles2}\""); + if (__contentFiles2.Headers.ContentDisposition != null) + { + __contentFiles2.Headers.ContentDisposition.FileNameStar = null; + } + } if (request.Default != default) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideo.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideo.g.cs index a37fe5f9..ea3b0082 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideo.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideo.g.cs @@ -155,12 +155,59 @@ partial void ProcessCreateVideoResponseContent( if (request.InputReference != default) { + if ((request.InputReference).GetValueOrDefault().TryPickValue1(out var __valueInputReference1)) + { - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.InputReference.ToString() ?? string.Empty), - name: "\"input_reference\""); + var __fileNameInputReference1 = "file.bin"; + var __contentInputReference1 = new global::System.Net.Http.ByteArrayContent(__valueInputReference1 ?? global::System.Array.Empty()); + __contentInputReference1.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameInputReference1 is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameInputReference1) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentInputReference1, + name: "\"input_reference\"", + fileName: $"\"{__fileNameInputReference1}\""); + if (__contentInputReference1.Headers.ContentDisposition != null) + { + __contentInputReference1.Headers.ContentDisposition.FileNameStar = null; + } + } + else if ((request.InputReference).GetValueOrDefault().TryPickValue2(out var __valueInputReference2)) + { + var __contentInputReference2 = new global::System.Net.Http.StringContent((__valueInputReference2!).ToJson(JsonSerializerContext)); + __contentInputReference2.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); + __httpRequestContent.Add( + content: __contentInputReference2, + name: "\"input_reference\""); + } } + if (request.Seconds != default) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoEdit.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoEdit.g.cs index 8f5b85ee..0d34efe9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoEdit.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoEdit.g.cs @@ -141,9 +141,57 @@ partial void ProcessCreateVideoEditResponseContent( } var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.Video.ToString() ?? string.Empty), - name: "\"video\""); + if (request.Video.TryPickValue1(out var __valueVideo1)) + { + + var __fileNameVideo1 = "file.bin"; + var __contentVideo1 = new global::System.Net.Http.ByteArrayContent(__valueVideo1 ?? global::System.Array.Empty()); + __contentVideo1.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameVideo1 is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameVideo1) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentVideo1, + name: "\"video\"", + fileName: $"\"{__fileNameVideo1}\""); + if (__contentVideo1.Headers.ContentDisposition != null) + { + __contentVideo1.Headers.ContentDisposition.FileNameStar = null; + } + } + else if (request.Video.TryPickValue2(out var __valueVideo2)) + { + + var __contentVideo2 = new global::System.Net.Http.StringContent((__valueVideo2!).ToJson(JsonSerializerContext)); + __contentVideo2.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); + __httpRequestContent.Add( + content: __contentVideo2, + name: "\"video\""); + } __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoExtend.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoExtend.g.cs index d89cfeba..19ca4344 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoExtend.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoExtend.g.cs @@ -141,9 +141,57 @@ partial void ProcessCreateVideoExtendResponseContent( } var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.Video.ToString() ?? string.Empty), - name: "\"video\""); + if (request.Video.TryPickValue1(out var __valueVideo1)) + { + + var __contentVideo1 = new global::System.Net.Http.StringContent((__valueVideo1!).ToJson(JsonSerializerContext)); + __contentVideo1.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); + __httpRequestContent.Add( + content: __contentVideo1, + name: "\"video\""); + } + else if (request.Video.TryPickValue2(out var __valueVideo2)) + { + + var __fileNameVideo2 = "file.bin"; + var __contentVideo2 = new global::System.Net.Http.ByteArrayContent(__valueVideo2 ?? global::System.Array.Empty()); + __contentVideo2.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameVideo2 is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameVideo2) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentVideo2, + name: "\"video\"", + fileName: $"\"{__fileNameVideo2}\""); + if (__contentVideo2.Headers.ContentDisposition != null) + { + __contentVideo2.Headers.ContentDisposition.FileNameStar = null; + } + } __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),