<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from bottle import route, run, get, request, Bottle, redirect, static_file
from FirebaseClient import *
from imojify import imojify_app
from WitClient import *

root = Bottle()
root.mount('imojify', imojify_app)


@root.get('/')
def server_root():
    return "WELCOME to jitalk"


@root.get('/firebase')
def firebase_client():
    # check the FirebaseClient class 

    firebaseInstance = FirebaseClient()
    
    # print firebaseInstance.postChat("-JcUVyYt9eBbWTWrw64V", "Mahmoud", "Order matters")
    # roomID = firebaseInstance.createRoom();

    return None


@root.get('/createRoom')
def create_room():
    firebaseInstance = FirebaseClient()
    roomID = firebaseInstance.createRoom()
    redirect('/room/'+roomID)


@root.get('/room/<roomID>')
def chat_room(roomID):
    # you can share the room so others can join you
    # embed the roomID into the return page
    # return page
    return roomID


@root.get('/sendMessage')
def post_message():
    #jsonData = json.load(request.json)
    #jsonData.data = {roomID: "", username: "", text: ""}
    wit = WitClient()
    firebaseInstance = FirebaseClient()
    
    response = wit.text_query("How many hours left?")
    
    
    wit.close_connection()
    return "message has been sent!"

root.run(host='0.0.0.0', port=8080, debug=True)<commit_msg>wit handle<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from bottle import route, run, get, request, Bottle, redirect, static_file, SimpleTemplate, TEMPLATE_PATH, template
from FirebaseClient import *
from imojify import imojify_app
from WitClient import *

TEMPLATE_PATH.insert(0, './views')

root = Bottle()
root.mount('imojify', imojify_app)


@root.get('/')
def server_root():
    # return "WELCOME to jitalk"
    
    return template('index', None)

@root.get('/firebase')
def firebase_client():
    # check the FirebaseClient class 

    firebaseInstance = FirebaseClient()
    
    # print firebaseInstance.postChat("-JcUVyYt9eBbWTWrw64V", "Mahmoud", "Order matters")
    # roomID = firebaseInstance.createRoom();

    return None


@root.get('/createRoom')
def create_room():
    firebaseInstance = FirebaseClient()
    roomID = firebaseInstance.createRoom()
    redirect('/room/'+roomID)


@root.get('/room/<roomID>')
def chat_room(roomID):
    # you can share the room so others can join you
    # embed the roomID into the return page
    # return page
    return roomID

def handle_wit(object):
    # object = {[{"_text":"How many hours left?","confidence":0.62,"entities":
    # {"object":[{"value":"many"},{"value":"hours lef"}],
    # "question":[{"value":"How"}]},"intent":"get_question"}]}

    # object['entities'] = {"object":[{"value":"many"},{"value":"hours lef"}]
    
    return "HELLO"

@root.get('/sendMessage')
def post_message():
    #jsonData = json.load(request.json)
    #jsonData.data = {roomID: "", username: "", text: ""}
    wit = WitClient()
    firebaseInstance = FirebaseClient()
    
    response = wit.text_query("How many hours left?")
    
    
    wit.close_connection()
    return "message has been sent!"

root.run(host='0.0.0.0', port=8080, debug=True)
{'fraction_non_alphanumeric': 0.1511627906976744, 'fraction_numerical': 0.008799497171590195, 'mean_word_length': 3.9502332814930017, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '717183', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1045, 'n_words': 247}