Skip to content

Commit d0e5ef1

Browse files
committed
Refactor file handling and remove unused image size tables
Refactored the ToOpenAI method in StepContent.cs to use CreateOpenAIImagePart for DBMessageContentType.FileId handling. Renamed CreateOpenAIPart to CreateOpenAIImagePart in FileUrlProvider.cs for clearer intent and adjusted related logic. Removed GeneratedImageSize and KnownImageSize classes, along with their associated database mappings, as they are no longer in use.
1 parent 507a7d9 commit d0e5ef1

4 files changed

Lines changed: 2 additions & 44 deletions

File tree

src/BE/DB/Extensions/StepContent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public async Task<ChatMessageContentPart> ToOpenAI(FileUrlProvider fup, Cancella
1616
return (DBMessageContentType)ContentTypeId switch
1717
{
1818
DBMessageContentType.Text => ChatMessageContentPart.CreateTextPart(StepContentText!.Content),
19-
DBMessageContentType.FileId => await fup.CreateOpenAIPart(StepContentFile, cancellationToken),
19+
DBMessageContentType.FileId => await fup.CreateOpenAIImagePart(StepContentFile, cancellationToken),
2020
DBMessageContentType.Error => ChatMessageContentPart.CreateTextPart(StepContentText!.Content),
2121
_ => throw new NotImplementedException()
2222
};

src/BE/DB/GeneratedImageSize.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/BE/DB/KnownImageSize.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/BE/Services/FileServices/FileUrlProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Chats.BE.Services.FileServices;
99

1010
public class FileUrlProvider(ChatsDB db, FileServiceFactory fileServiceFactory, IUrlEncryptionService urlEncryptionService)
1111
{
12-
public async Task<ChatMessageContentPart> CreateOpenAIPart(StepContentFile? mcFile, CancellationToken cancellationToken)
12+
public async Task<ChatMessageContentPart> CreateOpenAIImagePart(StepContentFile? mcFile, CancellationToken cancellationToken)
1313
{
1414
if (mcFile == null)
1515
{

0 commit comments

Comments
 (0)