diff --git a/src/ChatPrisma/App.xaml b/src/ChatPrisma/App.xaml index 624b4c5..e23678a 100644 --- a/src/ChatPrisma/App.xaml +++ b/src/ChatPrisma/App.xaml @@ -15,6 +15,7 @@ + diff --git a/src/ChatPrisma/Options/TextEnhancementOptions.cs b/src/ChatPrisma/Options/TextEnhancementOptions.cs index d57bade..03a4b6f 100644 --- a/src/ChatPrisma/Options/TextEnhancementOptions.cs +++ b/src/ChatPrisma/Options/TextEnhancementOptions.cs @@ -3,4 +3,5 @@ public class TextEnhancementOptions { public int TextSize { get; set; } + public string? CustomInstructions { get; set; } } diff --git a/src/ChatPrisma/Services/ChatBot/ChatPrompts.cs b/src/ChatPrisma/Services/ChatBot/ChatPrompts.cs index 33b0594..7ea7c69 100644 --- a/src/ChatPrisma/Services/ChatBot/ChatPrompts.cs +++ b/src/ChatPrisma/Services/ChatBot/ChatPrompts.cs @@ -2,14 +2,23 @@ namespace ChatPrisma.Services.ChatBot; public static class ChatPrompts { - public static string System(string text) => $""" - You are "Chat Prisma," an expert assistant focused on elevating the quality of written content. - Your task is to rigorously fine-tune the user's text according to their precise specifications. - Respond exclusively with the improved text, omitting any additional commentary. - Collaborate with the user in iterative cycles until the text meets their satisfaction. - Always build upon the most recent version of the text, rather than reverting to the original. - - The current iteration of the text is as follows: - {text} - """; -} \ No newline at end of file + public static string System(string? customInstructions) + { + customInstructions = string.IsNullOrWhiteSpace(customInstructions) + ? null + : customInstructions; + + return $""" + You are "Chat Prisma," an expert assistant focused on helping users improve their written text. + Your task is to fine-tune the user's text according to their precise specifications. + Respond exclusively with the improved text, omitting any additional commentary. + Collaborate with the user in iterative cycles until the user is satisfied. + Always build upon the most recent version of the text, rather than reverting to the original. + + Also consider the following instructions from the user: + {customInstructions ?? "None"} + + The current iteration of the text is in the next message. + """; + } +} diff --git a/src/ChatPrisma/Services/TextExtractor/ClipboardTextExtractor.cs b/src/ChatPrisma/Services/TextExtractor/ClipboardTextExtractor.cs index 002a85d..443406b 100644 --- a/src/ChatPrisma/Services/TextExtractor/ClipboardTextExtractor.cs +++ b/src/ChatPrisma/Services/TextExtractor/ClipboardTextExtractor.cs @@ -79,7 +79,7 @@ private static bool AnyKeyPressed() var task = Task.Delay(TimeSpan.FromMilliseconds(hotkeyOptions.CurrentValue.ClipboardDelayInMilliseconds)); var watch = Stopwatch.StartNew(); - // Either wait until the task is completed or the user releases all keys + // Either wait until the task is completed or we got some text in the clipboard while (task.IsCompleted is false) { var dataObject = Clipboard.GetDataObject(); diff --git a/src/ChatPrisma/Themes/ButtonStyles.xaml b/src/ChatPrisma/Themes/ButtonStyles.xaml index a1a0b52..7b53cd6 100644 --- a/src/ChatPrisma/Themes/ButtonStyles.xaml +++ b/src/ChatPrisma/Themes/ButtonStyles.xaml @@ -3,18 +3,22 @@ + + \ No newline at end of file diff --git a/src/ChatPrisma/Themes/Stepper.xaml b/src/ChatPrisma/Themes/Stepper.xaml new file mode 100644 index 0000000..117f81b --- /dev/null +++ b/src/ChatPrisma/Themes/Stepper.xaml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/ChatPrisma/Themes/Stepper.xaml.cs b/src/ChatPrisma/Themes/Stepper.xaml.cs new file mode 100644 index 0000000..077634d --- /dev/null +++ b/src/ChatPrisma/Themes/Stepper.xaml.cs @@ -0,0 +1,41 @@ +using System.Windows; +using System.Windows.Input; + +namespace ChatPrisma.Themes; + +public partial class Stepper +{ + public Stepper() + { + this.InitializeComponent(); + } + + public static readonly DependencyProperty PreviousCommandProperty = DependencyProperty.Register( + nameof(PreviousCommand), typeof(ICommand), typeof(Stepper), new PropertyMetadata(default(ICommand))); + + public ICommand PreviousCommand + { + get { return (ICommand)GetValue(PreviousCommandProperty); } + set { SetValue(PreviousCommandProperty, value); } + } + + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register( + nameof(Value), typeof(int), typeof(Stepper), new PropertyMetadata(default(int))); + +#pragma warning disable CA1721 + public int Value + { + get { return (int)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } +#pragma warning restore CA1721 + + public static readonly DependencyProperty NextCommandProperty = DependencyProperty.Register( + nameof(NextCommand), typeof(ICommand), typeof(Stepper), new PropertyMetadata(default(ICommand))); + + public ICommand NextCommand + { + get { return (ICommand)GetValue(NextCommandProperty); } + set { SetValue(NextCommandProperty, value); } + } +} diff --git a/src/ChatPrisma/Themes/WindowStyles.xaml b/src/ChatPrisma/Themes/WindowStyles.xaml index a6eb8bc..d589d4f 100644 --- a/src/ChatPrisma/Themes/WindowStyles.xaml +++ b/src/ChatPrisma/Themes/WindowStyles.xaml @@ -183,6 +183,7 @@