-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
600 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
{ | ||
"name": "appmixer.aws.redshift", | ||
"version": "1.0.0", | ||
"changelog": [ | ||
"Initial version" | ||
] | ||
"version": "1.0.1", | ||
"changelog": { | ||
"1.0.0": [ | ||
"Initial version" | ||
], | ||
"1.0.1": [ | ||
"NewRow, UpdatedRow: query fields now ignores semicolon at the end of the query to avoid syntax error." | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
{ | ||
"name": "appmixer.azuredocumentintelligence", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"changelog": { | ||
"1.0.2": [ | ||
"Initial version." | ||
] | ||
"Initial version." | ||
], | ||
"2.0.0": [ | ||
"(breaking change) ClassifyDocument split into ClassifyDocument and ClassifyDocumentFromStream. ClassifyDocumentFromStream is using only the File ID parameter, ClassifyDocument is using either File URL or Base64Source.", | ||
"ClassifyDocument and ClassifyDocumentFromStream: added supported file extensions to the tooltip of either File ID or File URL." | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "appmixer.azuredocumentintelligence.classifiers.ClassifyDocument", | ||
"author": "Appmixer <[email protected]>", | ||
"description": "Classifies document with document classifier. Use one of the following input options: <ul><li>1. <b>Appmixer File ID</b> of the document to classify.</li> <li>2. <b>URL</b> of the document to classify.</li> <li>3. <b>Base64</b> encoded source of the document to classify.</li>", | ||
"description": "Classifies document with document classifier. Use one of the following input options: <ul><li>1. <b>URL</b> of the document to classify.</li> <li>2. <b>Base64</b> encoded source of the document to classify.</li>", | ||
"label": "Classify Document", | ||
"auth": { | ||
"service": "appmixer:azuredocumentintelligence" | ||
|
@@ -17,9 +17,6 @@ | |
"classifierId": { | ||
"type": "string" | ||
}, | ||
"fileId": { | ||
"type": "string" | ||
}, | ||
"fileUrl": { | ||
"type": "string" | ||
}, | ||
|
@@ -28,7 +25,6 @@ | |
} | ||
}, | ||
"oneOf": [ | ||
{ "required": ["classifierId", "fileId"] }, | ||
{ "required": ["classifierId", "fileUrl"] }, | ||
{ "required": ["classifierId", "base64Source"] } | ||
] | ||
|
@@ -46,23 +42,17 @@ | |
} | ||
} | ||
}, | ||
"fileId": { | ||
"type": "filepicker", | ||
"index": 2, | ||
"label": "File ID", | ||
"tooltip": "File ID of the document to classify." | ||
}, | ||
"fileUrl": { | ||
"type": "text", | ||
"index": 3, | ||
"index": 2, | ||
"label": "File URL", | ||
"tooltip": "URL of the document to classify." | ||
"tooltip": "File URL of the document to classify. Supported file extensions: <strong>Documents</strong>( .pdf, .docx, .xlsx, .pptx ) <strong>Images</strong>( .jpeg, .png, .tiff, .bmp, .heif ) <strong>Web files</strong>( .html ) <strong>Binary files</strong>." | ||
}, | ||
"base64Source": { | ||
"type": "textarea", | ||
"index": 4, | ||
"index": 3, | ||
"label": "Base64 Source", | ||
"tooltip": "Base64 encoded source of the document to classify." | ||
"tooltip": "Base64 encoded source of the document to classify. If <strong>File URL</strong> is provided, this field is ignored." | ||
} | ||
} | ||
} | ||
|
36 changes: 36 additions & 0 deletions
36
...documentintelligence/classifiers/ClassifyDocumentFromStream/ClassifyDocumentFromStream.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
const DocumentIntelligence = require('@azure-rest/ai-document-intelligence').default; | ||
const { isUnexpected, getLongRunningPoller } = require('@azure-rest/ai-document-intelligence'); | ||
|
||
module.exports = { | ||
|
||
async receive(context) { | ||
|
||
const { endpoint, apiKey } = context.config; | ||
const { classifierId, fileId } = context.messages.in.content; | ||
|
||
const client = DocumentIntelligence(endpoint, { key: apiKey }); | ||
|
||
const fileInfo = await context.getFileInfo(fileId); | ||
const fileStream = await context.getFileReadStream(fileId); | ||
const options = { | ||
contentType: fileInfo.contentType || 'application/octet-stream', | ||
body: fileStream | ||
}; | ||
|
||
await context.log({ step: 'Classifying document', endpoint, classifierId, fileId }); | ||
const initialResponse = await client | ||
.path('/documentClassifiers/{classifierId}:analyze', classifierId) | ||
.post(options); | ||
|
||
if (isUnexpected(initialResponse)) { | ||
throw initialResponse.body.error; | ||
} | ||
|
||
const poller = await getLongRunningPoller(client, initialResponse); | ||
const analyzeResult = (await poller.pollUntilDone()).body.analyzeResult; | ||
|
||
await context.sendJson(analyzeResult, 'out'); | ||
} | ||
}; |
Oops, something went wrong.