Skip to content

Commit

Permalink
update telegram bot (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
localvar committed Aug 27, 2022
1 parent cf93383 commit 3620530
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions doc/cookbook/translation-bot.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ It is fine for you to use other vendors' translation, speech recognition, or OCR

## 2. How It Works

The sequence chart below shows the workflow of this bot:
The diagram below shows the workflow of this bot:

![sequence chart](../imgs/translation-bot-sequence-chart.png)
![diagram](../imgs/translation-bot-workflow.png)

Upon receiving a notification of a new message from the Telegram server via webhook, the bot first checks the message type and does the following accordingly:

Expand Down Expand Up @@ -54,7 +54,7 @@ flow:
alias: processText # alias of the filter
namespace: extract # namespace the filter belongs to
jumpIf: # conditional jump, begin translation
"": translateChinese # if everything is fine, or end the
"": translate # if everything is fine, or end the
# processing otherwise.

# voice message
Expand All @@ -74,7 +74,7 @@ flow:
- filter: requestBuilderSpeechText # Save recognition result
namespace: extract
jumpIf: # conditional jump, begin translation
"": translateChinese # if everything is fine, or end the
"": translate # if everything is fine, or end the
# processing otherwise.

# photo message (the process is basically the same as for voice message)
Expand All @@ -96,7 +96,7 @@ flow:

# translate to Chinese
- filter: requestBuilderTranslate # Constructing the request to call the
alias: translateChinese # translation API
alias: translate # translation API
namespace: zh
- filter: signAWSRequest # Signing as required by AWS
namespace: zh
Expand Down Expand Up @@ -414,4 +414,4 @@ rules:
backend: translate-pipeline' | egctl object create
```

Now, we can test the bot in the chat. A demo video can be found at: https://www.youtube.com/watch?v=mDIAk_6ISkw。
Now, we can test the bot in the chat. A demo video can be found at: https://www.youtube.com/watch?v=ne0OvV1FmvA.
Binary file removed doc/imgs/translation-bot-sequence-chart.png
Binary file not shown.
Binary file added doc/imgs/translation-bot-workflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions example/translation-bot/translate-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ flow:
alias: processText # alias of the filter
namespace: extract # namespace the filter belongs to
jumpIf: # conditional jump, begin translation
"": translateChinese # if everything is fine, or end the
"": translate # if everything is fine, or end the
# processing otherwise.

# voice message
Expand All @@ -41,7 +41,7 @@ flow:
- filter: requestBuilderSpeechText # Save recognition result
namespace: extract
jumpIf: # conditional jump, begin translation
"": translateChinese # if everything is fine, or end the
"": translate # if everything is fine, or end the
# processing otherwise.

# photo message (the process is basically the same as for voice message)
Expand All @@ -63,7 +63,7 @@ flow:

# translate to Chinese
- filter: requestBuilderTranslate # Constructing the request to call the
alias: translateChinese # translation API
alias: translate # translation API
namespace: zh
- filter: signAWSRequest # Signing as required by AWS
namespace: zh
Expand Down

0 comments on commit 3620530

Please sign in to comment.