Skip to content

Commit

Permalink
Merge pull request #13 from Cognigy/feature/deepl
Browse files Browse the repository at this point in the history
added deepl extension
  • Loading branch information
alexteusz authored Aug 26, 2020
2 parents 5890955 + e096e8e commit ac36d49
Show file tree
Hide file tree
Showing 10 changed files with 610 additions and 0 deletions.
30 changes: 30 additions & 0 deletions extensions/deepl/README.md
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)
Binary file added extensions/deepl/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.
Binary file added extensions/deepl/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
298 changes: 298 additions & 0 deletions extensions/deepl/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions extensions/deepl/package.json
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"
}
}
9 changes: 9 additions & 0 deletions extensions/deepl/src/connections/deeplConnection.ts
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" },
]
};
15 changes: 15 additions & 0 deletions extensions/deepl/src/module.ts
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
]
});
Loading

0 comments on commit ac36d49

Please sign in to comment.