I want to input part number from the bot. part no can be of any format the bot is running in oop how can I do that if user enters anything it should directly go to actions.py right now it is getting confused and running in loop. Your input → hi ? Hi, I’m here to assist you! 1: Part (/part) ? What can I help you with? 1: Check Part Availability (/check_part_av ailability) Please provide the part number. Your input → part345 ? What can I help you with? (Use arrow keys) » 1: Check Part Availability (/check_part_availability) 2: Part Price and Cost Check (/check_price_part_and_cost) Type out your own message… the part no can be anything …Please help
Hello,
It looks like your bot is not correctly handling part numbers due to the confusion in input parsing. To fix this, you can adjust your actions.py
to directly accept any input as a part number. Here’s a simplified approach:
- In your bot configuration, ensure that the part number is captured as a free-form text input.
- Update your
actions.py
to process the input directly.
python
class ActionCheckPartAvailability(Action):
def name(self) -> Text:
return "action_check_part_availability"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
part_number = tracker.latest_message.get('text') # Capture any input as part number
# Your logic to check part availability based on part_number
dispatcher.utter_message(text=f"Checking availability for part number: {part_number}")
return []
This way, any input will be taken as the part number, avoiding the loop.
Best Regards, Jack Henry