我目前正在尝试使用 CosmosDB 作为状态存储,但是当机器人尝试在 CosmosDB 中保存状态时遇到了一些问题。下面是我使用 CosmosDB 作为中间件的代码LOOP = asyncio.get_event_loop()APP = Flask(__name__)APP.config.update(VaultConfig.get_config())APP.wsgi_app = BotTelemetryMiddleware(APP.wsgi_app)PORT = APP.config["Settings"]["Port"]INSTRUMENTATION_KEY = APP.config['Settings']["appinsight_instrumentation_key"]TELEMETRY_CLIENT = ApplicationInsightsTelemetryClient(INSTRUMENTATION_KEY)SETTINGS = BotFrameworkAdapterSettings( APP.config["Settings"]["AppId"], APP.config["Settings"]["AppPassword"])cosmos_config = APP.config['COSMOS']# Create CosmosStorage and ConversationStatecosmos = CosmosDbStorage(CosmosDbConfig(endpoint=cosmos_config['endpoint'], masterkey=cosmos_config['masterKey'], database=cosmos_config['database'], container=cosmos_config['container'], partition_key='/id'))# Create MemoryStorage, UserState and ConversationStateUSER_STATE = UserState(cosmos)CONVERSATION_STATE = ConversationState(cosmos)ADAPTER = BotFrameworkAdapter(SETTINGS)ADAPTER.on_turn_error = on_error我收到的错误:Traceback (most recent call last): File "/bot/venv/lib/python3.7/site-packages/botbuilder/core/bot_adapter.py", line 95, in run_pipeline context, callback File "/bot/venv/lib/python3.7/site-packages/botbuilder/core/middleware_set.py", line 69, in receive_activity_with_status return await self.receive_activity_internal(context, callback) File "/bot/venv/lib/python3.7/site-packages/botbuilder/core/middleware_set.py", line 79, in receive_activity_internal return await callback(context) File "/bot/main.py", line 146, in aux_func await BOT.on_turn(turn_context) File "/bot/bots/dialog_bot.py", line 46, in on_turn await self.conversation_state.save_changes(turn_context, False)尝试修改此文件 /bot/venv/lib/python3.7/site-packages/botbuilder/azure/cosmosdb_storage.py 以获取临时补丁似乎让我陷入了一个兔子洞,这使得 CosmosDB 似乎没有完全实现/经测试可以使用。我这样做对吗?当前没有可使用的样本。
添加回答
举报
0/150
提交
取消