-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Cognigy/feature/deepl
added deepl extension
- Loading branch information
Showing
10 changed files
with
610 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# DeepL | ||
|
||
This Extension provides DeepL functions to include in your Cognigy.AI conversation. | ||
|
||
**Connection:** | ||
In order to use the nodes below, one needs to sign up for the [Deepl Pro Subscription](https://www.deepl.com/de/pro/). Afterward, the **API KEy** is visible in the user's account section. | ||
|
||
- API Key | ||
- key: key | ||
- value: DeepL Pro API Key | ||
|
||
|
||
## Node: Translate Text | ||
|
||
This node translates text into a selected language [based on the API](https://www.deepl.com/docs-api/translating-text/example/). It stores the result in the context or input object: | ||
|
||
```json | ||
{ | ||
"translations": [{ | ||
"detected_source_language":"EN", | ||
"text":"Der Tisch ist grün. Der Stuhl ist schwarz." | ||
}] | ||
} | ||
``` | ||
|
||
### Example: | ||
|
||
The original text is written in **German** and the target language is set to **Spanish**: | ||
|
||
![](./docs/example.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,27 @@ | ||
{ | ||
"name": "deepl", | ||
"version": "4.0.0", | ||
"description": "Integrates with DeepL", | ||
"main": "build/module.js", | ||
"scripts": { | ||
"transpile": "tsc -p .", | ||
"zip": "tar cfz deepl.tar.gz build/* package.json package-lock.json README.md icon.png", | ||
"build": "npm run transpile && npm run lint && npm run zip", | ||
"lint": "tslint -c tslint.json src/**/*.ts" | ||
}, | ||
"keywords": [ | ||
"DeepL", | ||
"Translation" | ||
], | ||
"author": "Cognigy GmbH", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@cognigy/extension-tools": "^0.10.0", | ||
"axios": "^0.20.0", | ||
"tslint": "^6.1.2" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^13.13.15", | ||
"typescript": "^3.8.3" | ||
} | ||
} |
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,9 @@ | ||
import { IConnectionSchema } from "@cognigy/extension-tools"; | ||
|
||
export const deeplConnection: IConnectionSchema = { | ||
type: "deepl", | ||
label: "DeepL API Key", | ||
fields: [ | ||
{ fieldName: "key" }, | ||
] | ||
}; |
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,15 @@ | ||
import { createExtension } from "@cognigy/extension-tools"; | ||
|
||
import { deeplConnection } from "./connections/deeplConnection"; | ||
import { translateTextNode } from "./nodes/translateText"; | ||
|
||
|
||
export default createExtension({ | ||
nodes: [ | ||
translateTextNode | ||
], | ||
|
||
connections: [ | ||
deeplConnection | ||
] | ||
}); |
Oops, something went wrong.