为了账号安全,请及时绑定邮箱和手机立即绑定

Botframework V4:Python Cosmos DB 配置

Botframework V4:Python Cosmos DB 配置

明月笑刀无情 2022-06-22 18:20:03
我目前正在尝试使用 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 似乎没有完全实现/经测试可以使用。我这样做对吗?当前没有可使用的样本。
查看完整描述

1 回答

?
慕哥9229398

TA贡献1877条经验 获得超6个赞

查看完整回答
反对 回复 2022-06-22
  • 1 回答
  • 0 关注
  • 99 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信