Change ConversationState to ConcurrentDictionary

This commit is contained in:
Haiping Chen 2025-09-18 19:20:58 -05:00
parent b09d294fcd
commit a283af0623
4 changed files with 8 additions and 5 deletions

View file

@ -1,6 +1,8 @@
using System.Collections.Concurrent;
namespace BotSharp.Abstraction.Conversations.Models; namespace BotSharp.Abstraction.Conversations.Models;
public class ConversationState : Dictionary<string, StateKeyValue> public class ConversationState : ConcurrentDictionary<string, StateKeyValue>
{ {
public ConversationState() public ConversationState()
{ {

View file

@ -80,6 +80,7 @@ public partial class KnowledgeService
}).ToList(); }).ToList();
var vectorDb = GetVectorDb(); var vectorDb = GetVectorDb();
if (vectorDb == null) return [];
var dbCollections = await vectorDb.GetCollections(); var dbCollections = await vectorDb.GetCollections();
return configs.Where(x => dbCollections.Contains(x.Name)); return configs.Where(x => dbCollections.Contains(x.Name));
} }

View file

@ -1,4 +1,4 @@
using System.Text.Json; using System.Text.Json;
using BotSharp.Abstraction.Conversations; using BotSharp.Abstraction.Conversations;
using BotSharp.Abstraction.Conversations.Enums; using BotSharp.Abstraction.Conversations.Enums;
using BotSharp.Abstraction.Conversations.Models; using BotSharp.Abstraction.Conversations.Models;
@ -69,7 +69,7 @@ namespace BotSharp.Plugin.Google.Core
public ConversationState GetCurrentState() public ConversationState GetCurrentState()
{ {
return new ConversationState { { "StateKey", new StateKeyValue { Key = "Key", Values = new List<StateValue>()} } }; return new ConversationState();
} }
public void SetCurrentState(ConversationState state) public void SetCurrentState(ConversationState state)

View file

@ -13,7 +13,7 @@
"labels": [ "experiment" ], "labels": [ "experiment" ],
"llmConfig": { "llmConfig": {
"provider": "openai", "provider": "openai",
"model": "gpt-4.1-nano" "model": "gpt-5-nano"
}, },
"routingRules": [ "routingRules": [
{ {