diff --git a/README.md b/README.md index 8f41a81..a4f7c80 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ The usage guide for the Cacti chatbot is available [here](./usage_guide.md) ## Steps to add new widget command - Update `widgets.yaml` with the widget command details + - If no value has to be returned please specify an empty string '' for `return_value_description` - Increment the numeric version in `WIDGET_INDEX_NAME` constant in `utils/constants.py` - For local env, the widget index name would use your OS login name to create an isolated index. For dev/prod, the widget index would be the numeric version mentioned above. (more info in `scripts/check_update_widget_index.py`) - Run this Python command to update your widget index with the new widget `python -m scripts.check_update_widget_index` diff --git a/chat/display_widgets.py b/chat/display_widgets.py index 67fdc5f..9236f0d 100644 --- a/chat/display_widgets.py +++ b/chat/display_widgets.py @@ -170,13 +170,25 @@ def _widgetize_inner(command: str, params: str, depth: int = 0) -> str: lines.append(f"yield protocol borrow action for borrow token: {items[0]}, borrow amount: {items[1]}, collateral token: {items[2]}, collateral amount: {items[3]}.") elif command == 'yield-protocol-borrow-close': items = params.split(",") - lines.append(f"yield protocol borrow close action: {items[0]}") + lines.append(f"yield protocol borrow close action: {items[0]}") elif command == 'hop-protocol-bridge': items = params.split(",") lines.append(f"hop protocol bridge action for amount: {items[0]}, token symbol: {items[1]}, from chain: {items[2]}, to chain: {items[3]}.") elif command == 'tx-replay': items = params.split(",") lines.append(f"replay transaction with tx hash: {items[0]}") + elif command == "deposit-eth-lido": + items = params.split(",") + lines.append(f"deposit eth to lido action for amount: {items[0]}.") + elif command == "withdraw-eth-lido": + items = params.split(",") + lines.append(f"withdraw eth from lido action for amount: {items[0]}.") + elif command == "deposit-eth-reth": + items = params.split(",") + lines.append(f"deposit eth to reth action for amount: {items[0]}.") + elif command == "withdraw-eth-reth": + items = params.split(",") + lines.append(f"withdraw eth from reth action for amount: {items[0]}.") else: # assert 0, f'unrecognized command: {command}({params})' lines.append(f"An unrecognized command: {command}({params})") diff --git a/knowledge_base/widgets.yaml b/knowledge_base/widgets.yaml index afeb6c9..099f4ba 100644 --- a/knowledge_base/widgets.yaml +++ b/knowledge_base/widgets.yaml @@ -731,4 +731,48 @@ required: - txHash type: object - return_value_description: "" \ No newline at end of file + return_value_description: "" +- _name_: display_deposit_eth_lido + description: This widget is only used when the user wants to deposit/stake ETH into the Lido protocol to get steth + parameters: + properties: + amount: + description: Amount of ETH to deposit/stake into Lido (and obtain stETH) + type: string + required: + - amount + type: object + return_value_description: '' +- _name_: display_withdraw_eth_lido + description: This widget is only used when the user wants to withdraw ETH from Lido (convert stETH to ETH) + parameters: + properties: + amount: + description: Amount of ETH to withdraw from Lido + type: string + required: + - amount + type: object + return_value_description: '' +- _name_: deposit_eth_reth + description: This widget is only used when the user wants to deposit ETH into the rocket pool protocol to get rETH + parameters: + properties: + amount: + description: Amount of ETH to deposit into rocket pool (and obtain rETH) + type: string + required: + - amount + type: object + return_value_description: '' +- _name_: display_withdraw_eth_reth + description: This widget is only used when the user wants to withdraw ETH from rETH (convert rETH to ETH) + parameters: + properties: + amount: + description: Amount of ETH to withdraw from rocket pool + type: string + required: + - amount + type: object + return_value_description: '' \ No newline at end of file diff --git a/utils/constants.py b/utils/constants.py index 20bfb48..b65c534 100644 --- a/utils/constants.py +++ b/utils/constants.py @@ -53,7 +53,7 @@ WIDGET_INFO_TOKEN_LIMIT = 4000 # Widget Index -WIDGET_INDEX_NAME = "WidgetV22" +WIDGET_INDEX_NAME = "WidgetV23" def get_widget_index_name(): if env.is_local():