mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
⚡ Small improvements to Google Cloud Natural Language
This commit is contained in:
parent
cbc1b7f2a3
commit
8aa50df457
|
@ -22,7 +22,7 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
|||
description: INodeTypeDescription = {
|
||||
displayName: 'Google Cloud Natural Language',
|
||||
name: 'googleCloudNaturalLanguage',
|
||||
icon: 'file:googleCloudnaturallanguage.png',
|
||||
icon: 'file:googlecloudnaturallanguage.png',
|
||||
group: ['input', 'output'],
|
||||
version: 1,
|
||||
description: 'Consume Google Cloud Natural Language API',
|
||||
|
@ -77,35 +77,6 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
|||
// ----------------------------------
|
||||
// All
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Document Type',
|
||||
name: 'documentType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Unspecified',
|
||||
value: 'TYPE_UNSPECIFIED',
|
||||
},
|
||||
{
|
||||
name: 'Plain Text',
|
||||
value: 'PLAIN_TEXT',
|
||||
},
|
||||
{
|
||||
name: 'HTML',
|
||||
value: 'HTML',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'The type of input document.',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'analyzeSentiment',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Source',
|
||||
name: 'source',
|
||||
|
@ -167,39 +138,6 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding Type',
|
||||
name: 'encodingType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'None',
|
||||
value: 'NONE',
|
||||
},
|
||||
{
|
||||
name: 'UTF-8',
|
||||
value: 'UTF8',
|
||||
},
|
||||
{
|
||||
name: 'UTF-16',
|
||||
value: 'UTF16',
|
||||
},
|
||||
{
|
||||
name: 'UTF-32',
|
||||
value: 'UTF32',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'The encoding type used by the API to calculate sentence offsets.',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'analyzeSentiment',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
|
@ -215,6 +153,49 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
|||
description: '',
|
||||
placeholder: 'Add Option',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Document Type',
|
||||
name: 'documentType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'HTML',
|
||||
value: 'HTML',
|
||||
},
|
||||
{
|
||||
name: 'Plain Text',
|
||||
value: 'PLAIN_TEXT',
|
||||
},
|
||||
],
|
||||
default: 'PLAIN_TEXT',
|
||||
description: 'The type of input document.',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding Type',
|
||||
name: 'encodingType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'None',
|
||||
value: 'NONE',
|
||||
},
|
||||
{
|
||||
name: 'UTF-8',
|
||||
value: 'UTF8',
|
||||
},
|
||||
{
|
||||
name: 'UTF-16',
|
||||
value: 'UTF16',
|
||||
},
|
||||
{
|
||||
name: 'UTF-32',
|
||||
value: 'UTF32',
|
||||
},
|
||||
],
|
||||
default: 'UTF16',
|
||||
description: 'The encoding type used by the API to calculate sentence offsets.',
|
||||
},
|
||||
{
|
||||
displayName: 'Language',
|
||||
name: 'language',
|
||||
|
@ -304,9 +285,9 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
|||
if (resource === 'document') {
|
||||
if (operation === 'analyzeSentiment') {
|
||||
const source = this.getNodeParameter('source', i) as string;
|
||||
const documentType = this.getNodeParameter('documentType', i) as string;
|
||||
const encodingType = this.getNodeParameter('encodingType', i) as string;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
const encodingType = (options.encodingType as string | undefined) || 'UTF16';
|
||||
const documentType = (options.documentType as string | undefined) || 'PLAIN_TEXT';
|
||||
|
||||
const body: IData = {
|
||||
document: {
|
||||
|
|
Before Width: | Height: | Size: 541 B After Width: | Height: | Size: 541 B |
Loading…
Reference in a new issue