Pork
Pork
CC#
Created by Pork on 6/27/2023 in #help
❔ A good dynamic data storage
Basically im using a python program to get topics from a youtube chat and write it to a json which a c# program picks up, everyone tells me that its a bad idea and i have had many problems. Does anyone know any alternatives
14 replies
CC#
Created by Pork on 6/25/2023 in #help
❔ Error parsing infinity for json, Happens randomly.
Error: I keep getting the error parsing infinity while selecting a random string from my json array, It does this at random and I have no idea why. I have a temporary fix at line 49 but it is making the scene restart multiple times and is just not pleasant one bit Snippet:
void Start()
{
_openAI = new OpenAIApi(openAIKey);

_client.DefaultRequestHeaders.Add("Authorization", $"Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes($"{uberDuckKey}:{uberDuckSecret}"))}");

// Pick a random topic
List<string> topics = JsonConvert.DeserializeObject<List<string>>(
File.ReadAllText($"{Application.dataPath}/Scripts/topics.json"));

blacklistPath = $"{Application.dataPath}/Scripts/blacklist.json";
blacklist = JsonConvert.DeserializeObject<List<string>>(File.ReadAllText(blacklistPath));
topics.RemoveAll(t => blacklist.Contains(t));

string topic = topics[_random.Next(0, topics.Count)];
void Start()
{
_openAI = new OpenAIApi(openAIKey);

_client.DefaultRequestHeaders.Add("Authorization", $"Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes($"{uberDuckKey}:{uberDuckSecret}"))}");

// Pick a random topic
List<string> topics = JsonConvert.DeserializeObject<List<string>>(
File.ReadAllText($"{Application.dataPath}/Scripts/topics.json"));

blacklistPath = $"{Application.dataPath}/Scripts/blacklist.json";
blacklist = JsonConvert.DeserializeObject<List<string>>(File.ReadAllText(blacklistPath));
topics.RemoveAll(t => blacklist.Contains(t));

string topic = topics[_random.Next(0, topics.Count)];
Full Code: https://paste.ofcode.org/QYQsqkuvYuU9JgFf8vsGGS
16 replies