diff --git a/Directory.Build.props b/Directory.Build.props
index db5a05b8..f5625664 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -10,7 +10,7 @@
latest
- latest
+ preview
11.2.0
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 2f50e9fc..14f8cd9e 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -11,7 +11,7 @@ resources:
variables:
BuildConfiguration: 'Release'
BuildPlatform: 'Any CPU'
- PublishFramework: 'net8.0'
+ PublishFramework: 'net9.0'
PublishProject: 'ChatGPT.UI.Desktop'
PublishRuntime: ''
Workloads: 'wasm-tools wasm-experimental android'
diff --git a/build/build/_build.csproj b/build/build/_build.csproj
index 5e6ba1f1..bc8d4488 100644
--- a/build/build/_build.csproj
+++ b/build/build/_build.csproj
@@ -2,7 +2,7 @@
Exe
- net8.0
+ net9.0
false
False
CS0649;CS0169
@@ -12,6 +12,7 @@
+
diff --git a/global.json b/global.json
index 78656299..6f4a5233 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "8.0.100",
+ "version": "9.0.100",
"rollForward": "latestMinor",
"allowPrerelease": true
}
diff --git a/samples/ChatGPT.CLI.Chaining/ChatGPT.CLI.Chaining.csproj b/samples/ChatGPT.CLI.Chaining/ChatGPT.CLI.Chaining.csproj
index 38a40c5b..a618e5c3 100644
--- a/samples/ChatGPT.CLI.Chaining/ChatGPT.CLI.Chaining.csproj
+++ b/samples/ChatGPT.CLI.Chaining/ChatGPT.CLI.Chaining.csproj
@@ -1,7 +1,7 @@
Exe
- net8.0
+ net9.0
win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64
enable
enable
diff --git a/samples/ChatGPT.CLI.FunctionCalling/ChatGPT.CLI.FunctionCalling.csproj b/samples/ChatGPT.CLI.FunctionCalling/ChatGPT.CLI.FunctionCalling.csproj
index 38a40c5b..a618e5c3 100644
--- a/samples/ChatGPT.CLI.FunctionCalling/ChatGPT.CLI.FunctionCalling.csproj
+++ b/samples/ChatGPT.CLI.FunctionCalling/ChatGPT.CLI.FunctionCalling.csproj
@@ -1,7 +1,7 @@
Exe
- net8.0
+ net9.0
win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64
enable
enable
diff --git a/samples/ChatGPT.CLI.Repl/ChatGPT.CLI.Repl.csproj b/samples/ChatGPT.CLI.Repl/ChatGPT.CLI.Repl.csproj
index 38a40c5b..a618e5c3 100644
--- a/samples/ChatGPT.CLI.Repl/ChatGPT.CLI.Repl.csproj
+++ b/samples/ChatGPT.CLI.Repl/ChatGPT.CLI.Repl.csproj
@@ -1,7 +1,7 @@
Exe
- net8.0
+ net9.0
win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64
enable
enable
diff --git a/samples/ChatGPT.UI.Designer/ChatGPT.UI.Designer.csproj b/samples/ChatGPT.UI.Designer/ChatGPT.UI.Designer.csproj
index e0e406f6..1c14c368 100644
--- a/samples/ChatGPT.UI.Designer/ChatGPT.UI.Designer.csproj
+++ b/samples/ChatGPT.UI.Designer/ChatGPT.UI.Designer.csproj
@@ -6,7 +6,7 @@
WinExe
- net8.0
+ net9.0
enable
full
true
diff --git a/samples/ChatGPT.UI.Game/ChatGPT.UI.Game.csproj b/samples/ChatGPT.UI.Game/ChatGPT.UI.Game.csproj
index e0e406f6..1c14c368 100644
--- a/samples/ChatGPT.UI.Game/ChatGPT.UI.Game.csproj
+++ b/samples/ChatGPT.UI.Game/ChatGPT.UI.Game.csproj
@@ -6,7 +6,7 @@
WinExe
- net8.0
+ net9.0
enable
full
true
diff --git a/src/ChatGPT.CLI/ChatGPT.CLI.csproj b/src/ChatGPT.CLI/ChatGPT.CLI.csproj
index ed795ad0..a0e15309 100644
--- a/src/ChatGPT.CLI/ChatGPT.CLI.csproj
+++ b/src/ChatGPT.CLI/ChatGPT.CLI.csproj
@@ -1,7 +1,7 @@
Exe
- net8.0
+ net9.0
win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64
enable
enable
diff --git a/src/ChatGPT.Core/ChatGPT.Core.csproj b/src/ChatGPT.Core/ChatGPT.Core.csproj
index 81107250..dc6b4bec 100644
--- a/src/ChatGPT.Core/ChatGPT.Core.csproj
+++ b/src/ChatGPT.Core/ChatGPT.Core.csproj
@@ -1,11 +1,14 @@
Library
- net8.0;net462
+ net9.0;net462
enable
True
ChatGPT
+
+ true
+
true
..\..\ChatGPT.snk
@@ -18,6 +21,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/src/ChatGPT.Core/ViewModels/Chat/ChatFunctionCallViewModel.cs b/src/ChatGPT.Core/ViewModels/Chat/ChatFunctionCallViewModel.cs
index 69438586..8f8f30b5 100644
--- a/src/ChatGPT.Core/ViewModels/Chat/ChatFunctionCallViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Chat/ChatFunctionCallViewModel.cs
@@ -1,12 +1,9 @@
using System.Text.Json.Serialization;
-using CommunityToolkit.Mvvm.ComponentModel;
namespace ChatGPT.ViewModels.Chat;
-public class ChatFunctionCallViewModel : ObservableObject
+public partial class ChatFunctionCallViewModel : ViewModelBase
{
- private string? _name;
-
[JsonConstructor]
public ChatFunctionCallViewModel()
{
@@ -19,11 +16,7 @@ public ChatFunctionCallViewModel(string name)
}
[JsonPropertyName("name")]
- public string? Name
- {
- get => _name;
- set => SetProperty(ref _name, value);
- }
+ public partial string? Name { get; set; }
public ChatFunctionCallViewModel Copy()
{
diff --git a/src/ChatGPT.Core/ViewModels/Chat/ChatFunctionViewModel.cs b/src/ChatGPT.Core/ViewModels/Chat/ChatFunctionViewModel.cs
index 7066046a..68df5857 100644
--- a/src/ChatGPT.Core/ViewModels/Chat/ChatFunctionViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Chat/ChatFunctionViewModel.cs
@@ -1,14 +1,9 @@
using System.Text.Json.Serialization;
-using CommunityToolkit.Mvvm.ComponentModel;
namespace ChatGPT.ViewModels.Chat;
-public class ChatFunctionViewModel : ObservableObject
+public partial class ChatFunctionViewModel : ViewModelBase
{
- private string? _name;
- private string? _description;
- private object? _parameters;
-
[JsonConstructor]
public ChatFunctionViewModel()
{
@@ -30,25 +25,13 @@ public ChatFunctionViewModel(string name, string description, object parameters)
}
[JsonPropertyName("name")]
- public string? Name
- {
- get => _name;
- set => SetProperty(ref _name, value);
- }
+ public partial string? Name { get; set; }
[JsonPropertyName("description")]
- public string? Description
- {
- get => _description;
- set => SetProperty(ref _description, value);
- }
+ public partial string? Description { get; set; }
[JsonPropertyName("parameters")]
- public object? Parameters
- {
- get => _parameters;
- set => SetProperty(ref _parameters, value);
- }
+ public partial object? Parameters { get; set; }
public ChatFunctionViewModel Copy()
{
diff --git a/src/ChatGPT.Core/ViewModels/Chat/ChatMessageFunctionCallViewModel.cs b/src/ChatGPT.Core/ViewModels/Chat/ChatMessageFunctionCallViewModel.cs
index 6ef78675..3b904083 100644
--- a/src/ChatGPT.Core/ViewModels/Chat/ChatMessageFunctionCallViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Chat/ChatMessageFunctionCallViewModel.cs
@@ -1,15 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
-using CommunityToolkit.Mvvm.ComponentModel;
namespace ChatGPT.ViewModels.Chat;
-public class ChatMessageFunctionCallViewModel : ObservableObject
+public partial class ChatMessageFunctionCallViewModel : ViewModelBase
{
- private string? _name;
- private Dictionary? _arguments;
-
[JsonConstructor]
public ChatMessageFunctionCallViewModel()
{
@@ -23,18 +19,10 @@ public ChatMessageFunctionCallViewModel(string role, Dictionary
}
[JsonPropertyName("name")]
- public string? Name
- {
- get => _name;
- set => SetProperty(ref _name, value);
- }
+ public partial string? Name { get; set; }
[JsonPropertyName("arguments")]
- public Dictionary? Arguments
- {
- get => _arguments;
- set => SetProperty(ref _arguments, value);
- }
+ public partial Dictionary? Arguments { get; set; }
public ChatMessageFunctionCallViewModel Copy()
{
diff --git a/src/ChatGPT.Core/ViewModels/Chat/ChatMessageViewModel.cs b/src/ChatGPT.Core/ViewModels/Chat/ChatMessageViewModel.cs
index 130ee0f0..bcd94285 100644
--- a/src/ChatGPT.Core/ViewModels/Chat/ChatMessageViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Chat/ChatMessageViewModel.cs
@@ -2,23 +2,12 @@
using System.IO;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
-using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace ChatGPT.ViewModels.Chat;
-public class ChatMessageViewModel : ObservableObject
+public partial class ChatMessageViewModel : ViewModelBase
{
- private string? _role;
- private string? _message;
- private string? _name;
- private ChatMessageFunctionCallViewModel? _functionCall;
- private string? _format;
- private bool _isSent;
- private bool _isAwaiting;
- private bool _isError;
- private bool _canRemove;
- private bool _isEditing;
private Func? _send;
private Func? _copy;
private Action? _remove;
@@ -73,83 +62,43 @@ public ChatMessageViewModel(string role, string? message, string name, ChatMessa
/// The role of the messages author. One of system, user, assistant, or function.
///
[JsonPropertyName("role")]
- public string? Role
- {
- get => _role;
- set => SetProperty(ref _role, value);
- }
+ public partial string? Role { get; set; }
///
/// The contents of the message. content is required for all messages, and may be null for assistant messages with function calls.
///
[JsonPropertyName("message")]
- public string? Message
- {
- get => _message;
- set => SetProperty(ref _message, value);
- }
+ public partial string? Message { get; set; }
///
/// The name of the author of this message. name is required if role is function, and it should be the name of the function whose response is in the content. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.
///
[JsonPropertyName("name")]
- public string? Name
- {
- get => _name;
- set => SetProperty(ref _name, value);
- }
+ public partial string? Name { get; set; }
///
/// The name and arguments of a function that should be called, as generated by the model.
///
[JsonPropertyName("function_call")]
- public ChatMessageFunctionCallViewModel? FunctionCall
- {
- get => _functionCall;
- set => SetProperty(ref _functionCall, value);
- }
+ public partial ChatMessageFunctionCallViewModel? FunctionCall { get; set; }
[JsonPropertyName("format")]
- public string? Format
- {
- get => _format;
- set => SetProperty(ref _format, value);
- }
+ public partial string? Format { get; set; }
[JsonPropertyName("isSent")]
- public bool IsSent
- {
- get => _isSent;
- set => SetProperty(ref _isSent, value);
- }
+ public partial bool IsSent { get; set; }
[JsonPropertyName("isAwaiting")]
- public bool IsAwaiting
- {
- get => _isAwaiting;
- set => SetProperty(ref _isAwaiting, value);
- }
+ public partial bool IsAwaiting { get; set; }
[JsonPropertyName("isError")]
- public bool IsError
- {
- get => _isError;
- set => SetProperty(ref _isError, value);
- }
+ public partial bool IsError { get; set; }
[JsonPropertyName("canRemove")]
- public bool CanRemove
- {
- get => _canRemove;
- set => SetProperty(ref _canRemove, value);
- }
+ public partial bool CanRemove { get; set; }
[JsonIgnore]
- public bool IsEditing
- {
- get => _isEditing;
- set => SetProperty(ref _isEditing, value);
- }
+ public partial bool IsEditing { get; set; }
[JsonIgnore]
public IAsyncRelayCommand AddCommand { get; }
diff --git a/src/ChatGPT.Core/ViewModels/Chat/ChatResultViewModel.cs b/src/ChatGPT.Core/ViewModels/Chat/ChatResultViewModel.cs
index 829e71c4..d9467248 100644
--- a/src/ChatGPT.Core/ViewModels/Chat/ChatResultViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Chat/ChatResultViewModel.cs
@@ -1,32 +1,15 @@
using System.Text.Json.Serialization;
-using CommunityToolkit.Mvvm.ComponentModel;
namespace ChatGPT.ViewModels.Chat;
-public class ChatResultViewModel : ObservableObject
+public partial class ChatResultViewModel : ViewModelBase
{
- private string? _message;
- private bool _isError;
- private ChatMessageFunctionCallViewModel? _functionCall;
-
[JsonPropertyName("name")]
- public string? Message
- {
- get => _message;
- set => SetProperty(ref _message, value);
- }
+ public partial string? Message { get; set; }
[JsonPropertyName("isError")]
- public bool IsError
- {
- get => _isError;
- set => SetProperty(ref _isError, value);
- }
+ public partial bool IsError { get; set; }
[JsonPropertyName("function_call")]
- public ChatMessageFunctionCallViewModel? FunctionCall
- {
- get => _functionCall;
- set => SetProperty(ref _functionCall, value);
- }
+ public partial ChatMessageFunctionCallViewModel? FunctionCall { get; set; }
}
diff --git a/src/ChatGPT.Core/ViewModels/Chat/ChatSettingsViewModel.cs b/src/ChatGPT.Core/ViewModels/Chat/ChatSettingsViewModel.cs
index c3bfb28a..62d7d4bb 100644
--- a/src/ChatGPT.Core/ViewModels/Chat/ChatSettingsViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Chat/ChatSettingsViewModel.cs
@@ -1,23 +1,9 @@
using System.Text.Json.Serialization;
-using CommunityToolkit.Mvvm.ComponentModel;
namespace ChatGPT.ViewModels.Chat;
-public partial class ChatSettingsViewModel : ObservableObject
+public partial class ChatSettingsViewModel : ViewModelBase
{
- private object? _functions;
- private object? _functionCall;
- private decimal _temperature;
- private decimal _topP;
- private decimal _presencePenalty;
- private decimal _frequencyPenalty;
- private int _maxTokens;
- private string? _apiKey;
- private string? _model;
- private string? _directions;
- private string? _format;
- private string? _apiUrl;
-
[JsonConstructor]
public ChatSettingsViewModel()
{
@@ -38,21 +24,13 @@ public ChatSettingsViewModel()
/// A list of functions the model may generate JSON inputs for.
///
[JsonPropertyName("functions")]
- public object? Functions
- {
- get => _functions;
- set => SetProperty(ref _functions, value);
- }
+ public partial object? Functions { get; set; }
///
/// Controls how the model responds to function calls. "none" means the model does not call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. Specifying a particular function via {"name":\ "my_function"} forces the model to call that function. "none" is the default when no functions are present. "auto" is the default if functions are present.
///
[JsonPropertyName("function_call")]
- public object? FunctionCall
- {
- get => _functionCall;
- set => SetProperty(ref _functionCall, value);
- }
+ public partial object? FunctionCall { get; set; }
///
/// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
@@ -61,11 +39,7 @@ public object? FunctionCall
/// We generally recommend altering this or top_p but not both.
///
[JsonPropertyName("temperature")]
- public decimal Temperature
- {
- get => _temperature;
- set => SetProperty(ref _temperature, value);
- }
+ public partial decimal Temperature { get; set; }
///
/// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
@@ -74,73 +48,37 @@ public decimal Temperature
/// We generally recommend altering this or temperature but not both.
///
[JsonPropertyName("top_p")]
- public decimal TopP
- {
- get => _topP;
- set => SetProperty(ref _topP, value);
- }
+ public partial decimal TopP { get; set; }
///
/// Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
///
[JsonPropertyName("presence_penalty")]
- public decimal PresencePenalty
- {
- get => _presencePenalty;
- set => SetProperty(ref _presencePenalty, value);
- }
+ public partial decimal PresencePenalty { get; set; }
///
/// Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
///
[JsonPropertyName("frequency_penalty")]
- public decimal FrequencyPenalty
- {
- get => _frequencyPenalty;
- set => SetProperty(ref _frequencyPenalty, value);
- }
+ public partial decimal FrequencyPenalty { get; set; }
[JsonPropertyName("maxTokens")]
- public int MaxTokens
- {
- get => _maxTokens;
- set => SetProperty(ref _maxTokens, value);
- }
+ public partial int MaxTokens { get; set; }
[JsonPropertyName("apiKey")]
- public string? ApiKey
- {
- get => _apiKey;
- set => SetProperty(ref _apiKey, value);
- }
+ public partial string? ApiKey { get; set; }
[JsonPropertyName("model")]
- public string? Model
- {
- get => _model;
- set => SetProperty(ref _model, value);
- }
+ public partial string? Model { get; set; }
[JsonPropertyName("directions")]
- public string? Directions
- {
- get => _directions;
- set => SetProperty(ref _directions, value);
- }
+ public partial string? Directions { get; set; }
[JsonPropertyName("format")]
- public string? Format
- {
- get => _format;
- set => SetProperty(ref _format, value);
- }
+ public partial string? Format { get; set; }
[JsonPropertyName("apiUrl")]
- public string? ApiUrl
- {
- get => _apiUrl;
- set => SetProperty(ref _apiUrl, value);
- }
+ public partial string? ApiUrl { get; set; }
public ChatSettingsViewModel Copy()
{
diff --git a/src/ChatGPT.Core/ViewModels/Chat/ChatViewModel.cs b/src/ChatGPT.Core/ViewModels/Chat/ChatViewModel.cs
index 6d700f09..b6f124d2 100644
--- a/src/ChatGPT.Core/ViewModels/Chat/ChatViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Chat/ChatViewModel.cs
@@ -8,21 +8,13 @@
using AI;
using AI.Model.Json.Chat;
using AI.Model.Services;
-using CommunityToolkit.Mvvm.ComponentModel;
namespace ChatGPT.ViewModels.Chat;
-public class ChatViewModel : ObservableObject
+public partial class ChatViewModel : ViewModelBase
{
private readonly IChatService _chatService;
private readonly IChatSerializer _chatSerializer;
- private string? _name;
- private ChatSettingsViewModel? _settings;
- private ObservableCollection _messages;
- private ChatMessageViewModel? _currentMessage;
- private bool _isEnabled;
- private bool _debug;
- private bool _requireApiKey;
private CancellationTokenSource? _cts;
[JsonConstructor]
@@ -74,53 +66,25 @@ public ChatViewModel(
}
[JsonPropertyName("name")]
- public string? Name
- {
- get => _name;
- set => SetProperty(ref _name, value);
- }
+ public partial string? Name { get; set; }
[JsonPropertyName("settings")]
- public ChatSettingsViewModel? Settings
- {
- get => _settings;
- set => SetProperty(ref _settings, value);
- }
+ public partial ChatSettingsViewModel? Settings { get; set; }
[JsonPropertyName("messages")]
- public ObservableCollection Messages
- {
- get => _messages;
- set => SetProperty(ref _messages, value);
- }
+ public partial ObservableCollection Messages { get; set; }
[JsonPropertyName("currentMessage")]
- public ChatMessageViewModel? CurrentMessage
- {
- get => _currentMessage;
- set => SetProperty(ref _currentMessage, value);
- }
+ public partial ChatMessageViewModel? CurrentMessage { get; set; }
[JsonIgnore]
- public bool IsEnabled
- {
- get => _isEnabled;
- set => SetProperty(ref _isEnabled, value);
- }
+ public partial bool IsEnabled { get; set; }
[JsonPropertyName("debug")]
- public bool Debug
- {
- get => _debug;
- set => SetProperty(ref _debug, value);
- }
+ public partial bool Debug { get; set; }
[JsonPropertyName("requireApiKey")]
- public bool RequireApiKey
- {
- get => _requireApiKey;
- set => SetProperty(ref _requireApiKey, value);
- }
+ public partial bool RequireApiKey { get; set; }
public async Task SendAsync(ChatMessage[] messages, CancellationToken token)
{
diff --git a/src/ChatGPT.Core/ViewModels/Layouts/DesktopLayoutViewModel.cs b/src/ChatGPT.Core/ViewModels/Layouts/DesktopLayoutViewModel.cs
index 8e9a1048..aebc4783 100644
--- a/src/ChatGPT.Core/ViewModels/Layouts/DesktopLayoutViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Layouts/DesktopLayoutViewModel.cs
@@ -5,10 +5,6 @@ namespace ChatGPT.ViewModels.Layouts;
public partial class DesktopLayoutViewModel : LayoutViewModel
{
- private string _settingsWidth;
- private string _chatsWidth;
- private string _promptsWidth;
-
[JsonConstructor]
public DesktopLayoutViewModel()
{
@@ -24,25 +20,13 @@ public DesktopLayoutViewModel()
}
[JsonPropertyName("settingsWidth")]
- public string SettingsWidth
- {
- get => _settingsWidth;
- set => SetProperty(ref _settingsWidth, value);
- }
+ public partial string SettingsWidth { get; set; }
[JsonPropertyName("chatsWidth")]
- public string ChatsWidth
- {
- get => _chatsWidth;
- set => SetProperty(ref _chatsWidth, value);
- }
+ public partial string ChatsWidth { get; set; }
[JsonPropertyName("promptsWidth")]
- public string PromptsWidth
- {
- get => _promptsWidth;
- set => SetProperty(ref _promptsWidth, value);
- }
+ public partial string PromptsWidth { get; set; }
public override async Task BackAsync()
{
diff --git a/src/ChatGPT.Core/ViewModels/Layouts/LayoutViewModel.cs b/src/ChatGPT.Core/ViewModels/Layouts/LayoutViewModel.cs
index 0cd15ef9..b5cdd8b2 100644
--- a/src/ChatGPT.Core/ViewModels/Layouts/LayoutViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Layouts/LayoutViewModel.cs
@@ -1,6 +1,5 @@
using System.Text.Json.Serialization;
using System.Threading.Tasks;
-using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace ChatGPT.ViewModels.Layouts;
@@ -8,13 +7,8 @@ namespace ChatGPT.ViewModels.Layouts;
[JsonPolymorphic]
[JsonDerivedType(typeof(MobileLayoutViewModel), typeDiscriminator: "mobile")]
[JsonDerivedType(typeof(DesktopLayoutViewModel), typeDiscriminator: "desktop")]
-public abstract partial class LayoutViewModel : ObservableObject
+public abstract partial class LayoutViewModel : ViewModelBase
{
- private string? _name;
- private bool _showSettings;
- private bool _showChats;
- private bool _showPrompts;
-
[JsonConstructor]
protected LayoutViewModel()
{
@@ -26,32 +20,16 @@ protected LayoutViewModel()
}
[JsonPropertyName("name")]
- public string? Name
- {
- get => _name;
- set => SetProperty(ref _name, value);
- }
+ public partial string? Name { get; set; }
[JsonPropertyName("showSettings")]
- public bool ShowSettings
- {
- get => _showSettings;
- set => SetProperty(ref _showSettings, value);
- }
+ public partial bool ShowSettings { get; set; }
[JsonPropertyName("showChats")]
- public bool ShowChats
- {
- get => _showChats;
- set => SetProperty(ref _showChats, value);
- }
+ public partial bool ShowChats { get; set; }
[JsonPropertyName("showPrompts")]
- public bool ShowPrompts
- {
- get => _showPrompts;
- set => SetProperty(ref _showPrompts, value);
- }
+ public partial bool ShowPrompts { get; set; }
[JsonIgnore]
public IRelayCommand ShowSettingsCommand { get; }
diff --git a/src/ChatGPT.Core/ViewModels/Layouts/MobileLayoutViewModel.cs b/src/ChatGPT.Core/ViewModels/Layouts/MobileLayoutViewModel.cs
index 643639f2..1dc809e2 100644
--- a/src/ChatGPT.Core/ViewModels/Layouts/MobileLayoutViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Layouts/MobileLayoutViewModel.cs
@@ -5,8 +5,6 @@ namespace ChatGPT.ViewModels.Layouts;
public partial class MobileLayoutViewModel : LayoutViewModel
{
- private bool _showMenu;
-
[JsonConstructor]
public MobileLayoutViewModel()
{
@@ -19,11 +17,7 @@ public MobileLayoutViewModel()
}
[JsonPropertyName("showMenu")]
- public bool ShowMenu
- {
- get => _showMenu;
- set => SetProperty(ref _showMenu, value);
- }
+ public partial bool ShowMenu { get; set; }
public override async Task BackAsync()
{
diff --git a/src/ChatGPT.Core/ViewModels/Layouts/WindowLayoutViewModel.cs b/src/ChatGPT.Core/ViewModels/Layouts/WindowLayoutViewModel.cs
index 57dd1169..1c13da88 100644
--- a/src/ChatGPT.Core/ViewModels/Layouts/WindowLayoutViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Layouts/WindowLayoutViewModel.cs
@@ -1,71 +1,34 @@
using System.Text.Json.Serialization;
-using CommunityToolkit.Mvvm.ComponentModel;
namespace ChatGPT.ViewModels.Layouts;
-public partial class WindowLayoutViewModel : ObservableObject
+public partial class WindowLayoutViewModel : ViewModelBase
{
- private int _x;
- private int _y;
- private double _width;
- private double _height;
- private string? _windowState;
- private string? _windowStartupLocation;
- private bool _topmost;
-
[JsonConstructor]
public WindowLayoutViewModel()
{
}
[JsonPropertyName("x")]
- public int X
- {
- get => _x;
- set => SetProperty(ref _x, value);
- }
+ public partial int X { get; set; }
[JsonPropertyName("y")]
- public int Y
- {
- get => _y;
- set => SetProperty(ref _y, value);
- }
+ public partial int Y { get; set; }
[JsonPropertyName("width")]
- public double Width
- {
- get => _width;
- set => SetProperty(ref _width, value);
- }
+ public partial double Width { get; set; }
[JsonPropertyName("height")]
- public double Height
- {
- get => _height;
- set => SetProperty(ref _height, value);
- }
+ public partial double Height { get; set; }
[JsonPropertyName("windowState")]
- public string? WindowState
- {
- get => _windowState;
- set => SetProperty(ref _windowState, value);
- }
+ public partial string? WindowState { get; set; }
[JsonPropertyName("windowStartupLocation")]
- public string? WindowStartupLocation
- {
- get => _windowStartupLocation;
- set => SetProperty(ref _windowStartupLocation, value);
- }
+ public partial string? WindowStartupLocation { get; set; }
[JsonPropertyName("topmost")]
- public bool Topmost
- {
- get => _topmost;
- set => SetProperty(ref _topmost, value);
- }
+ public partial bool Topmost { get; set; }
public WindowLayoutViewModel Copy()
{
diff --git a/src/ChatGPT.Core/ViewModels/Settings/PromptViewModel.cs b/src/ChatGPT.Core/ViewModels/Settings/PromptViewModel.cs
index 11a9b1f7..ec606d06 100644
--- a/src/ChatGPT.Core/ViewModels/Settings/PromptViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Settings/PromptViewModel.cs
@@ -1,26 +1,14 @@
using System.Text.Json.Serialization;
-using CommunityToolkit.Mvvm.ComponentModel;
namespace ChatGPT.ViewModels.Settings;
-public class PromptViewModel : ObservableObject
+public partial class PromptViewModel : ViewModelBase
{
- private string? _act;
- private string? _prompt;
-
[JsonPropertyName("act")]
- public string? Act
- {
- get => _act;
- set => SetProperty(ref _act, value);
- }
+ public partial string? Act { get; set; }
[JsonPropertyName("prompt")]
- public string? Prompt
- {
- get => _prompt;
- set => SetProperty(ref _prompt, value);
- }
+ public partial string? Prompt { get; set; }
public PromptViewModel Copy()
{
diff --git a/src/ChatGPT.Core/ViewModels/Settings/WorkspaceViewModel.cs b/src/ChatGPT.Core/ViewModels/Settings/WorkspaceViewModel.cs
index 7a82ae1c..9a75656c 100644
--- a/src/ChatGPT.Core/ViewModels/Settings/WorkspaceViewModel.cs
+++ b/src/ChatGPT.Core/ViewModels/Settings/WorkspaceViewModel.cs
@@ -2,84 +2,37 @@
using System.Text.Json.Serialization;
using ChatGPT.ViewModels.Chat;
using ChatGPT.ViewModels.Layouts;
-using CommunityToolkit.Mvvm.ComponentModel;
namespace ChatGPT.ViewModels.Settings;
-public class WorkspaceViewModel : ObservableObject
+public partial class WorkspaceViewModel : ViewModelBase
{
- private string? _name;
- private ObservableCollection? _chats;
- private ChatViewModel? _currentChat;
- private ObservableCollection? _prompts;
- private PromptViewModel? _currentPrompt;
- private ObservableCollection? _layouts;
- private LayoutViewModel? _currentLayout;
- private string? _theme;
- private bool _topmost;
-
[JsonPropertyName("name")]
- public string? Name
- {
- get => _name;
- set => SetProperty(ref _name, value);
- }
+ public partial string? Name { get; set; }
[JsonPropertyName("chats")]
- public ObservableCollection? Chats
- {
- get => _chats;
- set => SetProperty(ref _chats, value);
- }
+ public partial ObservableCollection? Chats { get; set; }
[JsonPropertyName("currentChat")]
- public ChatViewModel? CurrentChat
- {
- get => _currentChat;
- set => SetProperty(ref _currentChat, value);
- }
+ public partial ChatViewModel? CurrentChat { get; set; }
[JsonPropertyName("prompts")]
- public ObservableCollection? Prompts
- {
- get => _prompts;
- set => SetProperty(ref _prompts, value);
- }
+ public partial ObservableCollection? Prompts { get; set; }
[JsonPropertyName("currentPrompt")]
- public PromptViewModel? CurrentPrompt
- {
- get => _currentPrompt;
- set => SetProperty(ref _currentPrompt, value);
- }
+ public partial PromptViewModel? CurrentPrompt { get; set; }
[JsonPropertyName("layouts")]
- public ObservableCollection? Layouts
- {
- get => _layouts;
- set => SetProperty(ref _layouts, value);
- }
+ public partial ObservableCollection? Layouts { get; set; }
[JsonPropertyName("currentLayout")]
- public LayoutViewModel? CurrentLayout
- {
- get => _currentLayout;
- set => SetProperty(ref _currentLayout, value);
- }
+ public partial LayoutViewModel? CurrentLayout { get; set; }
[JsonPropertyName("theme")]
- public string? Theme
- {
- get => _theme;
- set => SetProperty(ref _theme, value);
- }
+ public partial string? Theme { get; set; }
[JsonPropertyName("topmost")]
- public bool Topmost
- {
- get => _topmost;
- set => SetProperty(ref _topmost, value);
- }
+ public partial bool Topmost { get; set; }
private ObservableCollection? CopyChats(out ChatViewModel? currentChat)
{
diff --git a/src/ChatGPT.Core/ViewModels/ViewModelBase.cs b/src/ChatGPT.Core/ViewModels/ViewModelBase.cs
new file mode 100644
index 00000000..3b314d65
--- /dev/null
+++ b/src/ChatGPT.Core/ViewModels/ViewModelBase.cs
@@ -0,0 +1,4 @@
+namespace ChatGPT.ViewModels;
+
+[Reactive]
+public abstract partial class ViewModelBase;
diff --git a/src/ChatGPT.UI.Android/ChatGPT.UI.Android.csproj b/src/ChatGPT.UI.Android/ChatGPT.UI.Android.csproj
index 1592fb55..3e1e13c7 100644
--- a/src/ChatGPT.UI.Android/ChatGPT.UI.Android.csproj
+++ b/src/ChatGPT.UI.Android/ChatGPT.UI.Android.csproj
@@ -1,7 +1,7 @@
Exe
- net8.0-android34.0
+ net9.0-android35.0
21
enable
com.chatgpt.android
diff --git a/src/ChatGPT.UI.Browser/ChatGPT.UI.Browser.csproj b/src/ChatGPT.UI.Browser/ChatGPT.UI.Browser.csproj
index 3abaf5bd..95cd3780 100644
--- a/src/ChatGPT.UI.Browser/ChatGPT.UI.Browser.csproj
+++ b/src/ChatGPT.UI.Browser/ChatGPT.UI.Browser.csproj
@@ -1,6 +1,6 @@
- net8.0-browser
+ net9.0-browser
browser-wasm
AppBundle\main.js
Exe
diff --git a/src/ChatGPT.UI.Desktop/ChatGPT.UI.Desktop.csproj b/src/ChatGPT.UI.Desktop/ChatGPT.UI.Desktop.csproj
index 1add0259..4b04d756 100644
--- a/src/ChatGPT.UI.Desktop/ChatGPT.UI.Desktop.csproj
+++ b/src/ChatGPT.UI.Desktop/ChatGPT.UI.Desktop.csproj
@@ -6,7 +6,7 @@
WinExe
- net8.0
+ net9.0
win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64
enable
full
diff --git a/src/ChatGPT.UI.iOS/ChatGPT.UI.iOS.csproj b/src/ChatGPT.UI.iOS/ChatGPT.UI.iOS.csproj
index 20f56777..1d7bbf32 100644
--- a/src/ChatGPT.UI.iOS/ChatGPT.UI.iOS.csproj
+++ b/src/ChatGPT.UI.iOS/ChatGPT.UI.iOS.csproj
@@ -1,7 +1,7 @@
Exe
- net8.0-ios17.0
+ net9.0-ios18.0
15.0
manual
enable
diff --git a/src/ChatGPT.UI/ChatGPT.UI.csproj b/src/ChatGPT.UI/ChatGPT.UI.csproj
index 50930ad1..76154c10 100644
--- a/src/ChatGPT.UI/ChatGPT.UI.csproj
+++ b/src/ChatGPT.UI/ChatGPT.UI.csproj
@@ -1,12 +1,15 @@
Library
- net8.0
+ net9.0
enable
true
ChatGPT
true
+
+ true
+
ChatGPT.UI
An OpenAI client user interface library for .NET.
@@ -22,6 +25,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/src/ChatGPT.UI/ViewModels/MainViewModel.Actions.cs b/src/ChatGPT.UI/ViewModels/MainViewModel.Actions.cs
index 2ef64c12..4cccb156 100644
--- a/src/ChatGPT.UI/ViewModels/MainViewModel.Actions.cs
+++ b/src/ChatGPT.UI/ViewModels/MainViewModel.Actions.cs
@@ -7,54 +7,23 @@ namespace ChatGPT.ViewModels;
public partial class MainViewModel
{
- private ObservableCollection? _layouts;
- private LayoutViewModel? _currentLayout;
- private MobileLayoutViewModel? _mobileLayout;
- private DesktopLayoutViewModel? _desktopLayout;
- private string? _theme;
- private bool _topmost;
-
[JsonPropertyName("layouts")]
- public ObservableCollection? Layouts
- {
- get => _layouts;
- set => SetProperty(ref _layouts, value);
- }
+ public partial ObservableCollection? Layouts { get; set; }
[JsonPropertyName("currentLayout")]
- public LayoutViewModel? CurrentLayout
- {
- get => _currentLayout;
- set => SetProperty(ref _currentLayout, value);
- }
+ public partial LayoutViewModel? CurrentLayout { get; set; }
[JsonPropertyName("mobileLayout")]
- public MobileLayoutViewModel? MobileLayout
- {
- get => _mobileLayout;
- set => SetProperty(ref _mobileLayout, value);
- }
+ public partial MobileLayoutViewModel? MobileLayout { get; set; }
[JsonPropertyName("desktopLayout")]
- public DesktopLayoutViewModel? DesktopLayout
- {
- get => _desktopLayout;
- set => SetProperty(ref _desktopLayout, value);
- }
+ public partial DesktopLayoutViewModel? DesktopLayout { get; set; }
[JsonPropertyName("theme")]
- public string? Theme
- {
- get => _theme;
- set => SetProperty(ref _theme, value);
- }
+ public partial string? Theme { get; set; }
[JsonPropertyName("topmost")]
- public bool Topmost
- {
- get => _topmost;
- set => SetProperty(ref _topmost, value);
- }
+ public partial bool Topmost { get; set; }
[JsonIgnore]
public IRelayCommand ExitCommand { get; }
diff --git a/src/ChatGPT.UI/ViewModels/MainViewModel.Chats.cs b/src/ChatGPT.UI/ViewModels/MainViewModel.Chats.cs
index 43dce9a4..4e6dd8e3 100644
--- a/src/ChatGPT.UI/ViewModels/MainViewModel.Chats.cs
+++ b/src/ChatGPT.UI/ViewModels/MainViewModel.Chats.cs
@@ -14,22 +14,11 @@ namespace ChatGPT.ViewModels;
public partial class MainViewModel
{
- private ObservableCollection _chats;
- private ChatViewModel? _currentChat;
-
[JsonPropertyName("chats")]
- public ObservableCollection Chats
- {
- get => _chats;
- set => SetProperty(ref _chats, value);
- }
+ public partial ObservableCollection Chats { get; set; }
[JsonPropertyName("currentChat")]
- public ChatViewModel? CurrentChat
- {
- get => _currentChat;
- set => SetProperty(ref _currentChat, value);
- }
+ public partial ChatViewModel? CurrentChat { get; set; }
[JsonIgnore]
public IAsyncRelayCommand AddChatCommand { get; }
diff --git a/src/ChatGPT.UI/ViewModels/MainViewModel.Prompts.cs b/src/ChatGPT.UI/ViewModels/MainViewModel.Prompts.cs
index 1d850663..64b3ab69 100644
--- a/src/ChatGPT.UI/ViewModels/MainViewModel.Prompts.cs
+++ b/src/ChatGPT.UI/ViewModels/MainViewModel.Prompts.cs
@@ -37,22 +37,11 @@ public partial class MainViewModel
},
};
- private ObservableCollection _prompts;
- private PromptViewModel? _currentPrompt;
-
[JsonPropertyName("prompts")]
- public ObservableCollection Prompts
- {
- get => _prompts;
- set => SetProperty(ref _prompts, value);
- }
+ public partial ObservableCollection Prompts { get; set; }
[JsonPropertyName("currentPrompt")]
- public PromptViewModel? CurrentPrompt
- {
- get => _currentPrompt;
- set => SetProperty(ref _currentPrompt, value);
- }
+ public partial PromptViewModel? CurrentPrompt { get; set; }
[JsonIgnore]
public IAsyncRelayCommand AddPromptCommand { get; }
diff --git a/src/ChatGPT.UI/ViewModels/MainViewModel.cs b/src/ChatGPT.UI/ViewModels/MainViewModel.cs
index 6cdaaab7..78d53765 100644
--- a/src/ChatGPT.UI/ViewModels/MainViewModel.cs
+++ b/src/ChatGPT.UI/ViewModels/MainViewModel.cs
@@ -9,12 +9,11 @@
using ChatGPT.ViewModels.Chat;
using ChatGPT.ViewModels.Layouts;
using ChatGPT.ViewModels.Settings;
-using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace ChatGPT.ViewModels;
-public partial class MainViewModel : ObservableObject
+public partial class MainViewModel : ViewModelBase
{
private readonly IChatService _chatService;
private readonly IChatSerializer _chatSerializer;
diff --git a/src/ChatGPT/ChatGPT.csproj b/src/ChatGPT/ChatGPT.csproj
index 46e64932..cfaed5e4 100644
--- a/src/ChatGPT/ChatGPT.csproj
+++ b/src/ChatGPT/ChatGPT.csproj
@@ -16,7 +16,7 @@
openai;api;json;services;chat;chatgpt;completions
-
+
diff --git a/tests/ChatGPT.UnitTests/ChatGPT.UnitTests.csproj b/tests/ChatGPT.UnitTests/ChatGPT.UnitTests.csproj
index fb322aa8..bf07da23 100644
--- a/tests/ChatGPT.UnitTests/ChatGPT.UnitTests.csproj
+++ b/tests/ChatGPT.UnitTests/ChatGPT.UnitTests.csproj
@@ -1,6 +1,6 @@
- net8.0
+ net9.0
Library
False
True