Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-wit

Package Overview
Dependencies
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-wit - npm Package Compare versions

Comparing version 6.2.2 to 6.3.0

2

lib/config.js

@@ -6,4 +6,4 @@ /**

module.exports = {
DEFAULT_API_VERSION: '20210928',
DEFAULT_API_VERSION: 20220608,
DEFAULT_WIT_URL: 'https://api.wit.ai',
};

@@ -42,2 +42,5 @@ /**

});
wit.on('partialUnderstanding', rsp => {
console.log('Live understanding: ' + JSON.stringify(rsp));
});

@@ -44,0 +47,0 @@ rl.on('line', line => {

@@ -6,4 +6,4 @@ /**

module.exports = {
DEFAULT_API_VERSION: '20210928',
DEFAULT_API_VERSION: 20220608,
DEFAULT_WIT_URL: 'https://api.wit.ai',
};

@@ -42,2 +42,5 @@ /**

});
wit.on('partialUnderstanding', rsp => {
console.log('Live understanding: ' + JSON.stringify(rsp));
});

@@ -44,0 +47,0 @@ rl.on('line', line => {

@@ -15,2 +15,4 @@ /**

const LIVE_UNDERSTANDING_API_VERSION = 20220608;
class Wit extends EventEmitter {

@@ -82,2 +84,5 @@ constructor(opts) {

const live_understanding_enabled =
apiVersion >= LIVE_UNDERSTANDING_API_VERSION;
const req = fetch(fullURL, {

@@ -106,10 +111,17 @@ body,

}
for (const {error, intents, text} of parseResponse(contents)) {
for (const rsp of parseResponse(contents)) {
const {error, intents, is_final, text} = rsp;
// Live transcription
if (!(error || intents)) {
logger.debug('[speech] partialTranscription:', text);
this.emit('partialTranscription', text);
} else if (text) {
logger.debug('[speech] fullTranscription:', text);
this.emit('fullTranscription', text);
}
// Live understanding
if (live_understanding_enabled && intents && !is_final) {
logger.debug('[speech] partialUnderstanding:', rsp);
this.emit('partialUnderstanding', rsp);
}
}

@@ -123,3 +135,11 @@ });

.then(response => Promise.all([response.text(), response.status]))
.then(([contents, status]) => [parseResponse(contents).pop(), status])
.then(([contents, status]) => {
const finalResponse = parseResponse(contents).pop();
const {text} = finalResponse;
logger.debug('[speech] fullTranscription:', text);
this.emit('fullTranscription', text);
return [finalResponse, status];
})
.catch(e => e)

@@ -126,0 +146,0 @@ .then(makeWitResponseHandler(logger, 'speech'));

@@ -15,2 +15,4 @@ /**

const LIVE_UNDERSTANDING_API_VERSION = 20220608;
class Wit extends EventEmitter {

@@ -82,2 +84,5 @@ constructor(opts) {

const live_understanding_enabled =
apiVersion >= LIVE_UNDERSTANDING_API_VERSION;
const req = fetch(fullURL, {

@@ -106,10 +111,17 @@ body,

}
for (const {error, intents, text} of parseResponse(contents)) {
for (const rsp of parseResponse(contents)) {
const {error, intents, is_final, text} = rsp;
// Live transcription
if (!(error || intents)) {
logger.debug('[speech] partialTranscription:', text);
this.emit('partialTranscription', text);
} else if (text) {
logger.debug('[speech] fullTranscription:', text);
this.emit('fullTranscription', text);
}
// Live understanding
if (live_understanding_enabled && intents && !is_final) {
logger.debug('[speech] partialUnderstanding:', rsp);
this.emit('partialUnderstanding', rsp);
}
}

@@ -123,3 +135,11 @@ });

.then(response => Promise.all([response.text(), response.status]))
.then(([contents, status]) => [parseResponse(contents).pop(), status])
.then(([contents, status]) => {
const finalResponse = parseResponse(contents).pop();
const {text} = finalResponse;
logger.debug('[speech] fullTranscription:', text);
this.emit('fullTranscription', text);
return [finalResponse, status];
})
.catch(e => e)

@@ -126,0 +146,0 @@ .then(makeWitResponseHandler(logger, 'speech'));

{
"name": "node-wit",
"version": "6.2.2",
"version": "6.3.0",
"description": "Wit.ai Node.js SDK",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc