PawanOsman / ChatGPT.Net

C# library for ChatGPT using official OpenAI API
https://www.nuget.org/packages/ChatGPT.Net
MIT License
379 stars 71 forks source link

program stopped without any prompt #15

Closed willhuo closed 1 year ago

willhuo commented 1 year ago

111

` private static async Task ChatgptNetTestAsync() { var chatGpt = new ChatGpt(new ChatGptConfig { UseCache = true }); await chatGpt.WaitForReady(); var chatGptClient = await chatGpt.CreateClient(new ChatGptClientConfig { SessionToken = "eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..", AccountType = AccountType.Free });

    //init unique conversation id
    //var conversationId = Guid.NewGuid().ToString("N");
    var conversationId = "a-unique-string-id";

    while (true)
    {
        Serilog.Log.Information("pls ask a question");
        var question = Console.ReadLine();
        var response = await chatGptClient.Ask(question, conversationId);
        Serilog.Log.Information("answer:{0}", response);            
    }
}

`

willhuo commented 1 year ago

I find the bug finally. The async method caused the problem.