From 76bb1fa40f65e285eaead708d1202e46a8ae8f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Sun, 30 Jun 2024 14:16:16 +0200 Subject: [PATCH] Update Dependencies, add GPT4o --- DataAccess/DataAccess.csproj | 6 +-- KIKunstKirstenKlöckner/Data/ChatGPT.cs | 1 + KIKunstKirstenKlöckner/Data/ImageGenerator.cs | 2 +- .../KIKunstKirstenKlöckner.csproj | 8 +-- KIKunstKirstenKlöckner/Pages/AiArt.razor | 49 +++++++++++++++---- 5 files changed, 49 insertions(+), 17 deletions(-) diff --git a/DataAccess/DataAccess.csproj b/DataAccess/DataAccess.csproj index 810ea4c..0f2cd0f 100644 --- a/DataAccess/DataAccess.csproj +++ b/DataAccess/DataAccess.csproj @@ -7,9 +7,9 @@ - - - + + + diff --git a/KIKunstKirstenKlöckner/Data/ChatGPT.cs b/KIKunstKirstenKlöckner/Data/ChatGPT.cs index 229ed38..263ca13 100644 --- a/KIKunstKirstenKlöckner/Data/ChatGPT.cs +++ b/KIKunstKirstenKlöckner/Data/ChatGPT.cs @@ -5,4 +5,5 @@ namespace KIKunstKirstenKlöckner.Data; public class ChatGPT { public static Model GPT4Turbo => new Model("gpt-4-turbo") { OwnedBy = "openai" }; + public static Model GPT4o => new Model("gpt-4o") { OwnedBy = "openai" }; } diff --git a/KIKunstKirstenKlöckner/Data/ImageGenerator.cs b/KIKunstKirstenKlöckner/Data/ImageGenerator.cs index 69c1dd6..436d5fd 100644 --- a/KIKunstKirstenKlöckner/Data/ImageGenerator.cs +++ b/KIKunstKirstenKlöckner/Data/ImageGenerator.cs @@ -1,7 +1,7 @@ using DataAccess.Data; using DataAccess.Models; -using Radzen; using System.Diagnostics; +using SixLabors.ImageSharp; namespace KIKunstKirstenKlöckner.Data; diff --git a/KIKunstKirstenKlöckner/KIKunstKirstenKlöckner.csproj b/KIKunstKirstenKlöckner/KIKunstKirstenKlöckner.csproj index c189d54..5ad2ae3 100644 --- a/KIKunstKirstenKlöckner/KIKunstKirstenKlöckner.csproj +++ b/KIKunstKirstenKlöckner/KIKunstKirstenKlöckner.csproj @@ -9,13 +9,13 @@ - - - + + + - + diff --git a/KIKunstKirstenKlöckner/Pages/AiArt.razor b/KIKunstKirstenKlöckner/Pages/AiArt.razor index c0c570d..6ecde5f 100644 --- a/KIKunstKirstenKlöckner/Pages/AiArt.razor +++ b/KIKunstKirstenKlöckner/Pages/AiArt.razor @@ -141,15 +141,28 @@ - - - - + + + + + + + + + + @* *@ - + @@ -288,10 +301,17 @@ IEnumerable? _allBildInfos; + enum GptModel + { + Gpt3_5_turbo, + Gpt4_turbo, + Gpt4o + } + /// - /// Wenn wird GPT4 verwendet um die Idee zu interpretieren. + /// Das ChatGPT Model, das zur Erzeugung der Idee und Bild-Promts verwendet wird. /// - private bool _useGpt4Turbo; + private GptModel _usedGptModel = GptModel.Gpt3_5_turbo; private int maxAddons = 2; private int amountOfAddons = 0; // wird später geändert @@ -331,6 +351,11 @@ , new() { Position = TooltipPosition.Bottom, Duration = null}); + void ShowTooltip(string text, ElementReference elementReference) => TooltipService.Open(elementReference, ds => + @
@text
+ , + new() { Position = TooltipPosition.Bottom, Duration = null}); + private string _imageIdea = ""; private float _temperature = 0.9f; @@ -408,7 +433,13 @@ ChatRequest chatRequest = new ChatRequest { Temperature = _temperature, - Model = _useGpt4Turbo ? ChatGPT.GPT4Turbo : Model.ChatGPTTurbo + Model = _usedGptModel switch + { + GptModel.Gpt3_5_turbo => Model.ChatGPTTurbo, + GptModel.Gpt4_turbo => ChatGPT.GPT4Turbo, + GptModel.Gpt4o => ChatGPT.GPT4o, + _ => throw new ArgumentOutOfRangeException() + } }; _conversation = _openAiApi.Chat.CreateConversation(chatRequest);