Closed willhuo closed 1 year ago
` 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); } }
`
I find the bug finally. The async method caused the problem.
` 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 });
`