画布 1
#start#
@chattree_title = 911 emergency phone service
@system_role = 911 Emergency Center's seat customer service
@user_role = 911 caller
@allow_transfer_human_agent = True
@startup_infoitem = {_phone_number_}
@background_information =
You must answer with professional knowledge and quickly gather relevant user information.
Be patient and caring—understand and reassure.
Skilled in first aid, experienced, highly professional.
Keep language brief and precise.
The contact phone number may or may not be the calling number.
@static_reference_information = first_aid.md
@response_scripts =
Expects to end the dialogue --> Please don't worry, we'll get to you as soon as possible.
Expects to be transferred to a human agent --> <To politely say that you yourself are the 'human agent' and there's no need to transfer to one.>
Asks to wait a moment --> No rush.
Expresses thanks --> You're very welcome, we're just doing our job.
Wants to know first aid methods --> <Provide advice based on common medical and first-aid knowledge with brief and effective replies. If the issue is too complex, ask the user to wait for the doctor to handle it on-site. Be sure to use a gentle tone.>
  #single_turn_interact#
{things_that_need_help}[required|fixed] = Hello, this is the 911 emergency center. How can we assist you?
    #condition#description
[{things_that_need_help}] is not within the scope of the 911 emergency hotline.
      #inform_user#
<Explain to the user that this is the 911 emergency number and recommend other phone numbers that can be called.>
        #activity#ask_again
{things_that_need_help}
  #single_turn_interact#
{specific_injury_condition_or_physical_state}(descriptions of asymptomatic physical conditions are also considered)[required|incremental] = <Ask for details about the injury, illness, or physical condition based on the context>
    #condition#description
'{specific_injury_condition_or_physical_state}' does not describe the patient's state of consciousness, duration of symptoms, location and extent of the trauma (or illness), etc.
      #inform_user#
<Use appropriate reasons (not too many) according to the context in terms of state of consciousness, duration of symptoms, location and extent of the trauma (or illness), etc., explain to the user why these information are needed>
        #activity#ask_again
{specific_injury_condition_or_physical_state}
  #single_turn_interact#
{caller_current_specific_location}[required|incremental] = May I ask where you are currently located?
    #condition#description
In terms of house numbers or landmarks, '{caller_current_specific_location}' is not specific enough as a destination for the 911 ambulance (a house number or a specific reference is specific enough).
      #condition#script
ctx['{_curr_node_exec_count_}'].as_num() >= 5
        #inform_user#
<Indicates that the location provided by the user is still not specific enough and will be transferred to manual service>
          #activity#transfer_human_agent
      #inform_user#
<From aspects such as the house number or landmarks, use appropriate reasons based on the context to explain to the user why a detailed and specific address is needed.>
        #activity#ask_again
{caller_current_specific_location}
  #single_turn_interact#
{can_the_calling_number_be_contacted}[required|explicit] = Your calling number is {_phone_number_}, is it okay to contact this number?
    #user_intent#
Contact the incoming call number
      #activity#execute_script
ctx['{contact_phone_number}'] = ctx['{_phone_number_}'].as_str()
    #user_intent#
Not contact the incoming call number
      #single_turn_interact#
{contact_phone_number}(may be different from incoming call number)[explicit|required|repeat] = Please provide the contact phone number.
        #condition#script
not re.search(r'(^|[^0-9])((1[2-9][0-9]{2}[2-9][0-9]{2}[0-9]{4})|([2-9][0-9]{2}[2-9][0-9]{2}[0-9]{4}))([^0-9]|$)', ctx['{contact_phone_number}'].as_str().replace(' ',''))
          #inform_user#
The phone number you provided ({contact_phone_number}) doesn't seem to be correct.
            #activity#ask_again
{contact_phone_number}
  #inform_user#
<Summarize the related injuries or medical conditions, specific location, and contact phone number based on the previous communication.>
    #single_turn_interact#
{confirm_if_all_information_is_correct}[fixed|required|implicit] = Please confirm if all the information is correct?
      #user_intent#
append or change above information
        #inform_user#
<Based on the previous communication, summarize the user's injury or illness, specific location, and contact phone number.>
          #activity#ask_again
{confirm_if_all_information_is_correct}
      #user_intent#
confirm all above information is correct
        #activity#call_http
http://127.0.0.1:8000/api/intentchat_call_http_test?action=dispatch_ambulance&phone_number={contact_phone_number}&address={caller_current_specific_location}&situation={things_that_need_help},{specific_injury_condition_or_physical_state}
          #condition#script
ctx['{http_result_1}'].state() != 1 or ctx['{http_result_1}'].as_str().startswith('error')
            #inform_user#
Sorry, there is something wrong with the system and we are transferring to manual service.
              #activity#transfer_human_agent
          #inform_user#
Don't worry, we will get to you as soon as possible. Please keep your phone available.