Commit 5d5ea325 authored by Yoann HOUPERT's avatar Yoann HOUPERT
Browse files

syncronisation respons offline online

parent 4142f7a5
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
const routesFactory = config => { const routesFactory = config => {
/* eslint new-cap: ["error", { "capIsNew": false }] */ /* eslint new-cap: ["error", { "capIsNew": false }] */
const routes = require('express').Router(); const routes = require('express').Router();
const uuidv1 = require('uuid/v1');
const enhancer = require('../controller/speech-enhancement')(config.speechEnhancement); const enhancer = require('../controller/speech-enhancement')(config.speechEnhancement);
const stt = require('../controller/speech-to-text')(config.gstreamer); const stt = require('../controller/speech-to-text')(config.gstreamer);
const offline = require('../controller/offline')(config.offline); const offline = require('../controller/offline')(config.offline);
...@@ -40,8 +41,19 @@ const routesFactory = config => { ...@@ -40,8 +41,19 @@ const routesFactory = config => {
const json = JSON.parse(body); const json = JSON.parse(body);
if (json.status === 5) { if (json.status === 5) {
return res.status(500).send('Error while transcript the audio.'); return res.status(500).send('Error while transcript the audio.');
} else if (err) {
return res.status(500).send('Error while transcript the audio : ' + err);
} }
return res.status(200).json({message: 'transcript done', hypotheses: json});
const jsonResponse = {
status: 0,
hypotheses: [{
utterance: json.transcript
}],
id: uuidv1()
};
return res.status(200).json({message: 'transcript done', transcript: jsonResponse});
}); });
} else { } else {
stt.transcript(body, (err, httpResponse, body) => { stt.transcript(body, (err, httpResponse, body) => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment