Exemplo n.º 1
0
def text():
    backend = get_backend()
    message = request.args.get('message')
    displayed_message = format_message("You: {}".format(message), False)
    uid = userid()
    time_taken = float(request.args.get('time_taken'))
    received_time = time.time()
    start_time = received_time - time_taken
    chat_info = backend.get_chat_info(uid)
    backend.send(
        uid,
        Event.MessageEvent(chat_info.agent_index, message, str(received_time),
                           str(start_time)))
    return jsonify(message=displayed_message)
Exemplo n.º 2
0
def text():
    backend = get_backend()
    message = request.args.get('message')
    logger.debug("User %s said: %s" % (userid_prefix(), message))
    # utf-8
    encoded_message = message.encode('utf-8')
    displayed_message = format_message("You: {}".format(encoded_message),
                                       False)
    uid = userid()
    time_taken = float(request.args.get('time_taken'))
    received_time = time.time()
    start_time = received_time - time_taken
    chat_info = backend.get_chat_info(uid)
    backend.send(
        uid,
        Event.MessageEvent(chat_info.agent_index, message, str(received_time),
                           str(start_time)))
    return jsonify(message=displayed_message)