Skip to content

psun247/CSharpWpfChatGPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

caf178e · Feb 13, 2025

History

34 Commits
Mar 12, 2023
Feb 13, 2025
Feb 13, 2025
Jun 18, 2024
Jun 18, 2024
Mar 12, 2023
Feb 13, 2025
Feb 13, 2025
Jun 18, 2024
Jun 18, 2024
Mar 12, 2023
Feb 13, 2025
Mar 19, 2023
Mar 12, 2023
Mar 19, 2023
Oct 24, 2023
Feb 13, 2025
Jun 18, 2024
Jun 18, 2024
Feb 13, 2025

Repository files navigation

Please read my project article at codeproject.com

https://www.codeproject.com/Tips/5377103/ChatGPT-API-in-Csharp-WPF-XAML-MVVM

Feel free to explore my other repositories on GitHub!

https://github.com/psun247

ChatGPT API in C# WPF / XAML / MVVM

C# WPF app that communicates with OpenAI GPT-4 / GPT-3.5 Turbo (plus now added History tab and SQL Server support)

Screenshot1

Screenshot2

Screenshot3

Setup

Create an Open AI account to obtain an API key (free): https://platform.openai.com/account/api-keys

You can use the key as a command line parameter (without compiling the project):

  1. Click CSharpWpfChatGPT_v1.3 under Releases on the right side of this page
  2. Download CSharpWpfChatGPT_v1.3_net6.0-windows.zip
  3. Unzip the file and run CSharpWpfChatGPT.exe /the key obtained above (CSharpWpfChatGPT.exe /sk-Ih...WPd)

Or in App.xaml.cs, modify this: "<Your Open AI API Key is something like "sk-Ih...WPd">";

Build CSharpWpfChatGPT.sln with Visual Studio 2022 (Community version okay). This app is targeted for .NET 6 and 8. If you don't have .NET 8 installed, remove net8.0-windows in CSharpWpfChatGPT.csproj.

Whetstone.ChatGPT

I used John Iwasz's excellent Whetstone.ChatGPT to do the heavy lifting for ChatGPT API calls.

https://www.nuget.org/packages/Whetstone.ChatGPT

Other Supporting Libraries

CommunityToolkit.Mvvm

https://www.nuget.org/packages/CommunityToolkit.Mvvm

ModernWpfUI

https://www.nuget.org/packages/ModernWpfUI/

RestoreWindowPlace

https://www.nuget.org/packages/RestoreWindowPlace