• Stars
    star
    1,376
  • Rank 34,176 (Top 0.7 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 2 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A ChatGPT C# client for MacOS, Windows, Linux, Android, iOS and Browser. Powered by Avalonia UI framework.

ChatGPT

Build Status CI

GitHub release Github All Releases Github Releases

NuGet NuGet

A ChatGPT C# client for graphical user interface runs on MacOS, Windows, Linux, Android, iOS and Browser. Powered by Avalonia UI framework.

To make the app work, you need to set the OpenAI API key as the OPENAI_API_KEY environment variable or set API key directly in app settings.

You can try client using browser version here.

image

Shortcuts

Main Window

  • Ctrl+Shift+A - Toggle between transparent and acrylic blur window style.
  • Ctrl+Shift+S - Toggle between visible and hidden window state.

Message Prompt

  • Enter - Send prompt.
  • Escape - Cancel edit.
  • F2 - Edit prompt.
  • Shift+Enter, Alt+Enter - Insert new line.

Overriding OpenAI api url

To override the OpenAI api url set `OPENAI_API_URL_CHAT_COMPLETIONS` environment variable or set API url directly in app settings.

OpenAI ChatGPT web version import

You can import OpenAI ChatGPT web version chats backup created using this script.

Build

  1. Install .NET 7.0
  2. Run dotnet workload install ios android wasm-tools command
  3. dotnet publish -c Release command inside project directory (mobile/desktop) or dotnet run for desktop to just run

Dependencies

.NET tool

Install:

dotnet tool install --global ChatGPT.CLI --version 1.0.0-preview.17

Uninstall:

dotnet tool uninstall --global ChatGPT.CLI

Usage

ChatGPT.CLI:
An .NET ChatGPT tool.

Usage:
ChatGPT.CLI [options]

Options:
-f, --inputFiles <inputfiles>              The relative or absolute path to the input files
-d, --inputDirectory <inputdirectory>      The relative or absolute path to the input directory
-o, --outputDirectory <outputdirectory>    The relative or absolute path to the output directory
--outputFiles <outputfiles>                The relative or absolute path to the output files
-p, --pattern <pattern>                    The search string to match against the names of files in the input directory
-r, --recursive                            Recurse into subdirectories of input directory search
-e, --extension <extension>                The output file extension
-s, --settingsFile <settingsfile>          The relative or absolute path to the settings file
--temperature <temperature>                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.
--topP <topp>                              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.
--presencePenalty <presencepenalty>        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.
--frequencyPenalty <frequencypenalty>      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.
--maxTokens <maxtokens>                    The maximum number of tokens to generate in the chat completion.
--apiKey <apikey>                          Override OpenAI api key. By default OPENAI_API_KEY environment variable is used.
--apiUrl <apiUrl>                          Override OpenAI api url. By default OPENAI_API_URL_CHAT_COMPLETIONS environment variable is used.
--model <model>                            ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API.
--directions <directions>                  The system message (directions) helps set the behavior of the assistant. Typically, a conversation is formatted with a system message first, followed by alternating user and assistant messages.
-t, --threads <threads>                    The number of parallel job threads
--quiet                                    Set verbosity level to quiet
--version                                  Show version information
-?, -h, --help                             Show help and usage information

Examples

  • Using .NET tool chatgpt command:

C# to VB

chatgpt -d ./ -e vb -p *.cs --directions "You are C# to VB conversion expert. Convert input code from C# to VB. Write only converted code."

C# to F#

chatgpt -d ./ -e fs -p *.cs --directions "You are C# to F# conversion expert. Convert input code from C# to F#. Write only code."

Refactor C# code

chatgpt -d ./ -e cs -p *.cs --directions "You are C# expert. Refactor C# code to use fluent api. Write only code."

Write API documentation

chatgpt -d ./ -e md -p *.cs --directions "You are a technical documentation writer. Write API documentation for C# code. If XML docs are missing write them."
  • Run from source

C# to VB

dotnet run -- -d ./ -e vb -p *.cs --directions "You are C# to VB conversion expert. Convert input code from C# to VB. Write only converted code."

C# to F#

dotnet run -- -d ./ -e fs -p *.cs --directions "You are C# to F# conversion expert. Convert input code from C# to F#. Write only code."

Write API documentation

dotnet run -- -d ./ -e md -p *.cs --directions "You are a technical documentation writer. Write API documentation for C# code. If XML docs are missing write them."

Settings file format

{
    "temperature": 0.7,
    "top_p": 1,
    "presence_penalty": 0,
    "frequency_penalty": 0,
    "maxTokens": 2000,
    "apiKey": "",
    "model": "gpt-3.5-turbo",
    "directions": "You are a helpful assistant.",
    "apiUrl": ""
}

COM

In the build release directory ChatGPT\ChatGptCom\bin\Release\net462\ run following command to register ChatGptCom.dll.

32-bit

c:\Windows\Microsoft.NET\Framework\v4.0.30319\regasmm.exe /codebase /tlb ChatGptCom.dll

64-bit

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe /codebase /tlb ChatGptCom.dll

Microsoft Work 2010

Add ChatGPT\ChatGptCom\bin\Release\net462\ChatGptCom.tlb to References using Tools > References... menu in Microsoft Visual Basic for Applications.

Option Explicit

Private WithEvents m_translateSource As Chat
Private WithEvents m_demoSource As Chat
Dim OriginalSelection As Range

Sub TranslateSelection()
    Set OriginalSelection = Selection.Range
    Dim ProcessedText As String
    ProcessedText = OriginalSelection.Text
    m_translateSource.AskAsync "You are a professional translator to English. I will provide text and you will translate it to English.", ProcessedText
End Sub

Sub Translate_Initialize()
    Set m_translateSource = New ChatGptCom.Chat
End Sub

Sub m_translateSource_OnSendCompleted()
    OriginalSelection.Text = m_translateSource.Result
End Sub

Sub Chat_Initialize()
    Set m_demoSource = New ChatGptCom.Chat
End Sub

Sub Chat_Send()
    m_demoSource.AskAsync "You are a professional translator to English.", "To jest rewolucja szutcznej inteligencji! VBA na zawsze!"
End Sub

Sub m_demoSource_OnSendCompleted()
    MsgBox m_demoSource.Result
End Sub

Sub ChatGpt()
    Dim myObj As ChatGptCom.Chat
    Set myObj = New ChatGptCom.Chat
    myObj.AskAsync "You are a professional translato to English.", "Cześć, witamy z Office VBA"
End Sub

Sub GetEnvironmentVariable()
    Dim envVarName As String
    Dim envVarValue As String
    envVarName = "OPENAI_API_KEY"
    envVarValue = Environ(envVarName)
    MsgBox "The value of the " & envVarName & " environment variable is:" & vbCrLf & envVarValue
End Sub

Chat form:

Option Explicit

Private WithEvents m_chatSource As Chat

Private Sub UserForm_Initialize()
    Set m_chatSource = New ChatGptCom.Chat
    m_chatSource.Create "You are a helpful assistant", 2000, "gpt-3.5-turbo"
End Sub

Private Sub SendButton_Click()
    Dim MessageText As String
    MessageText = MessageTextBox.Text
    MessagesListBox.AddItem MessageText
    MessageTextBox.Text = ""
    m_chatSource.MessageAsync MessageText, "user", True
End Sub

Sub m_chatSource_OnSendCompleted()
    Dim MessageText As String
    MessageText = m_chatSource.Result
    MessagesListBox.AddItem MessageText
End Sub

Chat form:

Option Explicit

Private WithEvents m_chatSource As Chat

Private Sub UserForm_Initialize()
    Set m_chatSource = New ChatGptCom.Chat
    m_chatSource.Create "You are a helpful assistant", 2000, "gpt-3.5-turbo"
End Sub

Private Sub SendButton_Click()
    Dim MessageText As String
    MessageText = MessageTextBox.Text
    ChatTextBox.Text = ChatTextBox.Text & vbCrLf & MessageText
    MessageTextBox.Text = ""
    m_chatSource.MessageAsync MessageText, "user", True
End Sub

Sub m_chatSource_OnSendCompleted()
    Dim MessageText As String
    MessageText = m_chatSource.Result
    ChatTextBox.Text = ChatTextBox.Text & vbCrLf & MessageText
End Sub

NuGet

  • ChatGPT - An OpenAI api library for .NET.
  • ChatGPT.Core - An OpenAI client core library for .NET.
  • ChatGPT.UI - An OpenAI client user interface library for .NET.
  • ChatGPT.CLI - An .NET ChatGPT tool.
  • ChatGptCom - An OpenAI api library for .NET COM interop.

Docs

License

ChatGPT is licensed under the MIT license.

More Repositories

1

Core2D

A multi-platform data driven 2D diagram editor.
C#
835
star
2

Dock

A docking layout system.
C#
771
star
3

Svg.Skia

An SVG rendering library.
C#
382
star
4

PanAndZoom

Pan and zoom control for Avalonia.
C#
285
star
5

ColorPicker

Avalonia ColorPicker control
C#
174
star
6

BatchEncoder

BatchEncoder is an audio files conversion software.
C++
145
star
7

NodeEditor

A node editor control for Avalonia.
C#
144
star
8

NXUI

NXUI (nex-ui), next-gen UI - Create minimal Avalonia applications using C# 10 and .NET 6, 7 & 8
C#
136
star
9

ReactiveHistory

Reactive undo/redo framework for .NET.
C#
130
star
10

Avalonia.ThemeManager

Theme manager for Avalonia applications.
C#
87
star
11

AvaloniaDockApplication

Sample Dock application.
C#
60
star
12

wavtoac3encoder

WAV to AC3 Encoder an audio encoder which generates compressed audio streams based on ATSC A/52 specification
C++
35
star
13

HackerNews

HackerNews reader.
C#
34
star
14

DataBox

A DataGrid control based on ListBox control
C#
31
star
15

TreeDataGridEx

TreeDataGridEx is an experimental version of TreeDataGrid for Avalonia with added XAML syntax.
C#
30
star
16

SvgToXaml

Svg to xaml conveter.
C#
23
star
17

Avalonia.Skia.Lottie

An lottie animation player control for Avalonia.
C#
22
star
18

SpiroNet

The .NET C# port of libspiro - conversion between spiro control points and bezier's.
C#
19
star
19

SimpleWavSplitter

Split multi-channel WAV files into single channel WAV files.
C#
18
star
20

PackageReferenceEditor

MSBuild, csproj and props package reference editor.
C#
18
star
21

AwesomeWebAvalonia

Awesome Web Avalonia
17
star
22

EffectsDemo

Effect Demo for Avalonia using SkiaSharp
C#
16
star
23

HexView

HexView control for Avalonia.
C#
13
star
24

Draw2D

C#
11
star
25

WebDemos

C#
11
star
26

WpfUnitTests

Unit tests for WPF controls
C#
9
star
27

Spreadsheet

An experimental virtualized rows and columns DataGrid control created using ItemsRepeater/ListBox.
C#
9
star
28

VariableSizedWrapGrid

VariableSizedWrapGrid is a port of Windows UWP version of VariableSizedWrapGrid control for Avalonia based on WPF implemantation.
C#
8
star
29

MicroStationTagExplorer

MicroStation Tag Explorer
C#
7
star
30

RivePlayer

A rive animation player control for Avalonia.
C#
7
star
31

Trace

Trace is an application for transforming bitmaps into vector graphics using BitmapToVector library.
C#
7
star
32

YawPitchRollTransform

Yaw, Pitch and Roll transform for Avalonia
C#
6
star
33

AvaloniaDialog

C#
6
star
34

FastDraw2D

C#
6
star
35

Avalonia.Xaml.Behaviors

C#
6
star
36

AvaloniaWhatKey

Press any key to see Key enum value for Avalonia UI framework.
C#
5
star
37

DotNetCompress

An .NET compression tool. Supported file formats are Brotli and GZip.
C#
5
star
38

AvaloniaTutorialSamples

C#
5
star
39

wrpc

A Graphical User Interface for using the Wasabi Wallet RPC
C#
5
star
40

CustomControlDemo

Custom control demo for AvaloniaUI
C#
5
star
41

AvsDec

Decode avisynth audio stream to raw audio file and split multi-channel WAV files into single channel WAV files.
C++
5
star
42

MfcToolkit

MFC toolkit.
C++
4
star
43

AftenWindowsBuilds

Aften Windows Win32 and Win64 builds.
C
4
star
44

LayoutDemo

Experimental layout controls for AvaloniaUI
C#
4
star
45

LanguageEditor

A dedicated xml language translation files editor.
C#
4
star
46

PaletteGenerator

Palette generator using K-Means clustering algorithm for getting colors from images
C#
4
star
47

CompositorDemos

Avalonia compositor demos
C#
4
star
48

BasicDemo

C#
4
star
49

lols

Performance test: LOLs per second
C#
3
star
50

ImplicitCanvasAnimations

C#
3
star
51

SourceGenerators

Svg to C# Source Generators
C#
3
star
52

TemplatedDataGrid

A DataGrid control based on ListBox and Grid panels.
C#
3
star
53

GesturesDemo

Avalonia gesture recognizers generated by ChatGPT
C#
3
star
54

TypeArgumentsDemo

C#
2
star
55

TilePanelDemo

Experimental tile panel control.
C#
2
star
56

XamlAdorner

Set control adorner from xaml in Avalonia
C#
2
star
57

AttachedPropertyDemo

C#
2
star
58

VectorPaint

C#
2
star
59

SmoothPanelSample

C#
2
star
60

XmlParser

Experimental Xml parser for .NET
C#
2
star
61

CustomVirtualizingLayout

C#
2
star
62

KnobControlDemo

C#
2
star
63

DraggableControls

Draggable controls demo.
C#
2
star
64

SimpleDraw

C#
2
star
65

ReactiveNavigation

An navigation control for Avalonia
C#
2
star
66

GridDemo

Experimental tile control for Avalonia based on Grid panel.
C#
2
star
67

TestCustomDrawing

C#
2
star
68

CatML

A CatML is an alternative Xaml controls toolkit for Avalonia.
C#
2
star
69

SqlExtensions

C#
2
star
70

NonAffineImageTransform2

Port of Non-Affine Transforms in 2D by Charles Petzold to WPF
C#
2
star
71

SvgML_Demo

SvgML
C#
2
star
72

MorphingDemo

Geometry morphing demo for AvaloniaUI
C#
1
star
73

SvgGradientsDemo

C#
1
star
74

TreeDemo

TreeDataGrid node tree demo
C#
1
star
75

StylingParentRepro

C#
1
star
76

TypefaceUtil

An OpenType typeface utilities.
C#
1
star
77

BatchEncoderWx

BatchEncoder is an audio files conversion software (wxWidgets Demo).
C++
1
star
78

AvaloniaMinimized

C#
1
star
79

DataGridDemo

C#
1
star
80

LineEditor

Line Editor
C#
1
star
81

DbDemo

C#
1
star
82

RenderLoopTaskDemo

C#
1
star
83

HelloAvaloniaNdc

C#
1
star
84

AvaloniaResponsiveLayout

C#
1
star
85

Svg.Maui

Svg rendering support for Microsoft.Maui.Graphics
C#
1
star
86

WalletWasabiSandbox

C#
1
star
87

LogicSimulator

Asynchronous event-driven digital logic simulator
C#
1
star
88

InertiaDemo

C#
1
star
89

SpringAnimator

C#
1
star
90

PerspectiveDemo

C#
1
star
91

TicTacToeAI

C#
1
star
92

Painter

C#
1
star
93

merge

C#
1
star
94

DirectorySize

C#
1
star
95

Pong

Pong console and Avalonia game generated by ChatGPT
C#
1
star
96

FuzzyXaml

C#
1
star
97

PriorityChart

C#
1
star
98

Breakout

Atari Breakout game made by ChatGPT using Avalonia
C#
1
star
99

Spacewar

Spacewar! game made by ChatGPT using Avalonia
C#
1
star
100

ColorBlender

A .NET library for color matching and palette design.
C#
1
star