diff --git a/OpenGptChat.Avalonia/App.axaml b/OpenGptChat.Avalonia/App.axaml
index a292740..7e52bee 100644
--- a/OpenGptChat.Avalonia/App.axaml
+++ b/OpenGptChat.Avalonia/App.axaml
@@ -1,15 +1,17 @@
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OpenGptChat.Avalonia/Assets/openai.ico b/OpenGptChat.Avalonia/Assets/openai.ico
new file mode 100644
index 0000000..a8b840e
Binary files /dev/null and b/OpenGptChat.Avalonia/Assets/openai.ico differ
diff --git a/OpenGptChat.Avalonia/OpenGptChat.Avalonia.csproj b/OpenGptChat.Avalonia/OpenGptChat.Avalonia.csproj
index e063f5c..9bd06c5 100644
--- a/OpenGptChat.Avalonia/OpenGptChat.Avalonia.csproj
+++ b/OpenGptChat.Avalonia/OpenGptChat.Avalonia.csproj
@@ -13,18 +13,24 @@
+
+
+
+
-
+
+
+
diff --git a/OpenGptChat.Avalonia/Program.cs b/OpenGptChat.Avalonia/Program.cs
index eb14fb9..850b5b5 100644
--- a/OpenGptChat.Avalonia/Program.cs
+++ b/OpenGptChat.Avalonia/Program.cs
@@ -10,6 +10,14 @@ internal sealed class Program
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
+ .UsePlatformDetect()
+ //.With(new Win32PlatformOptions()
+ //{
+ // CompositionMode = new[]
+ // {
+ // Win32CompositionMode.WinUIComposition,
+ // }
+ //})
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
diff --git a/OpenGptChat.Avalonia/Services/ChatService.cs b/OpenGptChat.Avalonia/Services/ChatService.cs
new file mode 100644
index 0000000..fe5f722
--- /dev/null
+++ b/OpenGptChat.Avalonia/Services/ChatService.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OpenGptChat.Services
+{
+ public class ChatService
+ {
+ public ChatService()
+ {
+
+ }
+ }
+}
diff --git a/OpenGptChat.Avalonia/Services/ConfigService.cs b/OpenGptChat.Avalonia/Services/ConfigService.cs
new file mode 100644
index 0000000..a401af1
--- /dev/null
+++ b/OpenGptChat.Avalonia/Services/ConfigService.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OpenGptChat.Services
+{
+ public class ConfigService
+ {
+
+ }
+}
diff --git a/OpenGptChat.Avalonia/ViewModels/MainPageViewModel.cs b/OpenGptChat.Avalonia/ViewModels/MainPageViewModel.cs
index 5e91637..988856a 100644
--- a/OpenGptChat.Avalonia/ViewModels/MainPageViewModel.cs
+++ b/OpenGptChat.Avalonia/ViewModels/MainPageViewModel.cs
@@ -1,5 +1,7 @@
using System.Collections.ObjectModel;
+using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
using OpenGptChat.Models;
namespace OpenGptChat.ViewModels
@@ -9,6 +11,29 @@ public partial class MainPageViewModel : ViewModelBase
public ObservableCollection Sessions { get; } = new();
[ObservableProperty]
- private ChatSession? selectedSession;
+ private ChatSession? _selectedSession;
+
+ [ObservableProperty]
+ private string _textInput = string.Empty;
+
+ [RelayCommand]
+ public async Task Send()
+ {
+#if DEBUG
+ if (SelectedSession is not ChatSession selectedSession)
+ return;
+ if (string.IsNullOrWhiteSpace(TextInput))
+ return;
+
+ selectedSession.Messages.Add(
+ new ChatMessage()
+ {
+ Title = "Me",
+ MessageText = TextInput,
+ });
+
+ TextInput = string.Empty;
+#endif
+ }
}
}
diff --git a/OpenGptChat.Avalonia/Views/Controls/ChatMessage.axaml b/OpenGptChat.Avalonia/Views/Controls/ChatMessage.axaml
index 6c69b5f..035f457 100644
--- a/OpenGptChat.Avalonia/Views/Controls/ChatMessage.axaml
+++ b/OpenGptChat.Avalonia/Views/Controls/ChatMessage.axaml
@@ -3,13 +3,16 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:md="https://github.com/whistyun/Markdown.Avalonia"
+ xmlns:fluent="using:FluentAvalonia.UI.Controls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="OpenGptChat.Views.Controls.ChatMessage"
x:Name="root">
-
diff --git a/OpenGptChat.Avalonia/Views/Controls/ChatMessage.axaml.cs b/OpenGptChat.Avalonia/Views/Controls/ChatMessage.axaml.cs
index d372c32..6f4108e 100644
--- a/OpenGptChat.Avalonia/Views/Controls/ChatMessage.axaml.cs
+++ b/OpenGptChat.Avalonia/Views/Controls/ChatMessage.axaml.cs
@@ -13,6 +13,12 @@ public partial class ChatMessage : UserControl
public static readonly StyledProperty MessageTextProperty =
AvaloniaProperty.Register(nameof(MessageText), defaultValue: "Content");
+ public static readonly StyledProperty MessageForegroundProperty =
+ AvaloniaProperty.Register(nameof(MessageForeground));
+
+ public static readonly StyledProperty MessageBackgroundProperty =
+ AvaloniaProperty.Register(nameof(MessageBackground));
+
public static readonly StyledProperty MessagePaddingProperty =
AvaloniaProperty.Register(nameof(MessagePadding), defaultValue: new Thickness(5, 0));
@@ -42,6 +48,18 @@ public string MessageText
set => SetValue(MessageTextProperty, value);
}
+ public IBrush MessageForeground
+ {
+ get => GetValue(MessageForegroundProperty);
+ set => SetValue(MessageForegroundProperty, value);
+ }
+
+ public IBrush MessageBackground
+ {
+ get => GetValue(MessageBackgroundProperty);
+ set => SetValue(MessageBackgroundProperty, value);
+ }
+
public Thickness MessagePadding
{
get => GetValue(MessagePaddingProperty);
diff --git a/OpenGptChat.Avalonia/Views/MainWindow.axaml b/OpenGptChat.Avalonia/Views/MainWindow.axaml
index e858217..1b5c692 100644
--- a/OpenGptChat.Avalonia/Views/MainWindow.axaml
+++ b/OpenGptChat.Avalonia/Views/MainWindow.axaml
@@ -4,12 +4,14 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="using:OpenGptChat.Views.Pages"
- mc:Ignorable="d" d:DesignWidth="850" d:DesignHeight="550"
- Width="850" Height="550"
+ mc:Ignorable="d" d:DesignWidth="850" d:DesignHeight="560"
+ Width="850" Height="560"
x:Class="OpenGptChat.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
- Icon="/Assets/avalonia-logo.ico"
- Title="OpenGptChat.Avalonia">
+ Background="Transparent"
+ TransparencyLevelHint="Mica"
+ Icon="/Assets/openai.ico"
+ Title="OpenGptChat">