mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-11 00:06:04 +00:00
ruff
This commit is contained in:
@@ -15,31 +15,31 @@ from ..node import WorkflowNode, workflow_node, NodePort, NodeConfig
|
||||
class StoreDataNode(WorkflowNode):
|
||||
"""Store data node - save data to storage"""
|
||||
|
||||
type_name = "store_data"
|
||||
category = "action"
|
||||
icon = "💾"
|
||||
name = "store_data"
|
||||
description = "store_data"
|
||||
name_zh = "存储数据"
|
||||
name_en = "Store Data"
|
||||
description_zh = "将数据存储到持久化存储"
|
||||
description_en = "Store data to persistent storage"
|
||||
type_name = 'store_data'
|
||||
category = 'action'
|
||||
icon = '💾'
|
||||
name = 'store_data'
|
||||
description = 'store_data'
|
||||
name_zh = '存储数据'
|
||||
name_en = 'Store Data'
|
||||
description_zh = '将数据存储到持久化存储'
|
||||
description_en = 'Store data to persistent storage'
|
||||
|
||||
inputs: ClassVar[list[NodePort]] = []
|
||||
outputs: ClassVar[list[NodePort]] = []
|
||||
config_schema: ClassVar[list[NodeConfig]] = []
|
||||
|
||||
async def execute(self, inputs: dict[str, Any], context: ExecutionContext) -> dict[str, Any]:
|
||||
key = inputs.get("key", "")
|
||||
value = inputs.get("value")
|
||||
storage_type = self.get_config("storage_type", "session")
|
||||
prefix = self.get_config("key_prefix", "")
|
||||
key = inputs.get('key', '')
|
||||
value = inputs.get('value')
|
||||
storage_type = self.get_config('storage_type', 'session')
|
||||
prefix = self.get_config('key_prefix', '')
|
||||
|
||||
full_key = f"{prefix}{key}" if prefix else key
|
||||
full_key = f'{prefix}{key}' if prefix else key
|
||||
|
||||
if storage_type == "session":
|
||||
if storage_type == 'session':
|
||||
context.set_conversation_variable(full_key, value)
|
||||
else:
|
||||
context.set_variable(full_key, value)
|
||||
|
||||
return {"status": "stored"}
|
||||
return {'status': 'stored'}
|
||||
|
||||
Reference in New Issue
Block a user