1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-11-24 04:31:31 +03:00

feat: allow HTML output

This commit is contained in:
Louistiti 2019-03-24 08:17:40 +08:00
parent 82ebbee568
commit ec3f02dfaf
3 changed files with 8 additions and 5 deletions

View File

@ -92,7 +92,7 @@ export default class Chatbot {
container.className = `bubble-container ${who}`
bubble.className = 'bubble'
bubble.textContent = string
bubble.innerHTML = string
this.feed.appendChild(container).appendChild(bubble)

View File

@ -6,12 +6,12 @@ from os import path, environ
from pathlib import Path
from random import choice
from sys import argv, stdout
from re import findall
from vars import useragent
from tinydb import TinyDB, Query, operations
from time import sleep
import sqlite3
import requests
import re
dirname = path.dirname(path.realpath(__file__))

View File

@ -48,16 +48,19 @@ class Brain {
/**
* Make Leon talk
*/
talk (speech) {
talk (rawSpeech) {
log.title('Leon')
log.info('Talking...')
if (speech !== '') {
if (rawSpeech !== '') {
if (process.env.LEON_TTS === 'true') {
// Stripe HTML
const speech = rawSpeech.replace(/<(?:.|\n)*?>/gm, '')
this.tts.add(speech)
}
this.socket.emit('answer', speech)
this.socket.emit('answer', rawSpeech)
}
}