mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
Add appSettings field and CreateQuestionAsync method
The `ChatService` class now includes a private readonly field `appSettings`, initialized via the constructor. A new method `CreateQuestionAsync` has been added to handle question creation asynchronously, leveraging chat history. Additionally, a comment has been updated for clarity regarding chunk limitations.
This commit is contained in:
@@ -9,6 +9,8 @@ namespace SqlDatabaseVectorSearch.Services;
|
||||
|
||||
public class ChatService(IChatCompletionService chatCompletionService, TokenizerService tokenizerService, HybridCache cache, IOptions<AppSettings> appSettingsOptions)
|
||||
{
|
||||
private readonly AppSettings appSettings = appSettingsOptions.Value;
|
||||
|
||||
public async Task<string> CreateQuestionAsync(Guid conversationId, string question)
|
||||
{
|
||||
var chat = await GetChatHistoryAsync(conversationId);
|
||||
@@ -62,7 +64,7 @@ public class ChatService(IChatCompletionService chatCompletionService, Tokenizer
|
||||
var tokenCount = tokenizerService.CountTokens(text);
|
||||
if (tokenCount > tokensAvailable)
|
||||
{
|
||||
// There isn't enough space to add the text.
|
||||
// There isn't enough space to add the chunks.
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user