-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
47 lines (40 loc) · 1.58 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
namespace Bluebird_TTS;
using OpenAI;
// DID I REALLY CALL MY SOLUTION BlueBird TTS INSTEAD OF BlackBird STT ASJNUEFMKNIUEOK
// ok im good now
//right Im going to give my teacher a link to this repo and see what she says
static class Program
{
[STAThread]
static void Main()
{
Directory.CreateDirectory(Variable.OutputFolder);
Directory.CreateDirectory(Variable.ConfigFilePath);
//Checks if openai file is present in config folder
if (!File.Exists(Variable.ConfigFilePath + "/.openai"))
{
File.Create(Variable.ConfigFilePath + "/.openai").Close();
// Now we need to write the api key placeholder to the file using a streamwriter
using (StreamWriter Add_place_holder = new StreamWriter(Variable.ConfigFilePath + "/.openai"))
{
Add_place_holder.WriteLine("{\n" + "\t\"apiKey\": \"sk-<your api key here>\"" + "\n}");
}
}
// very important this makes a folder in %appdata% for the program to store temp files
try
{
Variable.AiClient = new OpenAIClient(OpenAIAuthentication.LoadFromDirectory(Variable.ConfigFilePath));
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
ApplicationConfiguration.Initialize();
Application.Run(new MainWindow());
}
//god what a mess
//why did i do this in winforms. i could have have a lovely wpf app or even a ASP.NET app I love asp
// but NOOOO i had to do it in winforms
// i hate myself
}