-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (30 loc) · 1.11 KB
/
Copy pathProgram.cs
File metadata and controls
36 lines (30 loc) · 1.11 KB
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
using DeepSeekDotNet.Helpers;
using DeepSeekDotNet.Services;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
var configuration = new ConfigurationBuilder()
.SetBasePath(AppContext.BaseDirectory)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.Build();
var serviceProvider = new ServiceCollection()
.AddSingleton<IConfiguration>(configuration)
.AddSingleton<IDeepSeekService, DeepSeekService>()
.BuildServiceProvider();
var deepSeekService = serviceProvider.GetRequiredService<IDeepSeekService>();
UtilHelper.BotResponse(await deepSeekService.MessageAsync(""));
while (true)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("Você: ");
Console.ResetColor();
var userInput = Console.ReadLine();
if (string.Equals(userInput, "exit", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("Adeus! Foi um prazer conversar com você.");
break;
}
if (!string.IsNullOrEmpty(userInput))
{
UtilHelper.BotResponse(await deepSeekService.MessageAsync(userInput));
}
}