Update Dependencies, add GPT4o
This commit is contained in:
parent
0f738b2264
commit
76bb1fa40f
|
@ -7,9 +7,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapper" Version="2.1.4" />
|
<PackageReference Include="Dapper" Version="2.1.35" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -5,4 +5,5 @@ namespace KIKunstKirstenKlöckner.Data;
|
||||||
public class ChatGPT
|
public class ChatGPT
|
||||||
{
|
{
|
||||||
public static Model GPT4Turbo => new Model("gpt-4-turbo") { OwnedBy = "openai" };
|
public static Model GPT4Turbo => new Model("gpt-4-turbo") { OwnedBy = "openai" };
|
||||||
|
public static Model GPT4o => new Model("gpt-4o") { OwnedBy = "openai" };
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using DataAccess.Data;
|
using DataAccess.Data;
|
||||||
using DataAccess.Models;
|
using DataAccess.Models;
|
||||||
using Radzen;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using SixLabors.ImageSharp;
|
||||||
|
|
||||||
namespace KIKunstKirstenKlöckner.Data;
|
namespace KIKunstKirstenKlöckner.Data;
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||||
<PackageReference Include="OpenAI" Version="1.7.2" />
|
<PackageReference Include="OpenAI" Version="1.11.0" />
|
||||||
<PackageReference Include="Radzen.Blazor" Version="4.14.4" />
|
<PackageReference Include="Radzen.Blazor" Version="4.33.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -141,15 +141,28 @@
|
||||||
<RadzenNumeric ShowUpDown = "false" TValue = "int?" @bind-Value=@_imageHeight />
|
<RadzenNumeric ShowUpDown = "false" TValue = "int?" @bind-Value=@_imageHeight />
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
<RadzenStack Orientation="Orientation.Horizontal"
|
<RadzenRadioButtonList @bind-Value=@_usedGptModel TValue="GptModel" class="mb-5">
|
||||||
AlignItems="AlignItems.Center" Wrap="FlexWrap.Wrap">
|
<Items>
|
||||||
<RadzenCheckBox @bind-Value=@_useGpt4Turbo Name="UseGPT4"/>
|
<RadzenRadioButtonListItem Text="GPT-3.5 Turbo" Value="GptModel.Gpt3_5_turbo"
|
||||||
<RadzenLabel Text="Verwende GPT 4 Turbo" Component="UseGPT4" Style="margin-left: 8px; vertical-align: middle;" />
|
MouseEnter="@(args => ShowTooltip("Schnell aber nicht sonderlich clever.", args))"
|
||||||
</RadzenStack>
|
MouseLeave="TooltipService.Close">
|
||||||
|
</RadzenRadioButtonListItem>
|
||||||
|
<RadzenRadioButtonListItem Text="GPT-4 Turbo" Value="GptModel.Gpt4_turbo"
|
||||||
|
MouseEnter="@(args => ShowTooltip("Etwas langsamer, aber recht klug.", args))"
|
||||||
|
MouseLeave="TooltipService.Close">
|
||||||
|
</RadzenRadioButtonListItem>
|
||||||
|
<RadzenRadioButtonListItem Text="GPT-4o" Value="GptModel.Gpt4o"
|
||||||
|
MouseEnter="@(args => ShowTooltip("Schnell, gut und günstig. Warum gibt es überhaupt eine Auswahlmöglichkeit?", args))"
|
||||||
|
MouseLeave="TooltipService.Close">
|
||||||
|
</RadzenRadioButtonListItem>
|
||||||
|
</Items>
|
||||||
|
</RadzenRadioButtonList>
|
||||||
@* <RadzenRadioButtonList Data="@_imageModels" @bind-Value=@_selectedImageModel TValue="ModelInfo" TextProperty="Name" class="mb-5"> *@
|
@* <RadzenRadioButtonList Data="@_imageModels" @bind-Value=@_selectedImageModel TValue="ModelInfo" TextProperty="Name" class="mb-5"> *@
|
||||||
<RadzenRadioButtonList Data="@_imageModels" @bind-Value=@_selectedImageModel TValue="ModelInfo" TextProperty="Name" ValueProperty="" class="mb-5">
|
<RadzenRadioButtonList Data="@_imageModels" @bind-Value=@_selectedImageModel TValue="ModelInfo" TextProperty="Name" ValueProperty="" class="mb-5">
|
||||||
<Items>
|
<Items>
|
||||||
<RadzenRadioButtonListItem Text="Zufällig" Value="@null" TValue="ModelInfo"/>
|
<RadzenRadioButtonListItem Text="Zufällig" Value="@null" TValue="ModelInfo"
|
||||||
|
MouseEnter="@(args => ShowTooltip("Für jedes Bild wird zufällig ein Generator ausgewählt.", args))"
|
||||||
|
MouseLeave="TooltipService.Close"/>
|
||||||
</Items>
|
</Items>
|
||||||
</RadzenRadioButtonList>
|
</RadzenRadioButtonList>
|
||||||
</RadzenCard>
|
</RadzenCard>
|
||||||
|
@ -288,10 +301,17 @@
|
||||||
|
|
||||||
IEnumerable<BildInfoModel>? _allBildInfos;
|
IEnumerable<BildInfoModel>? _allBildInfos;
|
||||||
|
|
||||||
|
enum GptModel
|
||||||
|
{
|
||||||
|
Gpt3_5_turbo,
|
||||||
|
Gpt4_turbo,
|
||||||
|
Gpt4o
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wenn <see langword="true"/> wird GPT4 verwendet um die Idee zu interpretieren.
|
/// Das ChatGPT Model, das zur Erzeugung der Idee und Bild-Promts verwendet wird.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool _useGpt4Turbo;
|
private GptModel _usedGptModel = GptModel.Gpt3_5_turbo;
|
||||||
|
|
||||||
private int maxAddons = 2;
|
private int maxAddons = 2;
|
||||||
private int amountOfAddons = 0; // wird später geändert
|
private int amountOfAddons = 0; // wird später geändert
|
||||||
|
@ -331,6 +351,11 @@
|
||||||
,
|
,
|
||||||
new() { Position = TooltipPosition.Bottom, Duration = null});
|
new() { Position = TooltipPosition.Bottom, Duration = null});
|
||||||
|
|
||||||
|
void ShowTooltip(string text, ElementReference elementReference) => TooltipService.Open(elementReference, ds =>
|
||||||
|
@<div>@text</div>
|
||||||
|
,
|
||||||
|
new() { Position = TooltipPosition.Bottom, Duration = null});
|
||||||
|
|
||||||
private string _imageIdea = "";
|
private string _imageIdea = "";
|
||||||
|
|
||||||
private float _temperature = 0.9f;
|
private float _temperature = 0.9f;
|
||||||
|
@ -408,7 +433,13 @@
|
||||||
ChatRequest chatRequest = new ChatRequest
|
ChatRequest chatRequest = new ChatRequest
|
||||||
{
|
{
|
||||||
Temperature = _temperature,
|
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);
|
_conversation = _openAiApi.Chat.CreateConversation(chatRequest);
|
||||||
|
|
Loading…
Reference in New Issue