Spaces:
Build error
Build error
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- README.md +3 -9
- __pycache__/app.cpython-311.pyc +0 -0
- api_call.py +27 -0
- app.py +59 -0
- botbuilder-python/.cache/v/cache/lastfailed +7 -0
- botbuilder-python/.coveragerc +6 -0
- botbuilder-python/.github/CODEOWNERS +15 -0
- botbuilder-python/.github/ISSUE_TEMPLATE/python-sdk-bug.md +31 -0
- botbuilder-python/.github/ISSUE_TEMPLATE/python-sdk-feature-request.md +21 -0
- botbuilder-python/.github/ISSUE_TEMPLATE/python-sdk-question.md +11 -0
- botbuilder-python/.github/PULL_REQUEST_TEMPLATE.md +14 -0
- botbuilder-python/.github/workflows/create-parity-issue.yml +43 -0
- botbuilder-python/.github/workflows/pr-style.yml +18 -0
- botbuilder-python/.gitignore +71 -0
- botbuilder-python/.pre-commit-config.yaml +9 -0
- botbuilder-python/.pylintrc +691 -0
- botbuilder-python/.pytest_cache/.gitignore +2 -0
- botbuilder-python/.pytest_cache/CACHEDIR.TAG +4 -0
- botbuilder-python/.pytest_cache/README.md +8 -0
- botbuilder-python/.pytest_cache/v/cache/lastfailed +5 -0
- botbuilder-python/.pytest_cache/v/cache/nodeids +0 -0
- botbuilder-python/.pytest_cache/v/cache/stepwise +1 -0
- botbuilder-python/CODE_OF_CONDUCT.md +9 -0
- botbuilder-python/Contributing.md +23 -0
- botbuilder-python/LICENSE +21 -0
- botbuilder-python/README.md +148 -0
- botbuilder-python/SECURITY.md +41 -0
- botbuilder-python/UsingTestPyPI.md +19 -0
- botbuilder-python/doc/README.md +14 -0
- botbuilder-python/doc/SkillClaimsValidation.md +58 -0
- botbuilder-python/doc/media/FrameWorkPython.png +0 -0
- botbuilder-python/generators/LICENSE.md +21 -0
- botbuilder-python/generators/README.md +215 -0
- botbuilder-python/generators/app/templates/core/cookiecutter.json +4 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/.pylintrc +498 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md +216 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/README.md +60 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/__init__.py +2 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/adapter_with_error_handler.py +55 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/app.py +76 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/booking_details.py +18 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/bots/__init__.py +7 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/bots/dialog_and_welcome_bot.py +42 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/bots/dialog_bot.py +42 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/cards/welcomeCard.json +46 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/cognitiveModels/FlightBooking.json +339 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/config.py +18 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json +21 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json +36 -0
- botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/readme.md +28 -0
README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1 |
---
|
2 |
-
title: Validify
|
3 |
-
emoji: 📈
|
4 |
-
colorFrom: pink
|
5 |
-
colorTo: purple
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 4.37.2
|
8 |
app_file: app.py
|
9 |
-
|
|
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: Validify-testbot-1
|
|
|
|
|
|
|
|
|
|
|
3 |
app_file: app.py
|
4 |
+
sdk: gradio
|
5 |
+
sdk_version: 4.36.1
|
6 |
---
|
|
|
|
__pycache__/app.cpython-311.pyc
ADDED
Binary file (5.63 kB). View file
|
|
api_call.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
# Replace YOUR_DIRECT_LINE_SECRET with your bot's Direct Line secret
|
4 |
+
direct_line_secret = 'eyJhbGciOiJSUzI1NiIsImtpZCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsIng1dCI6Ik5MZjUwanFheTN1R0VpQUpOV29EWmZzRnE4QSIsInR5cCI6IkpXVCJ9.eyJib3QiOiI0OWU3Mzc4Yy02MGEyLTk0MTAtZmVhYy0zNjNjYzBiZjYzMjgiLCJzaXRlIjoiV2lkbl9BY05tWTQiLCJjb252IjoiSzJCRnlWeW05a2JzS01LMmNPYWNNLWV1IiwibmJmIjoxNzE5MzMxMDE2LCJleHAiOjE3MTkzMzQ2MTYsImlzcyI6Imh0dHBzOi8vZGlyZWN0bGluZS5ib3RmcmFtZXdvcmsuY29tLyIsImF1ZCI6Imh0dHBzOi8vZGlyZWN0bGluZS5ib3RmcmFtZXdvcmsuY29tLyJ9.He-xwjJujuDaUAoJzo_c8-GfhM00CGeg2VPJKTQK5D7OR7iahEG2JZN4ZsR1XP1WIX84nuRXPDEMLeIV4m54dJkRpHmGMy0GxUnrjcV0kFvaEXs8PpEqWIEyV8il2YrpHino_XuGoaUYgl7hsqyNnRrIKH4eICqr_V4VSi5nQ5ZXoEEnVjUc9OsdpSLGE6O4yKJkAfavqf5tdyqMLz0uqD_QdOJRPlD_Ps3HDveiwVc8gF3i_Fb0U9JrwLFoDnz5XFZuU-bNT4c52rqKdlnu_anLCwPMYJx9KAI80YEorrXTntCji4tnOtB8r_wdEQlgffIHhuogWrobN2j8G99oBw'
|
5 |
+
|
6 |
+
# Set the headers for the request
|
7 |
+
headers = {
|
8 |
+
'Authorization': 'Bearer ' + direct_line_secret,
|
9 |
+
'Content-Type': 'application/json'
|
10 |
+
}
|
11 |
+
|
12 |
+
# Set the parameters for the request
|
13 |
+
data = {
|
14 |
+
'type': 'message',
|
15 |
+
'from': {
|
16 |
+
'id': 'cohitai'
|
17 |
+
},
|
18 |
+
'text': 'fuk ya diggah?! <#'
|
19 |
+
}
|
20 |
+
|
21 |
+
# Send the request to the Direct Line API
|
22 |
+
response = requests.post('https://europe.directline.botframework.com/v3/directline/conversations/K2BFyVym9kbsKMK2cOacM-eu/activities', json=data, headers=headers)
|
23 |
+
|
24 |
+
# Print the response status code
|
25 |
+
print(response.status_code)
|
26 |
+
print(response.json())
|
27 |
+
print(response.content)
|
app.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from conn import connector
|
3 |
+
import time
|
4 |
+
import csv
|
5 |
+
import pandas as pd
|
6 |
+
import os,re,zipfile
|
7 |
+
|
8 |
+
|
9 |
+
conn=connector()
|
10 |
+
info=conn.generate()
|
11 |
+
info=conn.start_conversation(info['token'])
|
12 |
+
|
13 |
+
def resp(message, intensity):
|
14 |
+
|
15 |
+
"""Direct Line Api v.3 connection to CoPilot"""
|
16 |
+
retval = conn.send_message(info['token'],info['conversationId'],'cohitai',message)
|
17 |
+
time.sleep(4)
|
18 |
+
return conn.get_message(info['token'],info['conversationId'])["activities"][-1]["text"]
|
19 |
+
|
20 |
+
def upload_file(files):
|
21 |
+
return [pd.read_excel(file.name) for file in files]
|
22 |
+
|
23 |
+
|
24 |
+
def process_excel_files(files):
|
25 |
+
temp_list=[(file,fetch_sheet_names(file)) for file in files]
|
26 |
+
df = [pd.read_excel(tup[0],sheet) for tup in temp_list for sheet in tup[1]]
|
27 |
+
return df
|
28 |
+
|
29 |
+
def fetch_sheet_names(path):
|
30 |
+
sheets=[]
|
31 |
+
with zipfile.ZipFile(path,'r') as zip_ref:
|
32 |
+
xml=zip_ref.read("xl/workbook.xml").decode("utf-8")
|
33 |
+
for s_tag in re.findall("<sheet [^>]*",xml) : sheets.append(re.search('name="[^"]*',s_tag).group(0)[6:])
|
34 |
+
|
35 |
+
return sheets
|
36 |
+
|
37 |
+
with gr.Blocks() as demo:
|
38 |
+
gr.Markdown("# Say Hello to Validify-Bot, Built on Microsoft Co-Pilot Backend, with Direct Line API V. 3.0")
|
39 |
+
inp = gr.Textbox(placeholder="Please Enter the text here.")
|
40 |
+
out = gr.Textbox()
|
41 |
+
inp.change(resp, inp, out)
|
42 |
+
|
43 |
+
file_output = gr.Files()
|
44 |
+
upload_button = gr.UploadButton("Click to Upload Excel Files", file_types=["file"], file_count="multiple")
|
45 |
+
dataset = gr.Dataframe(row_count=5)
|
46 |
+
upload_button.upload(fn=process_excel_files, inputs=upload_button, outputs=dataset)
|
47 |
+
|
48 |
+
|
49 |
+
if __name__ == "__main__":
|
50 |
+
demo.launch(share=True)
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
# demo = gr.Interface(
|
55 |
+
# fn=resp,
|
56 |
+
# # fn=file_input,
|
57 |
+
# inputs=["text","slider"],
|
58 |
+
# outputs=["text"],
|
59 |
+
# )
|
botbuilder-python/.cache/v/cache/lastfailed
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"libraries/botbuilder-azure/tests/test_cosmos_storage.py": true,
|
3 |
+
"libraries/botframework-connector/tests/test_attachments.py": true,
|
4 |
+
"libraries/botframework-connector/tests/test_attachments_async.py": true,
|
5 |
+
"libraries/botframework-connector/tests/test_conversations.py": true,
|
6 |
+
"libraries/botframework-connector/tests/test_conversations_async.py": true
|
7 |
+
}
|
botbuilder-python/.coveragerc
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[run]
|
2 |
+
source = ./libraries/
|
3 |
+
omit =
|
4 |
+
*/tests/*
|
5 |
+
setup.py
|
6 |
+
*/botbuilder-schema/*
|
botbuilder-python/.github/CODEOWNERS
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Lines starting with '#' are comments.
|
2 |
+
# Each line is a file pattern followed by one or more owners.
|
3 |
+
|
4 |
+
# More details are here: https://help.github.com/articles/about-codeowners/
|
5 |
+
|
6 |
+
# The '*' pattern is global owners.
|
7 |
+
|
8 |
+
# Order is important. The last matching pattern has the most precedence.
|
9 |
+
# The folders are ordered as follows:
|
10 |
+
|
11 |
+
# In each subsection folders are ordered first by depth, then alphabetically.
|
12 |
+
# This should make it easy to add new rules without breaking existing ones.
|
13 |
+
|
14 |
+
# Global rule:
|
15 |
+
* @microsoft/botframework-sdk
|
botbuilder-python/.github/ISSUE_TEMPLATE/python-sdk-bug.md
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
name: Python SDK Bug
|
3 |
+
about: Create a bug report for a bug you found in the Bot Builder Python SDK
|
4 |
+
title: ""
|
5 |
+
labels: "needs-triage, bug"
|
6 |
+
assignees: ""
|
7 |
+
---
|
8 |
+
|
9 |
+
### [Github issues](https://github.com/Microsoft/botbuilder-python) should be used for bugs and feature requests. Use [Stack Overflow](https://stackoverflow.com/questions/tagged/botframework) for general "how-to" questions.
|
10 |
+
|
11 |
+
## Version
|
12 |
+
What package version of the SDK are you using.
|
13 |
+
|
14 |
+
## Describe the bug
|
15 |
+
Give a clear and concise description of what the bug is.
|
16 |
+
|
17 |
+
## To Reproduce
|
18 |
+
Steps to reproduce the behavior:
|
19 |
+
1. Go to '...'
|
20 |
+
2. Click on '....'
|
21 |
+
3. Scroll down to '....'
|
22 |
+
4. See error
|
23 |
+
|
24 |
+
## Expected behavior
|
25 |
+
Give a clear and concise description of what you expected to happen.
|
26 |
+
|
27 |
+
## Screenshots
|
28 |
+
If applicable, add screenshots to help explain your problem.
|
29 |
+
|
30 |
+
## Additional context
|
31 |
+
Add any other context about the problem here.
|
botbuilder-python/.github/ISSUE_TEMPLATE/python-sdk-feature-request.md
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
name: Python SDK Feature Request
|
3 |
+
about: Suggest a feature for the Bot Builder Python SDK
|
4 |
+
title: ""
|
5 |
+
labels: "needs-triage, feature-request"
|
6 |
+
assignees: ""
|
7 |
+
---
|
8 |
+
|
9 |
+
### Use this [query](https://github.com/Microsoft/botbuilder-python/issues?q=is%3Aissue+is%3Aopen++label%3Afeature-request+) to search for the most popular feature requests.
|
10 |
+
|
11 |
+
**Is your feature request related to a problem? Please describe.**
|
12 |
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
13 |
+
|
14 |
+
**Describe the solution you'd like**
|
15 |
+
A clear and concise description of what you want to happen.
|
16 |
+
|
17 |
+
**Describe alternatives you've considered**
|
18 |
+
A clear and concise description of any alternative solutions or features you've considered.
|
19 |
+
|
20 |
+
**Additional context**
|
21 |
+
Add any other context or screenshots about the feature request here.
|
botbuilder-python/.github/ISSUE_TEMPLATE/python-sdk-question.md
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
name: Python SDK Question
|
3 |
+
about: The issue tracker is not for questions. Please ask questions on https://stackoverflow.com/questions/tagged/botframework
|
4 |
+
|
5 |
+
---
|
6 |
+
|
7 |
+
🚨 The issue tracker is not for questions 🚨
|
8 |
+
|
9 |
+
If you have a question, please ask it on https://stackoverflow.com/questions/tagged/botframework
|
10 |
+
|
11 |
+
[question]
|
botbuilder-python/.github/PULL_REQUEST_TEMPLATE.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Fixes #<!-- If this addresses a specific issue, please provide the issue number here -->
|
2 |
+
|
3 |
+
## Description
|
4 |
+
<!-- Please discuss the changes you have worked on. What do the changes do; why is this PR needed? -->
|
5 |
+
|
6 |
+
## Specific Changes
|
7 |
+
<!-- Please list the changes in a concise manner. -->
|
8 |
+
|
9 |
+
-
|
10 |
+
-
|
11 |
+
-
|
12 |
+
|
13 |
+
## Testing
|
14 |
+
<!-- If you are adding a new feature to a library, you must include tests for your new code. -->
|
botbuilder-python/.github/workflows/create-parity-issue.yml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: create-parity-issue.yml
|
2 |
+
|
3 |
+
on:
|
4 |
+
workflow_dispatch:
|
5 |
+
inputs:
|
6 |
+
prDescription:
|
7 |
+
description: PR description
|
8 |
+
default: 'No description provided'
|
9 |
+
required: true
|
10 |
+
prNumber:
|
11 |
+
description: PR number
|
12 |
+
required: true
|
13 |
+
prTitle:
|
14 |
+
description: PR title
|
15 |
+
required: true
|
16 |
+
sourceRepo:
|
17 |
+
description: repository PR is sourced from
|
18 |
+
required: true
|
19 |
+
|
20 |
+
jobs:
|
21 |
+
createIssue:
|
22 |
+
name: create issue
|
23 |
+
runs-on: ubuntu-latest
|
24 |
+
|
25 |
+
steps:
|
26 |
+
- uses: actions/checkout@v2
|
27 |
+
|
28 |
+
- uses: joshgummersall/create-issue@main
|
29 |
+
env:
|
30 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
31 |
+
with:
|
32 |
+
title: |
|
33 |
+
port: ${{ github.event.inputs.prTitle }} (#${{ github.event.inputs.prNumber }})
|
34 |
+
labels: |
|
35 |
+
["parity", "needs-triage", "ExemptFromDailyDRIReport"]
|
36 |
+
body: |
|
37 |
+
The changes in [${{ github.event.inputs.prTitle }} (#${{ github.event.inputs.prNumber }})](https://github.com/${{ github.event.inputs.sourceRepo }}/pull/${{ github.event.inputs.prNumber }}) may need to be ported to maintain parity with `${{ github.event.inputs.sourceRepo }}`.
|
38 |
+
|
39 |
+
<blockquote>
|
40 |
+
${{ github.event.inputs.prDescription }}
|
41 |
+
</blockquote>
|
42 |
+
|
43 |
+
Please review and, if necessary, port the changes.
|
botbuilder-python/.github/workflows/pr-style.yml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: pr-style.yml
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
types: [opened, edited, synchronize]
|
6 |
+
|
7 |
+
jobs:
|
8 |
+
prStyle:
|
9 |
+
name: pr-style
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
|
12 |
+
steps:
|
13 |
+
- uses: joshgummersall/pr-style@main
|
14 |
+
env:
|
15 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
16 |
+
with:
|
17 |
+
require_issue: "true"
|
18 |
+
skip_authors: "dependabot"
|
botbuilder-python/.gitignore
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Python cache
|
2 |
+
__pycache__/
|
3 |
+
*.pyc
|
4 |
+
.ipynb_checkpoints/
|
5 |
+
|
6 |
+
# Virtual environment
|
7 |
+
env*/
|
8 |
+
venv*/
|
9 |
+
|
10 |
+
# PTVS analysis
|
11 |
+
.ptvs/
|
12 |
+
|
13 |
+
# Coverage report
|
14 |
+
**/.coverage
|
15 |
+
|
16 |
+
# Build results
|
17 |
+
bin/
|
18 |
+
obj/
|
19 |
+
dist/
|
20 |
+
MANIFEST
|
21 |
+
|
22 |
+
# Result of running python setup.py install/pip install -e
|
23 |
+
RECORD.txt
|
24 |
+
build/
|
25 |
+
*.egg-info/
|
26 |
+
|
27 |
+
# Test results
|
28 |
+
TestResults/
|
29 |
+
.pytest_cache
|
30 |
+
|
31 |
+
# Credentials
|
32 |
+
credentials_real.json
|
33 |
+
testsettings_local.json
|
34 |
+
testsettings_local.cfg
|
35 |
+
servicebus_settings_real.py
|
36 |
+
storage_settings_real.py
|
37 |
+
legacy_mgmt_settings_real.py
|
38 |
+
mgmt_settings_real.py
|
39 |
+
app_creds_real.py
|
40 |
+
|
41 |
+
# User-specific files
|
42 |
+
*.suo
|
43 |
+
*.user
|
44 |
+
*.sln.docstates
|
45 |
+
.vs/
|
46 |
+
.vscode
|
47 |
+
|
48 |
+
# Windows image file caches
|
49 |
+
Thumbs.db
|
50 |
+
ehthumbs.db
|
51 |
+
|
52 |
+
# Folder config file
|
53 |
+
Desktop.ini
|
54 |
+
|
55 |
+
# Recycle Bin used on file shares
|
56 |
+
$RECYCLE.BIN/
|
57 |
+
|
58 |
+
# Mac desktop service store files
|
59 |
+
.DS_Store
|
60 |
+
|
61 |
+
.idea
|
62 |
+
src/build
|
63 |
+
*.iml
|
64 |
+
/doc/_build
|
65 |
+
/.vs/config/applicationhost.config
|
66 |
+
|
67 |
+
# Azure deployment credentials
|
68 |
+
*.pubxml
|
69 |
+
|
70 |
+
# [begoldsm] ignore virtual env if it exists.
|
71 |
+
adlEnv/
|
botbuilder-python/.pre-commit-config.yaml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
default_stages: [push]
|
2 |
+
repos:
|
3 |
+
- repo: https://github.com/pre-commit/mirrors-pylint
|
4 |
+
rev: v2.4.3
|
5 |
+
hooks:
|
6 |
+
- id: pylint
|
7 |
+
files: libraries
|
8 |
+
args: [--rcfile=.pylintrc]
|
9 |
+
verbose: true
|
botbuilder-python/.pylintrc
ADDED
@@ -0,0 +1,691 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[MASTER]
|
2 |
+
|
3 |
+
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
4 |
+
# 3 compatible code, which means that the block might have code that exists
|
5 |
+
# only in one or another interpreter, leading to false positives when analysed.
|
6 |
+
analyse-fallback-blocks=no
|
7 |
+
|
8 |
+
# Clear in-memory caches upon conclusion of linting. Useful if running pylint
|
9 |
+
# in a server-like mode.
|
10 |
+
clear-cache-post-run=no
|
11 |
+
|
12 |
+
# Load and enable all available extensions. Use --list-extensions to see a list
|
13 |
+
# all available extensions.
|
14 |
+
#enable-all-extensions=
|
15 |
+
|
16 |
+
# In error mode, messages with a category besides ERROR or FATAL are
|
17 |
+
# suppressed, and no reports are done by default. Error mode is compatible with
|
18 |
+
# disabling specific errors.
|
19 |
+
#errors-only=
|
20 |
+
|
21 |
+
# Always return a 0 (non-error) status code, even if lint errors are found.
|
22 |
+
# This is primarily useful in continuous integration scripts.
|
23 |
+
#exit-zero=
|
24 |
+
|
25 |
+
# A comma-separated list of package or module names from where C extensions may
|
26 |
+
# be loaded. Extensions are loading into the active Python interpreter and may
|
27 |
+
# run arbitrary code.
|
28 |
+
extension-pkg-allow-list=
|
29 |
+
|
30 |
+
# A comma-separated list of package or module names from where C extensions may
|
31 |
+
# be loaded. Extensions are loading into the active Python interpreter and may
|
32 |
+
# run arbitrary code. (This is an alternative name to extension-pkg-allow-list
|
33 |
+
# for backward compatibility.)
|
34 |
+
extension-pkg-whitelist=
|
35 |
+
|
36 |
+
# Return non-zero exit code if any of these messages/categories are detected,
|
37 |
+
# even if score is above --fail-under value. Syntax same as enable. Messages
|
38 |
+
# specified are enabled, while categories only check already-enabled messages.
|
39 |
+
fail-on=
|
40 |
+
|
41 |
+
# Specify a score threshold under which the program will exit with error.
|
42 |
+
fail-under=10
|
43 |
+
|
44 |
+
# Interpret the stdin as a python script, whose filename needs to be passed as
|
45 |
+
# the module_or_package argument.
|
46 |
+
#from-stdin=
|
47 |
+
|
48 |
+
# Files or directories to be skipped. They should be base names, not paths.
|
49 |
+
ignore=CVS
|
50 |
+
|
51 |
+
# Add files or directories matching the regular expressions patterns to the
|
52 |
+
# ignore-list. The regex matches against paths and can be in Posix or Windows
|
53 |
+
# format. Because '\\' represents the directory delimiter on Windows systems,
|
54 |
+
# it can't be used as an escape character.
|
55 |
+
ignore-paths=
|
56 |
+
|
57 |
+
# Files or directories matching the regular expression patterns are skipped.
|
58 |
+
# The regex matches against base names, not paths. The default value ignores
|
59 |
+
# Emacs file locks
|
60 |
+
ignore-patterns=^\.#
|
61 |
+
|
62 |
+
# List of module names for which member attributes should not be checked
|
63 |
+
# (useful for modules/projects where namespaces are manipulated during runtime
|
64 |
+
# and thus existing member attributes cannot be deduced by static analysis). It
|
65 |
+
# supports qualified module names, as well as Unix pattern matching.
|
66 |
+
ignored-modules=
|
67 |
+
|
68 |
+
# Python code to execute, usually for sys.path manipulation such as
|
69 |
+
# pygtk.require().
|
70 |
+
#init-hook=
|
71 |
+
|
72 |
+
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
|
73 |
+
# number of processors available to use, and will cap the count on Windows to
|
74 |
+
# avoid hangs.
|
75 |
+
jobs=1
|
76 |
+
|
77 |
+
# Control the amount of potential inferred values when inferring a single
|
78 |
+
# object. This can help the performance when dealing with large functions or
|
79 |
+
# complex, nested conditions.
|
80 |
+
limit-inference-results=100
|
81 |
+
|
82 |
+
# List of plugins (as comma separated values of python module names) to load,
|
83 |
+
# usually to register additional checkers.
|
84 |
+
load-plugins=
|
85 |
+
|
86 |
+
# Pickle collected data for later comparisons.
|
87 |
+
persistent=yes
|
88 |
+
|
89 |
+
# Minimum Python version to use for version dependent checks. Will default to
|
90 |
+
# the version used to run pylint.
|
91 |
+
py-version=3.8
|
92 |
+
|
93 |
+
# Discover python modules and packages in the file system subtree.
|
94 |
+
recursive=no
|
95 |
+
|
96 |
+
# Add paths to the list of the source roots. Supports globbing patterns. The
|
97 |
+
# source root is an absolute path or a path relative to the current working
|
98 |
+
# directory used to determine a package namespace for modules located under the
|
99 |
+
# source root.
|
100 |
+
source-roots=
|
101 |
+
|
102 |
+
# When enabled, pylint would attempt to guess common misconfiguration and emit
|
103 |
+
# user-friendly hints instead of false-positive error messages.
|
104 |
+
suggestion-mode=yes
|
105 |
+
|
106 |
+
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
107 |
+
# active Python interpreter and may run arbitrary code.
|
108 |
+
unsafe-load-any-extension=no
|
109 |
+
|
110 |
+
# In verbose mode, extra non-checker-related info will be displayed.
|
111 |
+
#verbose=
|
112 |
+
|
113 |
+
|
114 |
+
[BASIC]
|
115 |
+
|
116 |
+
# Naming style matching correct argument names.
|
117 |
+
argument-naming-style=snake_case
|
118 |
+
|
119 |
+
# Regular expression matching correct argument names. Overrides argument-
|
120 |
+
# naming-style. If left empty, argument names will be checked with the set
|
121 |
+
# naming style.
|
122 |
+
#argument-rgx=
|
123 |
+
|
124 |
+
# Naming style matching correct attribute names.
|
125 |
+
attr-naming-style=snake_case
|
126 |
+
|
127 |
+
# Regular expression matching correct attribute names. Overrides attr-naming-
|
128 |
+
# style. If left empty, attribute names will be checked with the set naming
|
129 |
+
# style.
|
130 |
+
#attr-rgx=
|
131 |
+
|
132 |
+
# Bad variable names which should always be refused, separated by a comma.
|
133 |
+
bad-names=foo,
|
134 |
+
bar,
|
135 |
+
baz,
|
136 |
+
toto,
|
137 |
+
tutu,
|
138 |
+
tata
|
139 |
+
|
140 |
+
# Bad variable names regexes, separated by a comma. If names match any regex,
|
141 |
+
# they will always be refused
|
142 |
+
bad-names-rgxs=
|
143 |
+
|
144 |
+
# Naming style matching correct class attribute names.
|
145 |
+
class-attribute-naming-style=any
|
146 |
+
|
147 |
+
# Regular expression matching correct class attribute names. Overrides class-
|
148 |
+
# attribute-naming-style. If left empty, class attribute names will be checked
|
149 |
+
# with the set naming style.
|
150 |
+
#class-attribute-rgx=
|
151 |
+
|
152 |
+
# Naming style matching correct class constant names.
|
153 |
+
class-const-naming-style=UPPER_CASE
|
154 |
+
|
155 |
+
# Regular expression matching correct class constant names. Overrides class-
|
156 |
+
# const-naming-style. If left empty, class constant names will be checked with
|
157 |
+
# the set naming style.
|
158 |
+
#class-const-rgx=
|
159 |
+
|
160 |
+
# Naming style matching correct class names.
|
161 |
+
class-naming-style=PascalCase
|
162 |
+
|
163 |
+
# Regular expression matching correct class names. Overrides class-naming-
|
164 |
+
# style. If left empty, class names will be checked with the set naming style.
|
165 |
+
#class-rgx=
|
166 |
+
|
167 |
+
# Naming style matching correct constant names.
|
168 |
+
const-naming-style=UPPER_CASE
|
169 |
+
|
170 |
+
# Regular expression matching correct constant names. Overrides const-naming-
|
171 |
+
# style. If left empty, constant names will be checked with the set naming
|
172 |
+
# style.
|
173 |
+
#const-rgx=
|
174 |
+
|
175 |
+
# Minimum line length for functions/classes that require docstrings, shorter
|
176 |
+
# ones are exempt.
|
177 |
+
docstring-min-length=-1
|
178 |
+
|
179 |
+
# Naming style matching correct function names.
|
180 |
+
function-naming-style=snake_case
|
181 |
+
|
182 |
+
# Regular expression matching correct function names. Overrides function-
|
183 |
+
# naming-style. If left empty, function names will be checked with the set
|
184 |
+
# naming style.
|
185 |
+
#function-rgx=
|
186 |
+
|
187 |
+
# Good variable names which should always be accepted, separated by a comma.
|
188 |
+
good-names=i,
|
189 |
+
j,
|
190 |
+
k,
|
191 |
+
ex,
|
192 |
+
Run,
|
193 |
+
_
|
194 |
+
|
195 |
+
# Good variable names regexes, separated by a comma. If names match any regex,
|
196 |
+
# they will always be accepted
|
197 |
+
good-names-rgxs=
|
198 |
+
|
199 |
+
# Include a hint for the correct naming format with invalid-name.
|
200 |
+
include-naming-hint=no
|
201 |
+
|
202 |
+
# Naming style matching correct inline iteration names.
|
203 |
+
inlinevar-naming-style=any
|
204 |
+
|
205 |
+
# Regular expression matching correct inline iteration names. Overrides
|
206 |
+
# inlinevar-naming-style. If left empty, inline iteration names will be checked
|
207 |
+
# with the set naming style.
|
208 |
+
#inlinevar-rgx=
|
209 |
+
|
210 |
+
# Naming style matching correct method names.
|
211 |
+
method-naming-style=snake_case
|
212 |
+
|
213 |
+
# Regular expression matching correct method names. Overrides method-naming-
|
214 |
+
# style. If left empty, method names will be checked with the set naming style.
|
215 |
+
#method-rgx=
|
216 |
+
|
217 |
+
# Naming style matching correct module names.
|
218 |
+
module-naming-style=snake_case
|
219 |
+
|
220 |
+
# Regular expression matching correct module names. Overrides module-naming-
|
221 |
+
# style. If left empty, module names will be checked with the set naming style.
|
222 |
+
#module-rgx=
|
223 |
+
|
224 |
+
# Colon-delimited sets of names that determine each other's naming style when
|
225 |
+
# the name regexes allow several styles.
|
226 |
+
name-group=
|
227 |
+
|
228 |
+
# Regular expression which should only match function or class names that do
|
229 |
+
# not require a docstring.
|
230 |
+
no-docstring-rgx=^_
|
231 |
+
|
232 |
+
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
233 |
+
# to this list to register other decorators that produce valid properties.
|
234 |
+
# These decorators are taken in consideration only for invalid-name.
|
235 |
+
property-classes=abc.abstractproperty
|
236 |
+
|
237 |
+
# Regular expression matching correct type alias names. If left empty, type
|
238 |
+
# alias names will be checked with the set naming style.
|
239 |
+
#typealias-rgx=
|
240 |
+
|
241 |
+
# Regular expression matching correct type variable names. If left empty, type
|
242 |
+
# variable names will be checked with the set naming style.
|
243 |
+
#typevar-rgx=
|
244 |
+
|
245 |
+
# Naming style matching correct variable names.
|
246 |
+
variable-naming-style=snake_case
|
247 |
+
|
248 |
+
# Regular expression matching correct variable names. Overrides variable-
|
249 |
+
# naming-style. If left empty, variable names will be checked with the set
|
250 |
+
# naming style.
|
251 |
+
#variable-rgx=
|
252 |
+
|
253 |
+
|
254 |
+
[CLASSES]
|
255 |
+
|
256 |
+
# Warn about protected attribute access inside special methods
|
257 |
+
check-protected-access-in-special-methods=no
|
258 |
+
|
259 |
+
# List of method names used to declare (i.e. assign) instance attributes.
|
260 |
+
defining-attr-methods=__init__,
|
261 |
+
__new__,
|
262 |
+
setUp,
|
263 |
+
__post_init__
|
264 |
+
|
265 |
+
# List of member names, which should be excluded from the protected access
|
266 |
+
# warning.
|
267 |
+
exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit
|
268 |
+
|
269 |
+
# List of valid names for the first argument in a class method.
|
270 |
+
valid-classmethod-first-arg=cls
|
271 |
+
|
272 |
+
# List of valid names for the first argument in a metaclass class method.
|
273 |
+
valid-metaclass-classmethod-first-arg=mcs,cls
|
274 |
+
|
275 |
+
|
276 |
+
[DESIGN]
|
277 |
+
|
278 |
+
# List of regular expressions of class ancestor names to ignore when counting
|
279 |
+
# public methods (see R0903)
|
280 |
+
exclude-too-few-public-methods=
|
281 |
+
|
282 |
+
# List of qualified class names to ignore when counting class parents (see
|
283 |
+
# R0901)
|
284 |
+
ignored-parents=
|
285 |
+
|
286 |
+
# Maximum number of arguments for function / method.
|
287 |
+
max-args=5
|
288 |
+
|
289 |
+
# Maximum number of attributes for a class (see R0902).
|
290 |
+
max-attributes=7
|
291 |
+
|
292 |
+
# Maximum number of boolean expressions in an if statement (see R0916).
|
293 |
+
max-bool-expr=5
|
294 |
+
|
295 |
+
# Maximum number of branch for function / method body.
|
296 |
+
max-branches=12
|
297 |
+
|
298 |
+
# Maximum number of locals for function / method body.
|
299 |
+
max-locals=15
|
300 |
+
|
301 |
+
# Maximum number of parents for a class (see R0901).
|
302 |
+
max-parents=7
|
303 |
+
|
304 |
+
# Maximum number of public methods for a class (see R0904).
|
305 |
+
max-public-methods=20
|
306 |
+
|
307 |
+
# Maximum number of return / yield for function / method body.
|
308 |
+
max-returns=6
|
309 |
+
|
310 |
+
# Maximum number of statements in function / method body.
|
311 |
+
max-statements=50
|
312 |
+
|
313 |
+
# Minimum number of public methods for a class (see R0903).
|
314 |
+
min-public-methods=2
|
315 |
+
|
316 |
+
|
317 |
+
[EXCEPTIONS]
|
318 |
+
|
319 |
+
# Exceptions that will emit a warning when caught.
|
320 |
+
overgeneral-exceptions=builtins.BaseException,builtins.Exception
|
321 |
+
|
322 |
+
|
323 |
+
[FORMAT]
|
324 |
+
|
325 |
+
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
326 |
+
expected-line-ending-format=
|
327 |
+
|
328 |
+
# Regexp for a line that is allowed to be longer than the limit.
|
329 |
+
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
330 |
+
|
331 |
+
# Number of spaces of indent required inside a hanging or continued line.
|
332 |
+
indent-after-paren=4
|
333 |
+
|
334 |
+
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
335 |
+
# tab).
|
336 |
+
indent-string=' '
|
337 |
+
|
338 |
+
# Maximum number of characters on a single line.
|
339 |
+
max-line-length=120
|
340 |
+
|
341 |
+
# Maximum number of lines in a module.
|
342 |
+
max-module-lines=1000
|
343 |
+
|
344 |
+
# Allow the body of a class to be on the same line as the declaration if body
|
345 |
+
# contains single statement.
|
346 |
+
single-line-class-stmt=no
|
347 |
+
|
348 |
+
# Allow the body of an if to be on the same line as the test if there is no
|
349 |
+
# else.
|
350 |
+
single-line-if-stmt=no
|
351 |
+
|
352 |
+
|
353 |
+
[IMPORTS]
|
354 |
+
|
355 |
+
# List of modules that can be imported at any level, not just the top level
|
356 |
+
# one.
|
357 |
+
allow-any-import-level=
|
358 |
+
|
359 |
+
# Allow explicit reexports by alias from a package __init__.
|
360 |
+
allow-reexport-from-package=no
|
361 |
+
|
362 |
+
# Allow wildcard imports from modules that define __all__.
|
363 |
+
allow-wildcard-with-all=no
|
364 |
+
|
365 |
+
# Deprecated modules which should not be used, separated by a comma.
|
366 |
+
deprecated-modules=
|
367 |
+
|
368 |
+
# Output a graph (.gv or any supported image format) of external dependencies
|
369 |
+
# to the given file (report RP0402 must not be disabled).
|
370 |
+
ext-import-graph=
|
371 |
+
|
372 |
+
# Output a graph (.gv or any supported image format) of all (i.e. internal and
|
373 |
+
# external) dependencies to the given file (report RP0402 must not be
|
374 |
+
# disabled).
|
375 |
+
import-graph=
|
376 |
+
|
377 |
+
# Output a graph (.gv or any supported image format) of internal dependencies
|
378 |
+
# to the given file (report RP0402 must not be disabled).
|
379 |
+
int-import-graph=
|
380 |
+
|
381 |
+
# Force import order to recognize a module as part of the standard
|
382 |
+
# compatibility libraries.
|
383 |
+
known-standard-library=
|
384 |
+
|
385 |
+
# Force import order to recognize a module as part of a third party library.
|
386 |
+
known-third-party=enchant
|
387 |
+
|
388 |
+
# Couples of modules and preferred modules, separated by a comma.
|
389 |
+
preferred-modules=
|
390 |
+
|
391 |
+
|
392 |
+
[LOGGING]
|
393 |
+
|
394 |
+
# The type of string formatting that logging methods do. `old` means using %
|
395 |
+
# formatting, `new` is for `{}` formatting.
|
396 |
+
logging-format-style=old
|
397 |
+
|
398 |
+
# Logging modules to check that the string format arguments are in logging
|
399 |
+
# function parameter format.
|
400 |
+
logging-modules=logging
|
401 |
+
|
402 |
+
|
403 |
+
[MESSAGES CONTROL]
|
404 |
+
|
405 |
+
# Only show warnings with the listed confidence levels. Leave empty to show
|
406 |
+
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
|
407 |
+
# UNDEFINED.
|
408 |
+
confidence=HIGH,
|
409 |
+
CONTROL_FLOW,
|
410 |
+
INFERENCE,
|
411 |
+
INFERENCE_FAILURE,
|
412 |
+
UNDEFINED
|
413 |
+
|
414 |
+
# Disable the message, report, category or checker with the given id(s). You
|
415 |
+
# can either give multiple identifiers separated by comma (,) or put this
|
416 |
+
# option multiple times (only on the command line, not in the configuration
|
417 |
+
# file where it should appear only once). You can also use "--disable=all" to
|
418 |
+
# disable everything first and then re-enable specific checks. For example, if
|
419 |
+
# you want to run only the similarities checker, you can use "--disable=all
|
420 |
+
# --enable=similarities". If you want to run only the classes checker, but have
|
421 |
+
# no Warning level messages displayed, use "--disable=all --enable=classes
|
422 |
+
# --disable=W".
|
423 |
+
disable=raw-checker-failed,
|
424 |
+
bad-inline-option,
|
425 |
+
locally-disabled,
|
426 |
+
file-ignored,
|
427 |
+
suppressed-message,
|
428 |
+
useless-suppression,
|
429 |
+
deprecated-pragma,
|
430 |
+
use-symbolic-message-instead,
|
431 |
+
duplicate-code,
|
432 |
+
redefined-outer-name,
|
433 |
+
missing-docstring,
|
434 |
+
too-many-instance-attributes,
|
435 |
+
too-few-public-methods,
|
436 |
+
redefined-builtin,
|
437 |
+
too-many-arguments,
|
438 |
+
fixme,
|
439 |
+
broad-except,
|
440 |
+
bare-except,
|
441 |
+
too-many-public-methods,
|
442 |
+
cyclic-import,
|
443 |
+
too-many-locals,
|
444 |
+
too-many-function-args,
|
445 |
+
too-many-return-statements,
|
446 |
+
import-error,
|
447 |
+
no-name-in-module,
|
448 |
+
too-many-branches,
|
449 |
+
too-many-ancestors,
|
450 |
+
too-many-nested-blocks,
|
451 |
+
attribute-defined-outside-init,
|
452 |
+
super-with-arguments,
|
453 |
+
missing-timeout,
|
454 |
+
broad-exception-raised,
|
455 |
+
exec-used,
|
456 |
+
unspecified-encoding,
|
457 |
+
unused-variable,
|
458 |
+
consider-using-f-string,
|
459 |
+
raise-missing-from,
|
460 |
+
invalid-name,
|
461 |
+
useless-object-inheritance,
|
462 |
+
no-else-raise,
|
463 |
+
implicit-str-concat,
|
464 |
+
use-dict-literal,
|
465 |
+
use-list-literal,
|
466 |
+
unnecessary-dunder-call,
|
467 |
+
consider-using-in,
|
468 |
+
consider-using-with,
|
469 |
+
useless-parent-delegation,
|
470 |
+
f-string-without-interpolation,
|
471 |
+
global-variable-not-assigned,
|
472 |
+
dangerous-default-value,
|
473 |
+
wrong-import-order,
|
474 |
+
wrong-import-position,
|
475 |
+
ungrouped-imports,
|
476 |
+
import-outside-toplevel,
|
477 |
+
consider-using-from-import,
|
478 |
+
reimported,
|
479 |
+
unused-import,
|
480 |
+
unused-argument,
|
481 |
+
arguments-renamed,
|
482 |
+
unused-private-member,
|
483 |
+
unidiomatic-typecheck,
|
484 |
+
protected-access,
|
485 |
+
used-before-assignment,
|
486 |
+
invalid-overridden-method,
|
487 |
+
no-member,
|
488 |
+
deprecated-module,
|
489 |
+
too-many-lines,
|
490 |
+
c-extension-no-member,
|
491 |
+
unsubscriptable-object
|
492 |
+
|
493 |
+
# Enable the message, report, category or checker with the given id(s). You can
|
494 |
+
# either give multiple identifier separated by comma (,) or put this option
|
495 |
+
# multiple time (only on the command line, not in the configuration file where
|
496 |
+
# it should appear only once). See also the "--disable" option for examples.
|
497 |
+
enable=
|
498 |
+
|
499 |
+
|
500 |
+
[METHOD_ARGS]
|
501 |
+
|
502 |
+
# List of qualified names (i.e., library.method) which require a timeout
|
503 |
+
# parameter e.g. 'requests.api.get,requests.api.post'
|
504 |
+
timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
|
505 |
+
|
506 |
+
|
507 |
+
[MISCELLANEOUS]
|
508 |
+
|
509 |
+
# List of note tags to take in consideration, separated by a comma.
|
510 |
+
notes=FIXME,
|
511 |
+
XXX,
|
512 |
+
TODO
|
513 |
+
|
514 |
+
# Regular expression of note tags to take in consideration.
|
515 |
+
notes-rgx=
|
516 |
+
|
517 |
+
|
518 |
+
[REFACTORING]
|
519 |
+
|
520 |
+
# Maximum number of nested blocks for function / method body
|
521 |
+
max-nested-blocks=5
|
522 |
+
|
523 |
+
# Complete name of functions that never returns. When checking for
|
524 |
+
# inconsistent-return-statements if a never returning function is called then
|
525 |
+
# it will be considered as an explicit return statement and no message will be
|
526 |
+
# printed.
|
527 |
+
never-returning-functions=sys.exit,argparse.parse_error
|
528 |
+
|
529 |
+
|
530 |
+
[REPORTS]
|
531 |
+
|
532 |
+
# Python expression which should return a score less than or equal to 10. You
|
533 |
+
# have access to the variables 'fatal', 'error', 'warning', 'refactor',
|
534 |
+
# 'convention', and 'info' which contain the number of messages in each
|
535 |
+
# category, as well as 'statement' which is the total number of statements
|
536 |
+
# analyzed. This score is used by the global evaluation report (RP0004).
|
537 |
+
evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
|
538 |
+
|
539 |
+
# Template used to display messages. This is a python new-style format string
|
540 |
+
# used to format the message information. See doc for all details.
|
541 |
+
msg-template=
|
542 |
+
|
543 |
+
# Set the output format. Available formats are text, parseable, colorized, json
|
544 |
+
# and msvs (visual studio). You can also give a reporter class, e.g.
|
545 |
+
# mypackage.mymodule.MyReporterClass.
|
546 |
+
#output-format=
|
547 |
+
|
548 |
+
# Tells whether to display a full report or only the messages.
|
549 |
+
reports=no
|
550 |
+
|
551 |
+
# Activate the evaluation score.
|
552 |
+
score=yes
|
553 |
+
|
554 |
+
|
555 |
+
[SIMILARITIES]
|
556 |
+
|
557 |
+
# Comments are removed from the similarity computation
|
558 |
+
ignore-comments=yes
|
559 |
+
|
560 |
+
# Docstrings are removed from the similarity computation
|
561 |
+
ignore-docstrings=yes
|
562 |
+
|
563 |
+
# Imports are removed from the similarity computation
|
564 |
+
ignore-imports=yes
|
565 |
+
|
566 |
+
# Signatures are removed from the similarity computation
|
567 |
+
ignore-signatures=yes
|
568 |
+
|
569 |
+
# Minimum lines number of a similarity.
|
570 |
+
min-similarity-lines=4
|
571 |
+
|
572 |
+
|
573 |
+
[SPELLING]
|
574 |
+
|
575 |
+
# Limits count of emitted suggestions for spelling mistakes.
|
576 |
+
max-spelling-suggestions=4
|
577 |
+
|
578 |
+
# Spelling dictionary name. No available dictionaries : You need to install
|
579 |
+
# both the python package and the system dependency for enchant to work..
|
580 |
+
spelling-dict=
|
581 |
+
|
582 |
+
# List of comma separated words that should be considered directives if they
|
583 |
+
# appear at the beginning of a comment and should not be checked.
|
584 |
+
spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
|
585 |
+
|
586 |
+
# List of comma separated words that should not be checked.
|
587 |
+
spelling-ignore-words=
|
588 |
+
|
589 |
+
# A path to a file that contains the private dictionary; one word per line.
|
590 |
+
spelling-private-dict-file=
|
591 |
+
|
592 |
+
# Tells whether to store unknown words to the private dictionary (see the
|
593 |
+
# --spelling-private-dict-file option) instead of raising a message.
|
594 |
+
spelling-store-unknown-words=no
|
595 |
+
|
596 |
+
|
597 |
+
[STRING]
|
598 |
+
|
599 |
+
# This flag controls whether inconsistent-quotes generates a warning when the
|
600 |
+
# character used as a quote delimiter is used inconsistently within a module.
|
601 |
+
check-quote-consistency=no
|
602 |
+
|
603 |
+
# This flag controls whether the implicit-str-concat should generate a warning
|
604 |
+
# on implicit string concatenation in sequences defined over several lines.
|
605 |
+
check-str-concat-over-line-jumps=no
|
606 |
+
|
607 |
+
|
608 |
+
[TYPECHECK]
|
609 |
+
|
610 |
+
# List of decorators that produce context managers, such as
|
611 |
+
# contextlib.contextmanager. Add to this list to register other decorators that
|
612 |
+
# produce valid context managers.
|
613 |
+
contextmanager-decorators=contextlib.contextmanager
|
614 |
+
|
615 |
+
# List of members which are set dynamically and missed by pylint inference
|
616 |
+
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
617 |
+
# expressions are accepted.
|
618 |
+
generated-members=
|
619 |
+
|
620 |
+
# Tells whether to warn about missing members when the owner of the attribute
|
621 |
+
# is inferred to be None.
|
622 |
+
ignore-none=yes
|
623 |
+
|
624 |
+
# This flag controls whether pylint should warn about no-member and similar
|
625 |
+
# checks whenever an opaque object is returned when inferring. The inference
|
626 |
+
# can return multiple potential results while evaluating a Python object, but
|
627 |
+
# some branches might not be evaluated, which results in partial inference. In
|
628 |
+
# that case, it might be useful to still emit no-member and other checks for
|
629 |
+
# the rest of the inferred objects.
|
630 |
+
ignore-on-opaque-inference=yes
|
631 |
+
|
632 |
+
# List of symbolic message names to ignore for Mixin members.
|
633 |
+
ignored-checks-for-mixins=no-member,
|
634 |
+
not-async-context-manager,
|
635 |
+
not-context-manager,
|
636 |
+
attribute-defined-outside-init
|
637 |
+
|
638 |
+
# List of class names for which member attributes should not be checked (useful
|
639 |
+
# for classes with dynamically set attributes). This supports the use of
|
640 |
+
# qualified names.
|
641 |
+
ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace
|
642 |
+
|
643 |
+
# Show a hint with possible names when a member name was not found. The aspect
|
644 |
+
# of finding the hint is based on edit distance.
|
645 |
+
missing-member-hint=yes
|
646 |
+
|
647 |
+
# The minimum edit distance a name should have in order to be considered a
|
648 |
+
# similar match for a missing member name.
|
649 |
+
missing-member-hint-distance=1
|
650 |
+
|
651 |
+
# The total number of similar names that should be taken in consideration when
|
652 |
+
# showing a hint for a missing member.
|
653 |
+
missing-member-max-choices=1
|
654 |
+
|
655 |
+
# Regex pattern to define which classes are considered mixins.
|
656 |
+
mixin-class-rgx=.*[Mm]ixin
|
657 |
+
|
658 |
+
# List of decorators that change the signature of a decorated function.
|
659 |
+
signature-mutators=
|
660 |
+
|
661 |
+
|
662 |
+
[VARIABLES]
|
663 |
+
|
664 |
+
# List of additional names supposed to be defined in builtins. Remember that
|
665 |
+
# you should avoid defining new builtins when possible.
|
666 |
+
additional-builtins=
|
667 |
+
|
668 |
+
# Tells whether unused global variables should be treated as a violation.
|
669 |
+
allow-global-unused-variables=yes
|
670 |
+
|
671 |
+
# List of names allowed to shadow builtins
|
672 |
+
allowed-redefined-builtins=
|
673 |
+
|
674 |
+
# List of strings which can identify a callback function by name. A callback
|
675 |
+
# name must start or end with one of those strings.
|
676 |
+
callbacks=cb_,
|
677 |
+
_cb
|
678 |
+
|
679 |
+
# A regular expression matching the name of dummy variables (i.e. expected to
|
680 |
+
# not be used).
|
681 |
+
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
|
682 |
+
|
683 |
+
# Argument names that match this expression will be ignored.
|
684 |
+
ignored-argument-names=_.*|^ignored_|^unused_
|
685 |
+
|
686 |
+
# Tells whether we should check for unused import in __init__ files.
|
687 |
+
init-import=no
|
688 |
+
|
689 |
+
# List of qualified module names which can have objects that can redefine
|
690 |
+
# builtins.
|
691 |
+
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
|
botbuilder-python/.pytest_cache/.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# Created by pytest automatically.
|
2 |
+
*
|
botbuilder-python/.pytest_cache/CACHEDIR.TAG
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Signature: 8a477f597d28d172789f06886806bc55
|
2 |
+
# This file is a cache directory tag created by pytest.
|
3 |
+
# For information about cache directory tags, see:
|
4 |
+
# https://bford.info/cachedir/spec.html
|
botbuilder-python/.pytest_cache/README.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# pytest cache directory #
|
2 |
+
|
3 |
+
This directory contains data from the pytest's cache plugin,
|
4 |
+
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
|
5 |
+
|
6 |
+
**Do not** commit this to version control.
|
7 |
+
|
8 |
+
See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
|
botbuilder-python/.pytest_cache/v/cache/lastfailed
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"libraries/botbuilder-dialogs/tests/test_oauth_prompt.py::OAuthPromptTests::test_should_timeout_oauth_prompt_with_message_activity": true,
|
3 |
+
"libraries/botbuilder-dialogs/tests/test_oauth_prompt.py::OAuthPromptTests::test_should_timeout_oauth_prompt_with_token_response_event_activity": true,
|
4 |
+
"libraries/botbuilder-dialogs/tests/test_oauth_prompt.py::OAuthPromptTests::test_should_timeout_oauth_prompt_with_verify_state_operation_activity": true
|
5 |
+
}
|
botbuilder-python/.pytest_cache/v/cache/nodeids
ADDED
The diff for this file is too large to render.
See raw diff
|
|
botbuilder-python/.pytest_cache/v/cache/stepwise
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
[]
|
botbuilder-python/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Microsoft Open Source Code of Conduct
|
2 |
+
|
3 |
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
4 |
+
|
5 |
+
Resources:
|
6 |
+
|
7 |
+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
8 |
+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
9 |
+
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
|
botbuilder-python/Contributing.md
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Instructions for Contributing Code
|
2 |
+
|
3 |
+
## Contributing bug fixes and features
|
4 |
+
|
5 |
+
The Bot Framework team is currently accepting contributions in the form of bug fixes and new
|
6 |
+
features. Any submission must have an issue tracking it in the issue tracker that has
|
7 |
+
been approved by the Bot Framework team. Your pull request should include a link to
|
8 |
+
the bug that you are fixing. If you've submitted a PR for a bug, please post a
|
9 |
+
comment in the bug to avoid duplication of effort.
|
10 |
+
|
11 |
+
## Legal
|
12 |
+
|
13 |
+
If your contribution is more than 15 lines of code, you will need to complete a Contributor
|
14 |
+
License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission
|
15 |
+
to use the submitted change according to the terms of the project's license, and that the work
|
16 |
+
being submitted is under appropriate copyright.
|
17 |
+
|
18 |
+
Please submit a Contributor License Agreement (CLA) before submitting a pull request.
|
19 |
+
You may visit https://cla.azure.com to sign digitally. Alternatively, download the
|
20 |
+
agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or
|
21 |
+
[Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan,
|
22 |
+
and email it back to <[email protected]>. Be sure to include your github user name along with the agreement. Once we have received the
|
23 |
+
signed CLA, we'll review the request.
|
botbuilder-python/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE
|
botbuilder-python/README.md
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ![Bot Framework SDK v4 Python](./doc/media/FrameWorkPython.png)
|
2 |
+
|
3 |
+
This repository contains code for the Python version of the [Microsoft Bot Framework SDK](https://github.com/Microsoft/botframework-sdk), which is part of the Microsoft Bot Framework - a comprehensive framework for building enterprise-grade conversational AI experiences.
|
4 |
+
|
5 |
+
This SDK enables developers to model conversation and build sophisticated bot applications using Python. SDKs for [JavaScript](https://github.com/Microsoft/botbuilder-js) and [.NET](https://github.com/Microsoft/botbuilder-dotnet) are also available.
|
6 |
+
|
7 |
+
To get started building bots using the SDK, see the [Azure Bot Service Documentation](https://docs.microsoft.com/en-us/azure/bot-service/?view=azure-bot-service-4.0).
|
8 |
+
|
9 |
+
For more information jump to a section below.
|
10 |
+
|
11 |
+
* [Build status](#build-status)
|
12 |
+
* [Packages](#packages)
|
13 |
+
* [Getting started](#getting-started)
|
14 |
+
* [Getting support and providing feedback](#getting-support-and-providing-feedback)
|
15 |
+
* [Contributing and our code of conduct](contributing-and-our-code-of-conduct)
|
16 |
+
* [Reporting security issues](#reporting-security-issues)
|
17 |
+
|
18 |
+
## Build Status
|
19 |
+
|
20 |
+
| Branch | Description | Build Status | Coverage Status | Code Style |
|
21 |
+
|----|---------------|--------------|-----------------|--|
|
22 |
+
| Main | 4.16.0 Builds | [![Build Status](https://fuselabs.visualstudio.com/SDK_v4/_apis/build/status/Python/Python-CI-PR-yaml?branchName=main)](https://fuselabs.visualstudio.com/SDK_v4/_build/latest?definitionId=771&branchName=main) | [![Coverage Status](https://coveralls.io/repos/github/microsoft/botbuilder-python/badge.svg?branch=HEAD)](https://coveralls.io/github/microsoft/botbuilder-python?branch=HEAD) | [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) |
|
23 |
+
|
24 |
+
## Packages
|
25 |
+
|
26 |
+
| Build | Released Package |
|
27 |
+
|----|---------------|
|
28 |
+
| botbuilder-ai | [![PyPI version](https://badge.fury.io/py/botbuilder-ai.svg)](https://pypi.org/project/botbuilder-ai/) |
|
29 |
+
| botbuilder-applicationinsights | [![PyPI version](https://badge.fury.io/py/botbuilder-applicationinsights.svg)](https://pypi.org/project/botbuilder-applicationinsights/) |
|
30 |
+
| botbuilder-azure | [![PyPI version](https://badge.fury.io/py/botbuilder-azure.svg)](https://pypi.org/project/botbuilder-azure/) |
|
31 |
+
| botbuilder-core | [![PyPI version](https://badge.fury.io/py/botbuilder-core.svg)](https://pypi.org/project/botbuilder-core/) |
|
32 |
+
| botbuilder-dialogs | [![PyPI version](https://badge.fury.io/py/botbuilder-dialogs.svg)](https://pypi.org/project/botbuilder-dialogs/) |
|
33 |
+
| botbuilder-schema | [![PyPI version](https://badge.fury.io/py/botbuilder-schema.svg)](https://pypi.org/project/botbuilder-schema/) |
|
34 |
+
| botframework-connector | [![PyPI version](https://badge.fury.io/py/botframework-connector.svg)](https://pypi.org/project/botframework-connector/) |
|
35 |
+
|
|
36 |
+
|
37 |
+
## Getting Started
|
38 |
+
To get started building bots using the SDK, see the [Azure Bot Service Documentation](https://docs.microsoft.com/en-us/azure/bot-service/?view=azure-bot-service-4.0).
|
39 |
+
|
40 |
+
The [Bot Framework Samples](https://github.com/microsoft/botbuilder-samples) includes a rich set of samples repository.
|
41 |
+
|
42 |
+
If you want to debug an issue, would like to [contribute](#contributing-code), or understand how the Bot Builder SDK works, instructions for building and testing the SDK are below.
|
43 |
+
|
44 |
+
### Prerequisites
|
45 |
+
- [Git](https://git-scm.com/downloads)
|
46 |
+
- [Python 3.8.17 - 3.11.x](https://www.python.org/downloads/)
|
47 |
+
|
48 |
+
Python "Virtual Environments" allow Python packages to be installed in an isolated location for a particular application, rather than being installed globally, as such it is common practice to use them. Click [here](https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments) to learn more about creating _and activating_ Virtual Environments in Python.
|
49 |
+
|
50 |
+
### Clone
|
51 |
+
Clone a copy of the repo:
|
52 |
+
```bash
|
53 |
+
git clone https://github.com/Microsoft/botbuilder-python.git
|
54 |
+
```
|
55 |
+
Change to the SDK's directory:
|
56 |
+
```bash
|
57 |
+
cd botbuilder-python
|
58 |
+
```
|
59 |
+
|
60 |
+
### Using the SDK locally
|
61 |
+
|
62 |
+
To use a local copy of the SDK you can link to these packages with the pip -e option.
|
63 |
+
|
64 |
+
```bash
|
65 |
+
pip install -e ./libraries/botbuilder-schema
|
66 |
+
pip install -e ./libraries/botframework-connector
|
67 |
+
pip install -e ./libraries/botframework-streaming
|
68 |
+
pip install -e ./libraries/botbuilder-core
|
69 |
+
pip install -e ./libraries/botbuilder-ai
|
70 |
+
pip install -e ./libraries/botbuilder-applicationinsights
|
71 |
+
pip install -e ./libraries/botbuilder-dialogs
|
72 |
+
pip install -e ./libraries/botbuilder-azure
|
73 |
+
pip install -e ./libraries/botbuilder-integration-applicationinsights-aiohttp
|
74 |
+
pip install -e ./libraries/botbuilder-adapters-slack
|
75 |
+
pip install -e ./libraries/botbuilder-integration-aiohttp
|
76 |
+
pip install -e ./libraries/botbuilder-testing
|
77 |
+
```
|
78 |
+
|
79 |
+
### Running unit tests
|
80 |
+
First execute the following command from the root level of the repo:
|
81 |
+
```bash
|
82 |
+
pip install -r ./libraries/botframework-connector/tests/requirements.txt
|
83 |
+
pip install -r ./libraries/botbuilder-core/tests/requirements.txt
|
84 |
+
pip install -r ./libraries/botbuilder-ai/tests/requirements.txt
|
85 |
+
```
|
86 |
+
|
87 |
+
Then enter run pytest by simply typing it into your CLI:
|
88 |
+
|
89 |
+
```bash
|
90 |
+
pytest
|
91 |
+
```
|
92 |
+
|
93 |
+
This is the expected output:
|
94 |
+
```bash
|
95 |
+
============================= test session starts =============================
|
96 |
+
platform win32 -- Python 3.8.2, pytest-3.4.0, py-1.5.2, pluggy-0.6.0
|
97 |
+
rootdir: C:\projects\botbuilder-python, inifile:
|
98 |
+
plugins: cov-2.5.1
|
99 |
+
...
|
100 |
+
```
|
101 |
+
|
102 |
+
## Getting support and providing feedback
|
103 |
+
Below are the various channels that are available to you for obtaining support and providing feedback. Please pay carful attention to which channel should be used for which type of content. e.g. general "how do I..." questions should be asked on Stack Overflow, Twitter or Gitter, with GitHub issues being for feature requests and bug reports.
|
104 |
+
|
105 |
+
### Github issues
|
106 |
+
[Github issues](https://github.com/Microsoft/botbuilder-python/issues) should be used for bugs and feature requests.
|
107 |
+
|
108 |
+
### Stack overflow
|
109 |
+
[Stack Overflow](https://stackoverflow.com/questions/tagged/botframework) is a great place for getting high-quality answers. Our support team, as well as many of our community members are already on Stack Overflow providing answers to 'how-to' questions.
|
110 |
+
|
111 |
+
### Azure Support
|
112 |
+
If you issues relates to [Azure Bot Service](https://azure.microsoft.com/en-gb/services/bot-service/), you can take advantage of the available [Azure support options](https://azure.microsoft.com/en-us/support/options/).
|
113 |
+
|
114 |
+
### Twitter
|
115 |
+
We use the [@msbotframework](https://twitter.com/msbotframework) account on twitter for announcements and members from the development team watch for tweets for [@msbotframework](https://twitter.com/msbotframework).
|
116 |
+
|
117 |
+
### Gitter Chat Room
|
118 |
+
The [Gitter Channel](https://gitter.im/Microsoft/BotBuilder) provides a place where the Community can get together and collaborate.
|
119 |
+
|
120 |
+
## Contributing and our code of conduct
|
121 |
+
We welcome contributions and suggestions. Please see our [contributing guidelines](./contributing.md) for more information.
|
122 |
+
|
123 |
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
124 |
+
|
125 |
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact
|
126 |
+
[[email protected]](mailto:[email protected]) with any additional questions or comments.
|
127 |
+
|
128 |
+
### Contributing Code
|
129 |
+
|
130 |
+
In order to create pull requests, submitted code must pass ```pylint``` and ```black``` checks. Run both tools on every file you've changed.
|
131 |
+
|
132 |
+
For more information and installation instructions, see:
|
133 |
+
|
134 |
+
* [black](https://pypi.org/project/black/)
|
135 |
+
* [pylint](https://pylint.org/)
|
136 |
+
|
137 |
+
## Reporting Security Issues
|
138 |
+
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC)
|
139 |
+
at [[email protected]](mailto:[email protected]). You should receive a response within 24 hours. If for some
|
140 |
+
reason you do not, please follow up via email to ensure we received your original message. Further information,
|
141 |
+
including the [MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found in the
|
142 |
+
[Security TechCenter](https://technet.microsoft.com/en-us/security/default).
|
143 |
+
|
144 |
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
145 |
+
|
146 |
+
Licensed under the [MIT](./LICENSE) License.
|
147 |
+
|
148 |
+
|
botbuilder-python/SECURITY.md
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
|
2 |
+
|
3 |
+
## Security
|
4 |
+
|
5 |
+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
6 |
+
|
7 |
+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
|
8 |
+
|
9 |
+
## Reporting Security Issues
|
10 |
+
|
11 |
+
**Please do not report security vulnerabilities through public GitHub issues.**
|
12 |
+
|
13 |
+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
|
14 |
+
|
15 |
+
If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
|
16 |
+
|
17 |
+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
|
18 |
+
|
19 |
+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
20 |
+
|
21 |
+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
22 |
+
* Full paths of source file(s) related to the manifestation of the issue
|
23 |
+
* The location of the affected source code (tag/branch/commit or direct URL)
|
24 |
+
* Any special configuration required to reproduce the issue
|
25 |
+
* Step-by-step instructions to reproduce the issue
|
26 |
+
* Proof-of-concept or exploit code (if possible)
|
27 |
+
* Impact of the issue, including how an attacker might exploit the issue
|
28 |
+
|
29 |
+
This information will help us triage your report more quickly.
|
30 |
+
|
31 |
+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
|
32 |
+
|
33 |
+
## Preferred Languages
|
34 |
+
|
35 |
+
We prefer all communications to be in English.
|
36 |
+
|
37 |
+
## Policy
|
38 |
+
|
39 |
+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
|
40 |
+
|
41 |
+
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
botbuilder-python/UsingTestPyPI.md
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Using TestPyPI to consume rc builds
|
2 |
+
The BotBuilder SDK rc build feed is found on [TestPyPI](https://test.pypi.org/).
|
3 |
+
|
4 |
+
The daily builds will be available soon through the mentioned feed as well.
|
5 |
+
|
6 |
+
|
7 |
+
# Configure TestPyPI
|
8 |
+
|
9 |
+
You can tell pip to download packages from TestPyPI instead of PyPI by specifying the --index-url flag (in the example below, replace 'botbuilder-core' for the name of the library you want to install)
|
10 |
+
|
11 |
+
```bash
|
12 |
+
$ pip install --index-url https://test.pypi.org/simple/ botbuilder-core
|
13 |
+
```
|
14 |
+
If you want to allow pip to also pull other packages from PyPI you can specify --extra-index-url to point to PyPI.
|
15 |
+
This is useful when the package you’re testing has dependencies:
|
16 |
+
|
17 |
+
```bash
|
18 |
+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ botbuilder-core
|
19 |
+
```
|
botbuilder-python/doc/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# Contributing
|
3 |
+
|
4 |
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
5 |
+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
6 |
+
the rights to use your contribution. For details, visit https://cla.microsoft.com.
|
7 |
+
|
8 |
+
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
|
9 |
+
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
|
10 |
+
provided by the bot. You will only need to do this once across all repos using our CLA.
|
11 |
+
|
12 |
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
13 |
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
14 |
+
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
|
botbuilder-python/doc/SkillClaimsValidation.md
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# HowTo: Block all Skill Claims
|
2 |
+
|
3 |
+
Write a class that conforms to the `ValidateClaims` interface and throws an exception if the claims are skill claims:
|
4 |
+
```python
|
5 |
+
class AllowedSkillsClaimsValidator:
|
6 |
+
|
7 |
+
config_key = "ALLOWED_CALLERS"
|
8 |
+
|
9 |
+
def __init__(self, config: DefaultConfig):
|
10 |
+
if not config:
|
11 |
+
raise TypeError(
|
12 |
+
"AllowedSkillsClaimsValidator: config object cannot be None."
|
13 |
+
)
|
14 |
+
|
15 |
+
# ALLOWED_CALLERS is the setting in config.py file
|
16 |
+
# that consists of the list of parent bot ids that are allowed to access the skill
|
17 |
+
# to add a new parent bot simply go to the AllowedCallers and add
|
18 |
+
# the parent bot's microsoft app id to the list
|
19 |
+
caller_list = getattr(config, self.config_key)
|
20 |
+
if caller_list is None:
|
21 |
+
raise TypeError(f'"{self.config_key}" not found in configuration.')
|
22 |
+
self._allowed_callers = caller_list
|
23 |
+
|
24 |
+
@property
|
25 |
+
def claims_validator(self) -> Callable[[List[Dict]], Awaitable]:
|
26 |
+
async def allow_callers_claims_validator(claims: Dict[str, object]):
|
27 |
+
if skillValidation.is_skill_claim(claims):
|
28 |
+
raise PermissionError(
|
29 |
+
"Invalid call from a skill."
|
30 |
+
)
|
31 |
+
|
32 |
+
return
|
33 |
+
|
34 |
+
return allow_callers_claims_validator
|
35 |
+
```
|
36 |
+
|
37 |
+
Update `BotFrameworkAdapter` instantiation, to pass the `AuthenticationConfiguration` constructor the function defined above:
|
38 |
+
```python
|
39 |
+
AUTH_CONFIG = AuthenticationConfiguration(
|
40 |
+
claims_validator=AllowedSkillsClaimsValidator(CONFIG).claims_validator
|
41 |
+
)
|
42 |
+
SETTINGS = BotFrameworkAdapterSettings(
|
43 |
+
...,
|
44 |
+
auth_configuration=AUTH_CONFIG,
|
45 |
+
)
|
46 |
+
ADAPTER = BotFrameworkAdapter(
|
47 |
+
...,
|
48 |
+
SETTINGS,
|
49 |
+
)
|
50 |
+
```
|
51 |
+
|
52 |
+
For SingleTenant type bots, the additional issuers must be added based on the tenant id:
|
53 |
+
```python
|
54 |
+
AUTH_CONFIG = AuthenticationConfiguration(
|
55 |
+
claims_validator=AllowedSkillsClaimsValidator(CONFIG).claims_validator,
|
56 |
+
tenant_id=the_tenant_id
|
57 |
+
)
|
58 |
+
```
|
botbuilder-python/doc/media/FrameWorkPython.png
ADDED
botbuilder-python/generators/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2018 Microsoft Corporation
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
botbuilder-python/generators/README.md
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# python-generator-botbuilder
|
2 |
+
|
3 |
+
Cookiecutter generators for [Bot Framework v4](https://dev.botframework.com). Will let you quickly set up a conversational AI bot
|
4 |
+
using core AI capabilities.
|
5 |
+
|
6 |
+
## About
|
7 |
+
|
8 |
+
`python-generator-botbuilder` will help you build new conversational AI bots using the [Bot Framework v4](https://dev.botframework.com).
|
9 |
+
|
10 |
+
## Templates
|
11 |
+
|
12 |
+
The generator supports three different template options. The table below can help guide which template is right for you.
|
13 |
+
|
14 |
+
| Template | Description |
|
15 |
+
| ---------- | --------- |
|
16 |
+
| Echo Bot | A good template if you want a little more than "Hello World!", but not much more. This template handles the very basics of sending messages to a bot, and having the bot process the messages by repeating them back to the user. This template produces a bot that simply "echoes" back to the user anything the user says to the bot. |
|
17 |
+
| Core Bot | Our most advanced template, the Core template provides 6 core features every bot is likely to have. This template covers the core features of a Conversational-AI bot using [LUIS](https://www.luis.ai). See the **Core Bot Features** table below for more details. |
|
18 |
+
| Empty Bot | A good template if you are familiar with Bot Framework v4, and simply want a basic skeleton project. Also a good option if you want to take sample code from the documentation and paste it into a minimal bot in order to learn. |
|
19 |
+
|
20 |
+
### How to Choose a Template
|
21 |
+
|
22 |
+
| Template | When This Template is a Good Choice |
|
23 |
+
| -------- | -------- |
|
24 |
+
| Echo Bot | You are new to Bot Framework v4 and want a working bot with minimal features. |
|
25 |
+
| Core Bot | You understand some of the core concepts of Bot Framework v4 and are beyond the concepts introduced in the Echo Bot template. You're familiar with or are ready to learn concepts such as language understanding using LUIS, managing multi-turn conversations with Dialogs, handling user initiated Dialog interruptions, and using Adaptive Cards to welcome your users. |
|
26 |
+
| Empty Bot | You are a seasoned Bot Framework v4 developer. You've built bots before, and want the minimum skeleton of a bot. |
|
27 |
+
|
28 |
+
### Template Overview
|
29 |
+
|
30 |
+
#### Echo Bot Template
|
31 |
+
|
32 |
+
The Echo Bot template is slightly more than the a classic "Hello World!" example, but not by much. This template shows the basic structure of a bot, how a bot recieves messages from a user, and how a bot sends messages to a user. The bot will "echo" back to the user, what the user says to the bot. It is a good choice for first time, new to Bot Framework v4 developers.
|
33 |
+
|
34 |
+
#### Core Bot Template
|
35 |
+
|
36 |
+
The Core Bot template consists of set of core features most every bot is likely to have. Building off of the core message processing features found in the Echo Bot template, this template adds a number of more sophisticated features. The table below lists these features and provides links to additional documentation.
|
37 |
+
|
38 |
+
| Core Bot Features | Description |
|
39 |
+
| ------------------ | ----------- |
|
40 |
+
| [Send and receive messages](https://docs.microsoft.com/azure/bot-service/bot-builder-howto-send-messages?view=azure-bot-service-4.0) | The primary way your bot will communicate with users, and likewise receive communication, is through message activities. Some messages may simply consist of plain text, while others may contain richer content such as cards or attachments. |
|
41 |
+
| [Proactive messaging](https://docs.microsoft.com/azure/bot-service/bot-builder-howto-proactive-message?view=azure-bot-service-4.0) using [Adaptive Cards](https://docs.microsoft.com/azure/bot-service/bot-builder-send-welcome-message?view=azure-bot-service-4.0?#using-adaptive-card-greeting) | The primary goal when creating any bot is to engage your user in a meaningful conversation. One of the best ways to achieve this goal is to ensure that from the moment a user first connects to your bot, they understand your bot’s main purpose and capabilities. We refer to this as "welcoming the user." The Core template uses an [Adaptive Card](http://adaptivecards.io) to implement this behavior. |
|
42 |
+
| [Language understanding using LUIS](https://docs.microsoft.com/azure/bot-service/bot-builder-howto-v4-luis?view=azure-bot-service-4.0) | The ability to understand what your user means conversationally and contextually can be a difficult task, but can provide your bot a more natural conversation feel. Language Understanding, called LUIS, enables you to do just that so that your bot can recognize the intent of user messages, allow for more natural language from your user, and better direct the conversation flow. |
|
43 |
+
| [Multi-turn conversation support using Dialogs](https://docs.microsoft.com/azure/bot-service/bot-builder-concept-dialog?view=azure-bot-service-4.0) | The ability to manage conversations is an important part of the bot/user interation. Bot Framework introduces the concept of a Dialog to handle this conversational pattern. Dialog objects process inbound Activities and generate outbound responses. The business logic of the bot runs either directly or indirectly within Dialog classes. |
|
44 |
+
| [Managing conversation state](https://docs.microsoft.com/azure/bot-service/bot-builder-howto-v4-state?view=azure-bot-service-4.0) | A key to good bot design is to track the context of a conversation, so that your bot remembers things like the answers to previous questions. |
|
45 |
+
| [How to handle user-initiated interruptions](https://docs.microsoft.com/azure/bot-service/bot-builder-howto-handle-user-interrupt?view=azure-bot-service-4.0) | While you may think that your users will follow your defined conversation flow step by step, chances are good that they will change their minds or ask a question in the middle of the process instead of answering the question. Handling interruptions means making sure your bot is prepared to handle situations like this. |
|
46 |
+
| [How to unit test a bot](https://aka.ms/cs-unit-test-docs) | Optionally, the Core Bot template can generate corresponding unit tests that shows how to use the testing framework introduced in Bot Framework version 4.5. Selecting this option provides a complete set of units tests for Core Bot. It shows how to write unit tests to test the various features of Core Bot. To add the Core Bot unit tests, run the generator and answer `yes` when prompted. See below for an example of how to do this from the command line. |
|
47 |
+
|
48 |
+
#### Empty Bot Template
|
49 |
+
|
50 |
+
The Empty Bot template is the minimal skeleton code for a bot. It provides a stub `on_turn` handler but does not perform any actions. If you are experienced writing bots with Bot Framework v4 and want the minimum scaffolding, the Empty template is for you.
|
51 |
+
|
52 |
+
## Features by Template
|
53 |
+
|
54 |
+
| Feature | Empty Bot | Echo Bot | Core Bot* |
|
55 |
+
| --------- | :-----: | :-----: | :-----: |
|
56 |
+
| Generate code in Python | X | X | X |
|
57 |
+
| Support local development and testing using the [Bot Framework Emulator v4](https://www.github.com/microsoft/botframework-emulator) | X | X | X |
|
58 |
+
| Core bot message processing | | X | X |
|
59 |
+
| Deploy your bot to Microsoft Azure | | Pending | Pending |
|
60 |
+
| Welcome new users using Adaptive Card technology | | | X |
|
61 |
+
| Support AI-based greetings using [LUIS](https://www.luis.ai) | | | X |
|
62 |
+
| Use Dialogs to manage more in-depth conversations | | | X |
|
63 |
+
| Manage conversation state | | | X |
|
64 |
+
| Handle user interruptions | | | X |
|
65 |
+
| Unit test a bot using Bot Framework Testing framework (optional) | | | X |
|
66 |
+
|
67 |
+
*Core Bot template is a work in progress landing soon.
|
68 |
+
## Installation
|
69 |
+
|
70 |
+
1. Install [cookiecutter](https://github.com/cookiecutter/cookiecutter) using [pip](https://pip.pypa.io/en/stable/) (we assume you have pre-installed [python 3](https://www.python.org/downloads/)).
|
71 |
+
|
72 |
+
```bash
|
73 |
+
pip install cookiecutter
|
74 |
+
```
|
75 |
+
|
76 |
+
2. Verify that cookiecutter has been installed correctly by typing the following into your console:
|
77 |
+
|
78 |
+
```bash
|
79 |
+
cookiecutter --help
|
80 |
+
```
|
81 |
+
|
82 |
+
|
83 |
+
## Usage
|
84 |
+
|
85 |
+
### Creating a New Bot Project
|
86 |
+
|
87 |
+
To create an Echo Bot project:
|
88 |
+
|
89 |
+
```bash
|
90 |
+
cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/echo.zip
|
91 |
+
```
|
92 |
+
|
93 |
+
To create a Core Bot project:
|
94 |
+
|
95 |
+
```bash
|
96 |
+
cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/core.zip
|
97 |
+
```
|
98 |
+
|
99 |
+
To create an Empty Bot project:
|
100 |
+
|
101 |
+
```bash
|
102 |
+
cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/empty.zip
|
103 |
+
```
|
104 |
+
|
105 |
+
When the generator is launched, it will prompt for the information required to create a new bot.
|
106 |
+
|
107 |
+
### Generator Command Line Options and Arguments
|
108 |
+
|
109 |
+
Cookiecutter supports a set of pre-defined command line options, the complete list with descriptions is available [here](https://cookiecutter.readthedocs.io/en/0.9.1/advanced_usage.html#command-line-options).
|
110 |
+
|
111 |
+
Each generator can recieve a series of named arguments to pre-seed the prompt default value. If the `--no-input` option flag is send, these named arguments will be the default values for the template.
|
112 |
+
|
113 |
+
| Named argument | Description |
|
114 |
+
| ------------------- | ----------- |
|
115 |
+
| project_name | The name given to the bot project |
|
116 |
+
| bot_description | A brief bit of text that describes the purpose of the bot |
|
117 |
+
| add_tests | **PENDING** _A Core Bot Template Only Feature_. The generator will add unit tests to the Core Bot generated bot. This option is not available to other templates at this time. To learn more about the test framework released with Bot Framework v4.5, see [How to unit test bots](https://aka.ms/js-unit-test-docs). This option is intended to enable automated bot generation for testing purposes. |
|
118 |
+
|
119 |
+
#### Example Using Named Arguments
|
120 |
+
|
121 |
+
This example shows how to pass named arguments to the generator, setting the default bot name to test_project.
|
122 |
+
|
123 |
+
```bash
|
124 |
+
# Run the generator defaulting the bot name to test_project
|
125 |
+
cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/echo.zip project_name="test_project"
|
126 |
+
```
|
127 |
+
|
128 |
+
### Generating a Bot Using --no-input
|
129 |
+
|
130 |
+
The generator can be run in `--no-input` mode, which can be used for automated bot creation. When run in `--no-input` mode, the generator can be configured using named arguments as documented above. If a named argument is ommitted a reasonable default will be used.
|
131 |
+
|
132 |
+
#### Default Values
|
133 |
+
|
134 |
+
| Named argument | Default Value |
|
135 |
+
| ------------------- | ----------- |
|
136 |
+
| bot_name | `my-chat-bot` |
|
137 |
+
| bot_description | "Demonstrate the core capabilities of the Microsoft Bot Framework" |
|
138 |
+
| add_tests | `False`|
|
139 |
+
|
140 |
+
#### Examples Using --no-input
|
141 |
+
|
142 |
+
This example shows how to run the generator in --no-input mode, setting all required options on the command line.
|
143 |
+
|
144 |
+
```bash
|
145 |
+
# Run the generator, setting all command line options
|
146 |
+
cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/echo.zip --no-input project_name="test_bot" bot_description="Test description"
|
147 |
+
```
|
148 |
+
|
149 |
+
This example shows how to run the generator in --no-input mode, using all the default command line options. The generator will create a bot project using all the default values specified in the **Default Options** table above.
|
150 |
+
|
151 |
+
```bash
|
152 |
+
# Run the generator using all default options
|
153 |
+
cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/echo.zip --no-input
|
154 |
+
```
|
155 |
+
|
156 |
+
This example shows how to run the generator in --no-input mode, with unit tests.
|
157 |
+
|
158 |
+
```bash
|
159 |
+
# PENDING: Run the generator using all default options
|
160 |
+
```
|
161 |
+
|
162 |
+
## Running Your Bot
|
163 |
+
|
164 |
+
### Running Your Bot Locally
|
165 |
+
|
166 |
+
To run your bot locally, type the following in your console:
|
167 |
+
|
168 |
+
```bash
|
169 |
+
# install dependencies
|
170 |
+
pip install -r requirements.txt
|
171 |
+
```
|
172 |
+
|
173 |
+
```bash
|
174 |
+
# run the bot
|
175 |
+
python app.py
|
176 |
+
```
|
177 |
+
|
178 |
+
Alternatively to the last command, you can set the file in an environment variable with `set FLASK_APP=app.py` in windows (`export FLASK_APP=app.py` in mac/linux) and then run `flask run --host=127.0.0.1 --port=3978`
|
179 |
+
|
180 |
+
### Interacting With Your Bot Using the Emulator
|
181 |
+
|
182 |
+
- Launch Bot Framework Emulator
|
183 |
+
- File -> Open Bot
|
184 |
+
- Enter a Bot URL of `http://localhost:3978/api/messages`
|
185 |
+
|
186 |
+
Once the Emulator is connected, you can interact with and receive messages from your bot.
|
187 |
+
|
188 |
+
#### Lint Compliant Code
|
189 |
+
|
190 |
+
The code generated by the botbuilder generator is pylint compliant to our ruleset. To use pylint as your develop your bot:
|
191 |
+
|
192 |
+
```bash
|
193 |
+
# Assuming you created a project with the bot_name value 'my_chat_bot'
|
194 |
+
pylint --rcfile=my_chat_bot/.pylintrc my_chat_bot
|
195 |
+
```
|
196 |
+
|
197 |
+
#### Testing Core Bots with Tests (Pending)
|
198 |
+
|
199 |
+
Core Bot templates generated with unit tests can be tested using the following:
|
200 |
+
|
201 |
+
```bash
|
202 |
+
# launch pytest
|
203 |
+
pytest
|
204 |
+
```
|
205 |
+
|
206 |
+
## Deploy Your Bot to Azure
|
207 |
+
|
208 |
+
After creating the bot and testing it locally, you can deploy it to Azure to make it accessible from anywhere.
|
209 |
+
To learn how, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete set of deployment instructions.
|
210 |
+
|
211 |
+
If you are new to Microsoft Azure, please refer to [Getting started with Azure](https://azure.microsoft.com/get-started/) for guidance on how to get started on Azure.
|
212 |
+
|
213 |
+
## Logging Issues and Providing Feedback
|
214 |
+
|
215 |
+
Issues and feedback about the botbuilder generator can be submitted through the project's [GitHub Issues](https://github.com/Microsoft/botbuilder-python/issues) page.
|
botbuilder-python/generators/app/templates/core/cookiecutter.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bot_name": "my_chat_bot",
|
3 |
+
"bot_description": "Demonstrate the core capabilities of the Microsoft Bot Framework"
|
4 |
+
}
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/.pylintrc
ADDED
@@ -0,0 +1,498 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[MASTER]
|
2 |
+
|
3 |
+
# A comma-separated list of package or module names from where C extensions may
|
4 |
+
# be loaded. Extensions are loading into the active Python interpreter and may
|
5 |
+
# run arbitrary code.
|
6 |
+
extension-pkg-whitelist=
|
7 |
+
|
8 |
+
# Add files or directories to the blacklist. They should be base names, not
|
9 |
+
# paths.
|
10 |
+
ignore=
|
11 |
+
|
12 |
+
# Add files or directories matching the regex patterns to the blacklist. The
|
13 |
+
# regex matches against base names, not paths.
|
14 |
+
ignore-patterns=
|
15 |
+
|
16 |
+
# Python code to execute, usually for sys.path manipulation such as
|
17 |
+
# pygtk.require().
|
18 |
+
#init-hook=
|
19 |
+
|
20 |
+
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
|
21 |
+
# number of processors available to use.
|
22 |
+
jobs=1
|
23 |
+
|
24 |
+
# Control the amount of potential inferred values when inferring a single
|
25 |
+
# object. This can help the performance when dealing with large functions or
|
26 |
+
# complex, nested conditions.
|
27 |
+
limit-inference-results=100
|
28 |
+
|
29 |
+
# List of plugins (as comma separated values of python modules names) to load,
|
30 |
+
# usually to register additional checkers.
|
31 |
+
load-plugins=
|
32 |
+
|
33 |
+
# Pickle collected data for later comparisons.
|
34 |
+
persistent=yes
|
35 |
+
|
36 |
+
# Specify a configuration file.
|
37 |
+
#rcfile=
|
38 |
+
|
39 |
+
# When enabled, pylint would attempt to guess common misconfiguration and emit
|
40 |
+
# user-friendly hints instead of false-positive error messages.
|
41 |
+
suggestion-mode=yes
|
42 |
+
|
43 |
+
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
44 |
+
# active Python interpreter and may run arbitrary code.
|
45 |
+
unsafe-load-any-extension=no
|
46 |
+
|
47 |
+
|
48 |
+
[MESSAGES CONTROL]
|
49 |
+
|
50 |
+
# Only show warnings with the listed confidence levels. Leave empty to show
|
51 |
+
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
|
52 |
+
confidence=
|
53 |
+
|
54 |
+
# Disable the message, report, category or checker with the given id(s). You
|
55 |
+
# can either give multiple identifiers separated by comma (,) or put this
|
56 |
+
# option multiple times (only on the command line, not in the configuration
|
57 |
+
# file where it should appear only once). You can also use "--disable=all" to
|
58 |
+
# disable everything first and then reenable specific checks. For example, if
|
59 |
+
# you want to run only the similarities checker, you can use "--disable=all
|
60 |
+
# --enable=similarities". If you want to run only the classes checker, but have
|
61 |
+
# no Warning level messages displayed, use "--disable=all --enable=classes
|
62 |
+
# --disable=W".
|
63 |
+
disable=missing-docstring,
|
64 |
+
too-few-public-methods,
|
65 |
+
bad-continuation,
|
66 |
+
no-self-use,
|
67 |
+
duplicate-code,
|
68 |
+
broad-except,
|
69 |
+
no-name-in-module
|
70 |
+
|
71 |
+
# Enable the message, report, category or checker with the given id(s). You can
|
72 |
+
# either give multiple identifier separated by comma (,) or put this option
|
73 |
+
# multiple time (only on the command line, not in the configuration file where
|
74 |
+
# it should appear only once). See also the "--disable" option for examples.
|
75 |
+
enable=c-extension-no-member
|
76 |
+
|
77 |
+
|
78 |
+
[REPORTS]
|
79 |
+
|
80 |
+
# Python expression which should return a note less than 10 (10 is the highest
|
81 |
+
# note). You have access to the variables errors warning, statement which
|
82 |
+
# respectively contain the number of errors / warnings messages and the total
|
83 |
+
# number of statements analyzed. This is used by the global evaluation report
|
84 |
+
# (RP0004).
|
85 |
+
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
86 |
+
|
87 |
+
# Template used to display messages. This is a python new-style format string
|
88 |
+
# used to format the message information. See doc for all details.
|
89 |
+
#msg-template=
|
90 |
+
|
91 |
+
# Set the output format. Available formats are text, parseable, colorized, json
|
92 |
+
# and msvs (visual studio). You can also give a reporter class, e.g.
|
93 |
+
# mypackage.mymodule.MyReporterClass.
|
94 |
+
output-format=text
|
95 |
+
|
96 |
+
# Tells whether to display a full report or only the messages.
|
97 |
+
reports=no
|
98 |
+
|
99 |
+
# Activate the evaluation score.
|
100 |
+
score=yes
|
101 |
+
|
102 |
+
|
103 |
+
[REFACTORING]
|
104 |
+
|
105 |
+
# Maximum number of nested blocks for function / method body
|
106 |
+
max-nested-blocks=5
|
107 |
+
|
108 |
+
# Complete name of functions that never returns. When checking for
|
109 |
+
# inconsistent-return-statements if a never returning function is called then
|
110 |
+
# it will be considered as an explicit return statement and no message will be
|
111 |
+
# printed.
|
112 |
+
never-returning-functions=sys.exit
|
113 |
+
|
114 |
+
|
115 |
+
[LOGGING]
|
116 |
+
|
117 |
+
# Format style used to check logging format string. `old` means using %
|
118 |
+
# formatting, while `new` is for `{}` formatting.
|
119 |
+
logging-format-style=old
|
120 |
+
|
121 |
+
# Logging modules to check that the string format arguments are in logging
|
122 |
+
# function parameter format.
|
123 |
+
logging-modules=logging
|
124 |
+
|
125 |
+
|
126 |
+
[SPELLING]
|
127 |
+
|
128 |
+
# Limits count of emitted suggestions for spelling mistakes.
|
129 |
+
max-spelling-suggestions=4
|
130 |
+
|
131 |
+
# Spelling dictionary name. Available dictionaries: none. To make it working
|
132 |
+
# install python-enchant package..
|
133 |
+
spelling-dict=
|
134 |
+
|
135 |
+
# List of comma separated words that should not be checked.
|
136 |
+
spelling-ignore-words=
|
137 |
+
|
138 |
+
# A path to a file that contains private dictionary; one word per line.
|
139 |
+
spelling-private-dict-file=
|
140 |
+
|
141 |
+
# Tells whether to store unknown words to indicated private dictionary in
|
142 |
+
# --spelling-private-dict-file option instead of raising a message.
|
143 |
+
spelling-store-unknown-words=no
|
144 |
+
|
145 |
+
|
146 |
+
[MISCELLANEOUS]
|
147 |
+
|
148 |
+
# List of note tags to take in consideration, separated by a comma.
|
149 |
+
notes=FIXME,
|
150 |
+
XXX,
|
151 |
+
TODO
|
152 |
+
|
153 |
+
|
154 |
+
[TYPECHECK]
|
155 |
+
|
156 |
+
# List of decorators that produce context managers, such as
|
157 |
+
# contextlib.contextmanager. Add to this list to register other decorators that
|
158 |
+
# produce valid context managers.
|
159 |
+
contextmanager-decorators=contextlib.contextmanager
|
160 |
+
|
161 |
+
# List of members which are set dynamically and missed by pylint inference
|
162 |
+
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
163 |
+
# expressions are accepted.
|
164 |
+
generated-members=
|
165 |
+
|
166 |
+
# Tells whether missing members accessed in mixin class should be ignored. A
|
167 |
+
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
168 |
+
ignore-mixin-members=yes
|
169 |
+
|
170 |
+
# Tells whether to warn about missing members when the owner of the attribute
|
171 |
+
# is inferred to be None.
|
172 |
+
ignore-none=yes
|
173 |
+
|
174 |
+
# This flag controls whether pylint should warn about no-member and similar
|
175 |
+
# checks whenever an opaque object is returned when inferring. The inference
|
176 |
+
# can return multiple potential results while evaluating a Python object, but
|
177 |
+
# some branches might not be evaluated, which results in partial inference. In
|
178 |
+
# that case, it might be useful to still emit no-member and other checks for
|
179 |
+
# the rest of the inferred objects.
|
180 |
+
ignore-on-opaque-inference=yes
|
181 |
+
|
182 |
+
# List of class names for which member attributes should not be checked (useful
|
183 |
+
# for classes with dynamically set attributes). This supports the use of
|
184 |
+
# qualified names.
|
185 |
+
ignored-classes=optparse.Values,thread._local,_thread._local
|
186 |
+
|
187 |
+
# List of module names for which member attributes should not be checked
|
188 |
+
# (useful for modules/projects where namespaces are manipulated during runtime
|
189 |
+
# and thus existing member attributes cannot be deduced by static analysis. It
|
190 |
+
# supports qualified module names, as well as Unix pattern matching.
|
191 |
+
ignored-modules=
|
192 |
+
|
193 |
+
# Show a hint with possible names when a member name was not found. The aspect
|
194 |
+
# of finding the hint is based on edit distance.
|
195 |
+
missing-member-hint=yes
|
196 |
+
|
197 |
+
# The minimum edit distance a name should have in order to be considered a
|
198 |
+
# similar match for a missing member name.
|
199 |
+
missing-member-hint-distance=1
|
200 |
+
|
201 |
+
# The total number of similar names that should be taken in consideration when
|
202 |
+
# showing a hint for a missing member.
|
203 |
+
missing-member-max-choices=1
|
204 |
+
|
205 |
+
|
206 |
+
[VARIABLES]
|
207 |
+
|
208 |
+
# List of additional names supposed to be defined in builtins. Remember that
|
209 |
+
# you should avoid defining new builtins when possible.
|
210 |
+
additional-builtins=
|
211 |
+
|
212 |
+
# Tells whether unused global variables should be treated as a violation.
|
213 |
+
allow-global-unused-variables=yes
|
214 |
+
|
215 |
+
# List of strings which can identify a callback function by name. A callback
|
216 |
+
# name must start or end with one of those strings.
|
217 |
+
callbacks=cb_,
|
218 |
+
_cb
|
219 |
+
|
220 |
+
# A regular expression matching the name of dummy variables (i.e. expected to
|
221 |
+
# not be used).
|
222 |
+
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
|
223 |
+
|
224 |
+
# Argument names that match this expression will be ignored. Default to name
|
225 |
+
# with leading underscore.
|
226 |
+
ignored-argument-names=_.*|^ignored_|^unused_
|
227 |
+
|
228 |
+
# Tells whether we should check for unused import in __init__ files.
|
229 |
+
init-import=no
|
230 |
+
|
231 |
+
# List of qualified module names which can have objects that can redefine
|
232 |
+
# builtins.
|
233 |
+
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
|
234 |
+
|
235 |
+
|
236 |
+
[FORMAT]
|
237 |
+
|
238 |
+
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
239 |
+
expected-line-ending-format=
|
240 |
+
|
241 |
+
# Regexp for a line that is allowed to be longer than the limit.
|
242 |
+
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
243 |
+
|
244 |
+
# Number of spaces of indent required inside a hanging or continued line.
|
245 |
+
indent-after-paren=4
|
246 |
+
|
247 |
+
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
248 |
+
# tab).
|
249 |
+
indent-string=' '
|
250 |
+
|
251 |
+
# Maximum number of characters on a single line.
|
252 |
+
max-line-length=120
|
253 |
+
|
254 |
+
# Maximum number of lines in a module.
|
255 |
+
max-module-lines=1000
|
256 |
+
|
257 |
+
# List of optional constructs for which whitespace checking is disabled. `dict-
|
258 |
+
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
|
259 |
+
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
|
260 |
+
# `empty-line` allows space-only lines.
|
261 |
+
no-space-check=trailing-comma,
|
262 |
+
dict-separator
|
263 |
+
|
264 |
+
# Allow the body of a class to be on the same line as the declaration if body
|
265 |
+
# contains single statement.
|
266 |
+
single-line-class-stmt=no
|
267 |
+
|
268 |
+
# Allow the body of an if to be on the same line as the test if there is no
|
269 |
+
# else.
|
270 |
+
single-line-if-stmt=no
|
271 |
+
|
272 |
+
|
273 |
+
[SIMILARITIES]
|
274 |
+
|
275 |
+
# Ignore comments when computing similarities.
|
276 |
+
ignore-comments=yes
|
277 |
+
|
278 |
+
# Ignore docstrings when computing similarities.
|
279 |
+
ignore-docstrings=yes
|
280 |
+
|
281 |
+
# Ignore imports when computing similarities.
|
282 |
+
ignore-imports=no
|
283 |
+
|
284 |
+
# Minimum lines number of a similarity.
|
285 |
+
min-similarity-lines=4
|
286 |
+
|
287 |
+
|
288 |
+
[BASIC]
|
289 |
+
|
290 |
+
# Naming style matching correct argument names.
|
291 |
+
argument-naming-style=snake_case
|
292 |
+
|
293 |
+
# Regular expression matching correct argument names. Overrides argument-
|
294 |
+
# naming-style.
|
295 |
+
#argument-rgx=
|
296 |
+
|
297 |
+
# Naming style matching correct attribute names.
|
298 |
+
attr-naming-style=snake_case
|
299 |
+
|
300 |
+
# Regular expression matching correct attribute names. Overrides attr-naming-
|
301 |
+
# style.
|
302 |
+
#attr-rgx=
|
303 |
+
|
304 |
+
# Bad variable names which should always be refused, separated by a comma.
|
305 |
+
bad-names=foo,
|
306 |
+
bar,
|
307 |
+
baz,
|
308 |
+
toto,
|
309 |
+
tutu,
|
310 |
+
tata
|
311 |
+
|
312 |
+
# Naming style matching correct class attribute names.
|
313 |
+
class-attribute-naming-style=any
|
314 |
+
|
315 |
+
# Regular expression matching correct class attribute names. Overrides class-
|
316 |
+
# attribute-naming-style.
|
317 |
+
#class-attribute-rgx=
|
318 |
+
|
319 |
+
# Naming style matching correct class names.
|
320 |
+
class-naming-style=PascalCase
|
321 |
+
|
322 |
+
# Regular expression matching correct class names. Overrides class-naming-
|
323 |
+
# style.
|
324 |
+
#class-rgx=
|
325 |
+
|
326 |
+
# Naming style matching correct constant names.
|
327 |
+
const-naming-style=UPPER_CASE
|
328 |
+
|
329 |
+
# Regular expression matching correct constant names. Overrides const-naming-
|
330 |
+
# style.
|
331 |
+
#const-rgx=
|
332 |
+
|
333 |
+
# Minimum line length for functions/classes that require docstrings, shorter
|
334 |
+
# ones are exempt.
|
335 |
+
docstring-min-length=-1
|
336 |
+
|
337 |
+
# Naming style matching correct function names.
|
338 |
+
function-naming-style=snake_case
|
339 |
+
|
340 |
+
# Regular expression matching correct function names. Overrides function-
|
341 |
+
# naming-style.
|
342 |
+
#function-rgx=
|
343 |
+
|
344 |
+
# Good variable names which should always be accepted, separated by a comma.
|
345 |
+
good-names=i,
|
346 |
+
j,
|
347 |
+
k,
|
348 |
+
ex,
|
349 |
+
Run,
|
350 |
+
_
|
351 |
+
|
352 |
+
# Include a hint for the correct naming format with invalid-name.
|
353 |
+
include-naming-hint=no
|
354 |
+
|
355 |
+
# Naming style matching correct inline iteration names.
|
356 |
+
inlinevar-naming-style=any
|
357 |
+
|
358 |
+
# Regular expression matching correct inline iteration names. Overrides
|
359 |
+
# inlinevar-naming-style.
|
360 |
+
#inlinevar-rgx=
|
361 |
+
|
362 |
+
# Naming style matching correct method names.
|
363 |
+
method-naming-style=snake_case
|
364 |
+
|
365 |
+
# Regular expression matching correct method names. Overrides method-naming-
|
366 |
+
# style.
|
367 |
+
#method-rgx=
|
368 |
+
|
369 |
+
# Naming style matching correct module names.
|
370 |
+
module-naming-style=snake_case
|
371 |
+
|
372 |
+
# Regular expression matching correct module names. Overrides module-naming-
|
373 |
+
# style.
|
374 |
+
#module-rgx=
|
375 |
+
|
376 |
+
# Colon-delimited sets of names that determine each other's naming style when
|
377 |
+
# the name regexes allow several styles.
|
378 |
+
name-group=
|
379 |
+
|
380 |
+
# Regular expression which should only match function or class names that do
|
381 |
+
# not require a docstring.
|
382 |
+
no-docstring-rgx=^_
|
383 |
+
|
384 |
+
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
385 |
+
# to this list to register other decorators that produce valid properties.
|
386 |
+
# These decorators are taken in consideration only for invalid-name.
|
387 |
+
property-classes=abc.abstractproperty
|
388 |
+
|
389 |
+
# Naming style matching correct variable names.
|
390 |
+
variable-naming-style=snake_case
|
391 |
+
|
392 |
+
# Regular expression matching correct variable names. Overrides variable-
|
393 |
+
# naming-style.
|
394 |
+
#variable-rgx=
|
395 |
+
|
396 |
+
|
397 |
+
[STRING]
|
398 |
+
|
399 |
+
# This flag controls whether the implicit-str-concat-in-sequence should
|
400 |
+
# generate a warning on implicit string concatenation in sequences defined over
|
401 |
+
# several lines.
|
402 |
+
check-str-concat-over-line-jumps=no
|
403 |
+
|
404 |
+
|
405 |
+
[IMPORTS]
|
406 |
+
|
407 |
+
# Allow wildcard imports from modules that define __all__.
|
408 |
+
allow-wildcard-with-all=no
|
409 |
+
|
410 |
+
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
411 |
+
# 3 compatible code, which means that the block might have code that exists
|
412 |
+
# only in one or another interpreter, leading to false positives when analysed.
|
413 |
+
analyse-fallback-blocks=no
|
414 |
+
|
415 |
+
# Deprecated modules which should not be used, separated by a comma.
|
416 |
+
deprecated-modules=optparse,tkinter.tix
|
417 |
+
|
418 |
+
# Create a graph of external dependencies in the given file (report RP0402 must
|
419 |
+
# not be disabled).
|
420 |
+
ext-import-graph=
|
421 |
+
|
422 |
+
# Create a graph of every (i.e. internal and external) dependencies in the
|
423 |
+
# given file (report RP0402 must not be disabled).
|
424 |
+
import-graph=
|
425 |
+
|
426 |
+
# Create a graph of internal dependencies in the given file (report RP0402 must
|
427 |
+
# not be disabled).
|
428 |
+
int-import-graph=
|
429 |
+
|
430 |
+
# Force import order to recognize a module as part of the standard
|
431 |
+
# compatibility libraries.
|
432 |
+
known-standard-library=
|
433 |
+
|
434 |
+
# Force import order to recognize a module as part of a third party library.
|
435 |
+
known-third-party=enchant
|
436 |
+
|
437 |
+
|
438 |
+
[CLASSES]
|
439 |
+
|
440 |
+
# List of method names used to declare (i.e. assign) instance attributes.
|
441 |
+
defining-attr-methods=__init__,
|
442 |
+
__new__,
|
443 |
+
setUp
|
444 |
+
|
445 |
+
# List of member names, which should be excluded from the protected access
|
446 |
+
# warning.
|
447 |
+
exclude-protected=_asdict,
|
448 |
+
_fields,
|
449 |
+
_replace,
|
450 |
+
_source,
|
451 |
+
_make
|
452 |
+
|
453 |
+
# List of valid names for the first argument in a class method.
|
454 |
+
valid-classmethod-first-arg=cls
|
455 |
+
|
456 |
+
# List of valid names for the first argument in a metaclass class method.
|
457 |
+
valid-metaclass-classmethod-first-arg=cls
|
458 |
+
|
459 |
+
|
460 |
+
[DESIGN]
|
461 |
+
|
462 |
+
# Maximum number of arguments for function / method.
|
463 |
+
max-args=5
|
464 |
+
|
465 |
+
# Maximum number of attributes for a class (see R0902).
|
466 |
+
max-attributes=7
|
467 |
+
|
468 |
+
# Maximum number of boolean expressions in an if statement.
|
469 |
+
max-bool-expr=5
|
470 |
+
|
471 |
+
# Maximum number of branch for function / method body.
|
472 |
+
max-branches=12
|
473 |
+
|
474 |
+
# Maximum number of locals for function / method body.
|
475 |
+
max-locals=15
|
476 |
+
|
477 |
+
# Maximum number of parents for a class (see R0901).
|
478 |
+
max-parents=7
|
479 |
+
|
480 |
+
# Maximum number of public methods for a class (see R0904).
|
481 |
+
max-public-methods=20
|
482 |
+
|
483 |
+
# Maximum number of return / yield for function / method body.
|
484 |
+
max-returns=6
|
485 |
+
|
486 |
+
# Maximum number of statements in function / method body.
|
487 |
+
max-statements=50
|
488 |
+
|
489 |
+
# Minimum number of public methods for a class (see R0903).
|
490 |
+
min-public-methods=2
|
491 |
+
|
492 |
+
|
493 |
+
[EXCEPTIONS]
|
494 |
+
|
495 |
+
# Exceptions that will emit a warning when being caught. Defaults to
|
496 |
+
# "BaseException, Exception".
|
497 |
+
overgeneral-exceptions=BaseException,
|
498 |
+
Exception
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md
ADDED
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Setting up LUIS via CLI:
|
2 |
+
|
3 |
+
This README contains information on how to create and deploy a LUIS application. When the bot is ready to be deployed to production, we recommend creating a LUIS Endpoint Resource for usage with your LUIS App.
|
4 |
+
|
5 |
+
> _For instructions on how to create a LUIS Application via the LUIS portal, see these Quickstart steps:_
|
6 |
+
> 1. _[Quickstart: Create a new app in the LUIS portal][Quickstart-create]_
|
7 |
+
> 2. _[Quickstart: Deploy an app in the LUIS portal][Quickstart-deploy]_
|
8 |
+
|
9 |
+
[Quickstart-create]: https://docs.microsoft.com/azure/cognitive-services/luis/get-started-portal-build-app
|
10 |
+
[Quickstart-deploy]:https://docs.microsoft.com/azure/cognitive-services/luis/get-started-portal-deploy-app
|
11 |
+
|
12 |
+
## Table of Contents:
|
13 |
+
|
14 |
+
- [Prerequisites](#Prerequisites)
|
15 |
+
- [Import a new LUIS Application using a local LUIS application](#Import-a-new-LUIS-Application-using-a-local-LUIS-application)
|
16 |
+
- [How to create a LUIS Endpoint resource in Azure and pair it with a LUIS Application](#How-to-create-a-LUIS-Endpoint-resource-in-Azure-and-pair-it-with-a-LUIS-Application)
|
17 |
+
|
18 |
+
___
|
19 |
+
|
20 |
+
## [Prerequisites](#Table-of-Contents):
|
21 |
+
|
22 |
+
#### Install Azure CLI >=2.0.61:
|
23 |
+
|
24 |
+
Visit the following page to find the correct installer for your OS:
|
25 |
+
- https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
|
26 |
+
|
27 |
+
#### Install LUIS CLI >=2.4.0:
|
28 |
+
|
29 |
+
Open a CLI of your choice and type the following:
|
30 |
+
|
31 |
+
```bash
|
32 |
+
npm i -g luis-apis@^2.4.0
|
33 |
+
```
|
34 |
+
|
35 |
+
#### LUIS portal account:
|
36 |
+
|
37 |
+
You should already have a LUIS account with either https://luis.ai, https://eu.luis.ai, or https://au.luis.ai. To determine where to create a LUIS account, consider where you will deploy your LUIS applications, and then place them in [the corresponding region][LUIS-Authoring-Regions].
|
38 |
+
|
39 |
+
After you've created your account, you need your [Authoring Key][LUIS-AKey] and a LUIS application ID.
|
40 |
+
|
41 |
+
[LUIS-Authoring-Regions]: https://docs.microsoft.com/azure/cognitive-services/luis/luis-reference-regions#luis-authoring-regions]
|
42 |
+
[LUIS-AKey]: https://docs.microsoft.com/azure/cognitive-services/luis/luis-concept-keys#authoring-key
|
43 |
+
|
44 |
+
___
|
45 |
+
|
46 |
+
## [Import a new LUIS Application using a local LUIS application](#Table-of-Contents)
|
47 |
+
|
48 |
+
### 1. Import the local LUIS application to luis.ai
|
49 |
+
|
50 |
+
```bash
|
51 |
+
luis import application --region "LuisAppAuthoringRegion" --authoringKey "LuisAuthoringKey" --appName "FlightBooking" --in "./cognitiveModels/FlightBooking.json"
|
52 |
+
```
|
53 |
+
|
54 |
+
Outputs the following JSON:
|
55 |
+
|
56 |
+
```json
|
57 |
+
{
|
58 |
+
"id": "########-####-####-####-############",
|
59 |
+
"name": "FlightBooking",
|
60 |
+
"description": "A LUIS model that uses intent and entities.",
|
61 |
+
"culture": "en-us",
|
62 |
+
"usageScenario": "",
|
63 |
+
"domain": "",
|
64 |
+
"versionsCount": 1,
|
65 |
+
"createdDateTime": "2019-03-29T18:32:02Z",
|
66 |
+
"endpoints": {},
|
67 |
+
"endpointHitsCount": 0,
|
68 |
+
"activeVersion": "0.1",
|
69 |
+
"ownerEmail": "[email protected]",
|
70 |
+
"tokenizerVersion": "1.0.0"
|
71 |
+
}
|
72 |
+
```
|
73 |
+
|
74 |
+
For the next step, you'll need the `"id"` value for `--appId` and the `"activeVersion"` value for `--versionId`.
|
75 |
+
|
76 |
+
### 2. Train the LUIS Application
|
77 |
+
|
78 |
+
```bash
|
79 |
+
luis train version --region "LuisAppAuthoringRegion" --authoringKey "LuisAuthoringKey" --appId "LuisAppId" --versionId "LuisAppversion" --wait
|
80 |
+
```
|
81 |
+
|
82 |
+
### 3. Publish the LUIS Application
|
83 |
+
|
84 |
+
```bash
|
85 |
+
luis publish version --region "LuisAppAuthoringRegion" --authoringKey "LuisAuthoringKey" --appId "LuisAppId" --versionId "LuisAppversion" --publishRegion "LuisAppPublishRegion"
|
86 |
+
```
|
87 |
+
|
88 |
+
> `--region` corresponds to the region you _author_ your application in. The regions available for this are "westus", "westeurope" and "australiaeast". <br/>
|
89 |
+
> These regions correspond to the three available portals, https://luis.ai, https://eu.luis.ai, or https://au.luis.ai. <br/>
|
90 |
+
> `--publishRegion` corresponds to the region of the endpoint you're publishing to, (e.g. "westus", "southeastasia", "westeurope", "brazilsouth"). <br/>
|
91 |
+
> See the [reference docs][Endpoint-API] for a list of available publish/endpoint regions.
|
92 |
+
|
93 |
+
[Endpoint-API]: https://westus.dev.cognitive.microsoft.com/docs/services/5819c76f40a6350ce09de1ac/operations/5819c77140a63516d81aee78
|
94 |
+
|
95 |
+
Outputs the following:
|
96 |
+
|
97 |
+
```json
|
98 |
+
{
|
99 |
+
"versionId": "0.1",
|
100 |
+
"isStaging": false,
|
101 |
+
"endpointUrl": "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/########-####-####-####-############",
|
102 |
+
"region": "westus",
|
103 |
+
"assignedEndpointKey": null,
|
104 |
+
"endpointRegion": "westus",
|
105 |
+
"failedRegions": "",
|
106 |
+
"publishedDateTime": "2019-03-29T18:40:32Z",
|
107 |
+
"directVersionPublish": false
|
108 |
+
}
|
109 |
+
```
|
110 |
+
|
111 |
+
To see how to create an LUIS Cognitive Service Resource in Azure, please see [the next README][README-LUIS]. This Resource should be used when you want to move your bot to production. The instructions will show you how to create and pair the resource with a LUIS Application.
|
112 |
+
|
113 |
+
[README-LUIS]: ./README-LUIS.md
|
114 |
+
|
115 |
+
___
|
116 |
+
|
117 |
+
## [How to create a LUIS Endpoint resource in Azure and pair it with a LUIS Application](#Table-of-Contents)
|
118 |
+
|
119 |
+
### 1. Create a new LUIS Cognitive Services resource on Azure via Azure CLI
|
120 |
+
|
121 |
+
> _Note:_ <br/>
|
122 |
+
> _If you don't have a Resource Group in your Azure subscription, you can create one through the Azure portal or through using:_
|
123 |
+
> ```bash
|
124 |
+
> az group create --subscription "AzureSubscriptionGuid" --location "westus" --name "ResourceGroupName"
|
125 |
+
> ```
|
126 |
+
> _To see a list of valid locations, use `az account list-locations`_
|
127 |
+
|
128 |
+
|
129 |
+
```bash
|
130 |
+
# Use Azure CLI to create the LUIS Key resource on Azure
|
131 |
+
az cognitiveservices account create --kind "luis" --name "NewLuisResourceName" --sku "S0" --location "westus" --subscription "AzureSubscriptionGuid" -g "ResourceGroupName"
|
132 |
+
```
|
133 |
+
|
134 |
+
The command will output a response similar to the JSON below:
|
135 |
+
|
136 |
+
```json
|
137 |
+
{
|
138 |
+
"endpoint": "https://westus.api.cognitive.microsoft.com/luis/v2.0",
|
139 |
+
"etag": "\"########-####-####-####-############\"",
|
140 |
+
"id": "/subscriptions/########-####-####-####-############/resourceGroups/ResourceGroupName/providers/Microsoft.CognitiveServices/accounts/NewLuisResourceName",
|
141 |
+
"internalId": "################################",
|
142 |
+
"kind": "luis",
|
143 |
+
"location": "westus",
|
144 |
+
"name": "NewLuisResourceName",
|
145 |
+
"provisioningState": "Succeeded",
|
146 |
+
"resourceGroup": "ResourceGroupName",
|
147 |
+
"sku": {
|
148 |
+
"name": "S0",
|
149 |
+
"tier": null
|
150 |
+
},
|
151 |
+
"tags": null,
|
152 |
+
"type": "Microsoft.CognitiveServices/accounts"
|
153 |
+
}
|
154 |
+
```
|
155 |
+
|
156 |
+
|
157 |
+
|
158 |
+
Take the output from the previous command and create a JSON file in the following format:
|
159 |
+
|
160 |
+
```json
|
161 |
+
{
|
162 |
+
"azureSubscriptionId": "00000000-0000-0000-0000-000000000000",
|
163 |
+
"resourceGroup": "ResourceGroupName",
|
164 |
+
"accountName": "NewLuisResourceName"
|
165 |
+
}
|
166 |
+
```
|
167 |
+
|
168 |
+
### 2. Retrieve ARM access token via Azure CLI
|
169 |
+
|
170 |
+
```bash
|
171 |
+
az account get-access-token --subscription "AzureSubscriptionGuid"
|
172 |
+
```
|
173 |
+
|
174 |
+
This will return an object that looks like this:
|
175 |
+
|
176 |
+
```json
|
177 |
+
{
|
178 |
+
"accessToken": "eyJ0eXAiOiJKVtokentokentokentokentokeng1dCI6Ik4tbEMwbi05REFMcXdodUhZbkhRNjNHZUNYYyIsItokenI6Ik4tbEMwbi05REFMcXdodUhZbkhRNjNHZUNYYyJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC83MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDcvIiwiaWF0IjoxNTUzODc3MTUwLCJuYmYiOjE1NTM4NzcxNTAsImV4cCI6MTU1Mzg4MTA1MCwiX2NsYWltX25hbWVzIjp7Imdyb3VwcyI6InNyYzEifSwiX2NsYWltX3NvdXJjZXMiOnsic3JjMSI6eyJlbmRwb2ludCI6Imh0dHBzOi8vZ3JhcGgud2luZG93cy5uZXQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3L3VzZXJzL2ZmZTQyM2RkLWJhM2YtNDg0Ny04NjgyLWExNTI5MDA4MjM4Ny9nZXRNZW1iZXJPYmplY3RzIn19LCJhY3IiOiIxIiwiYWlvIjoiQVZRQXEvOEtBQUFBeGVUc201NDlhVHg4RE1mMFlRVnhGZmxxOE9RSC9PODR3QktuSmRqV1FqTkkwbmxLYzB0bHJEZzMyMFZ5bWZGaVVBSFBvNUFFUTNHL0FZNDRjdk01T3M0SEt0OVJkcE5JZW9WU0dzd0kvSkk9IiwiYW1yIjpbIndpYSIsIm1mYSJdLCJhcHBpZCI6IjA0YjA3Nzk1LThkZGItNDYxYS1iYmVlLTAyZjllMWJmN2I0NiIsImFwcGlkYWNyIjoiMCIsImRldmljZWlkIjoiNDhmNDVjNjEtMTg3Zi00MjUxLTlmZWItMTllZGFkZmMwMmE3IiwiZmFtaWx5X25hbWUiOiJHdW0iLCJnaXZlbl9uYW1lIjoiU3RldmVuIiwiaXBhZGRyIjoiMTY3LjIyMC4yLjU1IiwibmFtZSI6IlN0ZXZlbiBHdW0iLCJvaWQiOiJmZmU0MjNkZC1iYTNmLTQ4NDctODY4Mi1hMTUyOTAwODIzODciLCJvbnByZW1fc2lkIjoiUy0xLTUtMjEtMjEyNzUyMTE4NC0xNjA0MDEyOTIwLTE4ODc5Mjc1MjctMjYwOTgyODUiLCJwdWlkIjoiMTAwMzdGRkVBMDQ4NjlBNyIsInJoIjoiSSIsInNjcCI6InVzZXJfaW1wZXJzb25hdGlvbiIsInN1YiI6Ik1rMGRNMWszN0U5ckJyMjhieUhZYjZLSU85LXVFQVVkZFVhNWpkSUd1Nk0iLCJ0aWQiOiI3MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDciLCJ1bmlxdWVfbmFtZSI6InN0Z3VtQG1pY3Jvc29mdC5jb20iLCJ1cG4iOiJzdGd1bUBtaWNyb3NvZnQuY29tIiwidXRpIjoiT2w2NGN0TXY4RVNEQzZZQWRqRUFtokenInZlciI6IjEuMCJ9.kFAsEilE0mlS1pcpqxf4rEnRKeYsehyk-gz-zJHUrE__oad3QjgDSBDPrR_ikLdweynxbj86pgG4QFaHURNCeE6SzrbaIrNKw-n9jrEtokenlosOxg_0l2g1LeEUOi5Q4gQREAU_zvSbl-RY6sAadpOgNHtGvz3Rc6FZRITfkckSLmsKAOFoh-aWC6tFKG8P52rtB0qVVRz9tovBeNqkMYL49s9ypduygbXNVwSQhm5JszeWDgrFuVFHBUP_iENCQYGQpEZf_KvjmX1Ur1F9Eh9nb4yI2gFlKncKNsQl-tokenK7-tokentokentokentokentokentokenatoken",
|
179 |
+
"expiresOn": "2200-12-31 23:59:59.999999",
|
180 |
+
"subscription": "AzureSubscriptionGuid",
|
181 |
+
"tenant": "tenant-guid",
|
182 |
+
"tokenType": "Bearer"
|
183 |
+
}
|
184 |
+
```
|
185 |
+
|
186 |
+
The value needed for the next step is the `"accessToken"`.
|
187 |
+
|
188 |
+
### 3. Use `luis add appazureaccount` to pair your LUIS resource with a LUIS Application
|
189 |
+
|
190 |
+
```bash
|
191 |
+
luis add appazureaccount --in "path/to/created/requestBody.json" --appId "LuisAppId" --authoringKey "LuisAuthoringKey" --armToken "accessToken"
|
192 |
+
```
|
193 |
+
|
194 |
+
If successful, it should yield a response like this:
|
195 |
+
|
196 |
+
```json
|
197 |
+
{
|
198 |
+
"code": "Success",
|
199 |
+
"message": "Operation Successful"
|
200 |
+
}
|
201 |
+
```
|
202 |
+
|
203 |
+
### 4. See the LUIS Cognitive Services' keys
|
204 |
+
|
205 |
+
```bash
|
206 |
+
az cognitiveservices account keys list --name "NewLuisResourceName" --subscription "AzureSubscriptionGuid" -g "ResourceGroupName"
|
207 |
+
```
|
208 |
+
|
209 |
+
This will return an object that looks like this:
|
210 |
+
|
211 |
+
```json
|
212 |
+
{
|
213 |
+
"key1": "9a69####dc8f####8eb4####399f####",
|
214 |
+
"key2": "####f99e####4b1a####fb3b####6b9f"
|
215 |
+
}
|
216 |
+
```
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# CoreBot
|
2 |
+
|
3 |
+
Bot Framework v4 core bot sample.
|
4 |
+
|
5 |
+
This bot has been created using [Bot Framework](https://dev.botframework.com), it shows how to:
|
6 |
+
|
7 |
+
- Use [LUIS](https://www.luis.ai) to implement core AI capabilities
|
8 |
+
- Implement a multi-turn conversation using Dialogs
|
9 |
+
- Handle user interruptions for such things as `Help` or `Cancel`
|
10 |
+
- Prompt for and validate requests for information from the user
|
11 |
+
|
12 |
+
## Prerequisites
|
13 |
+
|
14 |
+
This sample **requires** prerequisites in order to run.
|
15 |
+
|
16 |
+
### Overview
|
17 |
+
|
18 |
+
This bot uses [LUIS](https://www.luis.ai), an AI based cognitive service, to implement language understanding.
|
19 |
+
|
20 |
+
### Install Python 3.6
|
21 |
+
|
22 |
+
|
23 |
+
### Create a LUIS Application to enable language understanding
|
24 |
+
|
25 |
+
LUIS language model setup, training, and application configuration steps can be found [here](https://docs.microsoft.com/azure/bot-service/bot-builder-howto-v4-luis?view=azure-bot-service-4.0&tabs=cs).
|
26 |
+
|
27 |
+
If you wish to create a LUIS application via the CLI, these steps can be found in the [README-LUIS.md](README-LUIS.md).
|
28 |
+
|
29 |
+
## Running the sample
|
30 |
+
- Run `pip install -r requirements.txt` to install all dependencies
|
31 |
+
- Update LuisAppId, LuisAPIKey and LuisAPIHostName in `config.py` with the information retrieved from the [LUIS portal](https://www.luis.ai)
|
32 |
+
- Run `python app.py`
|
33 |
+
|
34 |
+
|
35 |
+
## Testing the bot using Bot Framework Emulator
|
36 |
+
|
37 |
+
[Bot Framework Emulator](https://github.com/microsoft/botframework-emulator) is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
|
38 |
+
|
39 |
+
- Install the Bot Framework Emulator version 4.3.0 or greater from [here](https://github.com/Microsoft/BotFramework-Emulator/releases)
|
40 |
+
|
41 |
+
### Connect to the bot using Bot Framework Emulator
|
42 |
+
|
43 |
+
- Launch Bot Framework Emulator
|
44 |
+
- Enter a Bot URL of `http://localhost:3978/api/messages`
|
45 |
+
|
46 |
+
|
47 |
+
## Further reading
|
48 |
+
|
49 |
+
- [Bot Framework Documentation](https://docs.botframework.com)
|
50 |
+
- [Bot Basics](https://docs.microsoft.com/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0)
|
51 |
+
- [Dialogs](https://docs.microsoft.com/azure/bot-service/bot-builder-concept-dialog?view=azure-bot-service-4.0)
|
52 |
+
- [Gathering Input Using Prompts](https://docs.microsoft.com/azure/bot-service/bot-builder-prompts?view=azure-bot-service-4.0&tabs=csharp)
|
53 |
+
- [Activity processing](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-concept-activity-processing?view=azure-bot-service-4.0)
|
54 |
+
- [Azure Bot Service Introduction](https://docs.microsoft.com/azure/bot-service/bot-service-overview-introduction?view=azure-bot-service-4.0)
|
55 |
+
- [Azure Bot Service Documentation](https://docs.microsoft.com/azure/bot-service/?view=azure-bot-service-4.0)
|
56 |
+
- [.NET Core CLI tools](https://docs.microsoft.com/dotnet/core/tools/?tabs=netcore2x)
|
57 |
+
- [Azure CLI](https://docs.microsoft.com/cli/azure/?view=azure-cli-latest)
|
58 |
+
- [Azure Portal](https://portal.azure.com)
|
59 |
+
- [Language Understanding using LUIS](https://docs.microsoft.com/azure/cognitive-services/luis/)
|
60 |
+
- [Channels and Bot Connector Service](https://docs.microsoft.com/azure/bot-service/bot-concepts?view=azure-bot-service-4.0)
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/__init__.py
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
2 |
+
# Licensed under the MIT License.
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/adapter_with_error_handler.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
2 |
+
# Licensed under the MIT License.
|
3 |
+
import sys
|
4 |
+
import traceback
|
5 |
+
from datetime import datetime
|
6 |
+
|
7 |
+
from botbuilder.core import (
|
8 |
+
ConversationState,
|
9 |
+
TurnContext,
|
10 |
+
)
|
11 |
+
from botbuilder.integration.aiohttp import CloudAdapter, ConfigurationBotFrameworkAuthentication
|
12 |
+
from botbuilder.schema import ActivityTypes, Activity
|
13 |
+
|
14 |
+
|
15 |
+
class AdapterWithErrorHandler(CloudAdapter):
|
16 |
+
def __init__(
|
17 |
+
self,
|
18 |
+
settings: ConfigurationBotFrameworkAuthentication,
|
19 |
+
conversation_state: ConversationState,
|
20 |
+
):
|
21 |
+
super().__init__(settings)
|
22 |
+
self._conversation_state = conversation_state
|
23 |
+
|
24 |
+
# Catch-all for errors.
|
25 |
+
async def on_error(context: TurnContext, error: Exception):
|
26 |
+
# This check writes out errors to console log
|
27 |
+
# NOTE: In production environment, you should consider logging this to Azure
|
28 |
+
# application insights.
|
29 |
+
print(f"\n [on_turn_error] unhandled error: {error}", file=sys.stderr)
|
30 |
+
traceback.print_exc()
|
31 |
+
|
32 |
+
# Send a message to the user
|
33 |
+
await context.send_activity("The bot encountered an error or bug.")
|
34 |
+
await context.send_activity(
|
35 |
+
"To continue to run this bot, please fix the bot source code."
|
36 |
+
)
|
37 |
+
# Send a trace activity if we're talking to the Bot Framework Emulator
|
38 |
+
if context.activity.channel_id == "emulator":
|
39 |
+
# Create a trace activity that contains the error object
|
40 |
+
trace_activity = Activity(
|
41 |
+
label="TurnError",
|
42 |
+
name="on_turn_error Trace",
|
43 |
+
timestamp=datetime.utcnow(),
|
44 |
+
type=ActivityTypes.trace,
|
45 |
+
value=f"{error}",
|
46 |
+
value_type="https://www.botframework.com/schemas/error",
|
47 |
+
)
|
48 |
+
# Send a trace activity, which will be displayed in Bot Framework Emulator
|
49 |
+
await context.send_activity(trace_activity)
|
50 |
+
|
51 |
+
# Clear out state
|
52 |
+
nonlocal self
|
53 |
+
await self._conversation_state.delete(context)
|
54 |
+
|
55 |
+
self.on_turn_error = on_error
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/app.py
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
2 |
+
# Licensed under the MIT License.
|
3 |
+
|
4 |
+
"""
|
5 |
+
This sample shows how to create a bot that demonstrates the following:
|
6 |
+
- Use [LUIS](https://www.luis.ai) to implement core AI capabilities.
|
7 |
+
- Implement a multi-turn conversation using Dialogs.
|
8 |
+
- Handle user interruptions for such things as `Help` or `Cancel`.
|
9 |
+
- Prompt for and validate requests for information from the user.
|
10 |
+
"""
|
11 |
+
from http import HTTPStatus
|
12 |
+
from aiohttp import web
|
13 |
+
from aiohttp.web import Request, Response, json_response
|
14 |
+
from botbuilder.core import (
|
15 |
+
ConversationState,
|
16 |
+
MemoryStorage,
|
17 |
+
UserState,
|
18 |
+
)
|
19 |
+
from botbuilder.core.integration import aiohttp_error_middleware
|
20 |
+
from botbuilder.integration.aiohttp import ConfigurationBotFrameworkAuthentication
|
21 |
+
from botbuilder.schema import Activity
|
22 |
+
|
23 |
+
from config import DefaultConfig
|
24 |
+
from dialogs import MainDialog, BookingDialog
|
25 |
+
from bots import DialogAndWelcomeBot
|
26 |
+
|
27 |
+
from adapter_with_error_handler import AdapterWithErrorHandler
|
28 |
+
from flight_booking_recognizer import FlightBookingRecognizer
|
29 |
+
|
30 |
+
CONFIG = DefaultConfig()
|
31 |
+
|
32 |
+
# Create adapter.
|
33 |
+
# See https://aka.ms/about-bot-adapter to learn more about how bots work.
|
34 |
+
SETTINGS = ConfigurationBotFrameworkAuthentication(CONFIG)
|
35 |
+
|
36 |
+
# Create MemoryStorage, UserState and ConversationState
|
37 |
+
MEMORY = MemoryStorage()
|
38 |
+
USER_STATE = UserState(MEMORY)
|
39 |
+
CONVERSATION_STATE = ConversationState(MEMORY)
|
40 |
+
|
41 |
+
# Create adapter.
|
42 |
+
# See https://aka.ms/about-bot-adapter to learn more about how bots work.
|
43 |
+
ADAPTER = AdapterWithErrorHandler(SETTINGS, CONVERSATION_STATE)
|
44 |
+
|
45 |
+
# Create dialogs and Bot
|
46 |
+
RECOGNIZER = FlightBookingRecognizer(CONFIG)
|
47 |
+
BOOKING_DIALOG = BookingDialog()
|
48 |
+
DIALOG = MainDialog(RECOGNIZER, BOOKING_DIALOG)
|
49 |
+
BOT = DialogAndWelcomeBot(CONVERSATION_STATE, USER_STATE, DIALOG)
|
50 |
+
|
51 |
+
|
52 |
+
# Listen for incoming requests on /api/messages
|
53 |
+
async def messages(req: Request) -> Response:
|
54 |
+
# Main bot message handler.
|
55 |
+
if "application/json" in req.headers["Content-Type"]:
|
56 |
+
body = await req.json()
|
57 |
+
else:
|
58 |
+
return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE)
|
59 |
+
|
60 |
+
activity = Activity().deserialize(body)
|
61 |
+
auth_header = req.headers["Authorization"] if "Authorization" in req.headers else ""
|
62 |
+
|
63 |
+
response = await ADAPTER.process_activity(auth_header, activity, BOT.on_turn)
|
64 |
+
if response:
|
65 |
+
return json_response(data=response.body, status=response.status)
|
66 |
+
return Response(status=HTTPStatus.OK)
|
67 |
+
|
68 |
+
|
69 |
+
APP = web.Application(middlewares=[aiohttp_error_middleware])
|
70 |
+
APP.router.add_post("/api/messages", messages)
|
71 |
+
|
72 |
+
if __name__ == "__main__":
|
73 |
+
try:
|
74 |
+
web.run_app(APP, host="localhost", port=CONFIG.PORT)
|
75 |
+
except Exception as error:
|
76 |
+
raise error
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/booking_details.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
2 |
+
# Licensed under the MIT License.
|
3 |
+
|
4 |
+
from typing import List
|
5 |
+
|
6 |
+
|
7 |
+
class BookingDetails:
|
8 |
+
def __init__(
|
9 |
+
self,
|
10 |
+
destination: str = None,
|
11 |
+
origin: str = None,
|
12 |
+
travel_date: str = None,
|
13 |
+
unsupported_airports: List[str] = None,
|
14 |
+
):
|
15 |
+
self.destination = destination
|
16 |
+
self.origin = origin
|
17 |
+
self.travel_date = travel_date
|
18 |
+
self.unsupported_airports = unsupported_airports or []
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/bots/__init__.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
2 |
+
# Licensed under the MIT License.
|
3 |
+
|
4 |
+
from .dialog_bot import DialogBot
|
5 |
+
from .dialog_and_welcome_bot import DialogAndWelcomeBot
|
6 |
+
|
7 |
+
__all__ = ["DialogBot", "DialogAndWelcomeBot"]
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/bots/dialog_and_welcome_bot.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
2 |
+
# Licensed under the MIT License.
|
3 |
+
|
4 |
+
import json
|
5 |
+
import os.path
|
6 |
+
|
7 |
+
from typing import List
|
8 |
+
from botbuilder.core import MessageFactory, TurnContext
|
9 |
+
from botbuilder.schema import Attachment, ChannelAccount
|
10 |
+
|
11 |
+
from helpers import DialogHelper
|
12 |
+
from .dialog_bot import DialogBot
|
13 |
+
|
14 |
+
|
15 |
+
class DialogAndWelcomeBot(DialogBot):
|
16 |
+
|
17 |
+
async def on_members_added_activity(
|
18 |
+
self, members_added: List[ChannelAccount], turn_context: TurnContext
|
19 |
+
):
|
20 |
+
for member in members_added:
|
21 |
+
# Greet anyone that was not the target (recipient) of this message.
|
22 |
+
# To learn more about Adaptive Cards, see https://aka.ms/msbot-adaptivecards for more details.
|
23 |
+
if member.id != turn_context.activity.recipient.id:
|
24 |
+
welcome_card = self.create_adaptive_card_attachment()
|
25 |
+
response = MessageFactory.attachment(welcome_card)
|
26 |
+
await turn_context.send_activity(response)
|
27 |
+
await DialogHelper.run_dialog(
|
28 |
+
self.dialog,
|
29 |
+
turn_context,
|
30 |
+
self.conversation_state.create_property("DialogState"),
|
31 |
+
)
|
32 |
+
|
33 |
+
# Load attachment from file.
|
34 |
+
def create_adaptive_card_attachment(self):
|
35 |
+
relative_path = os.path.abspath(os.path.dirname(__file__))
|
36 |
+
path = os.path.join(relative_path, "../cards/welcomeCard.json")
|
37 |
+
with open(path) as card_file:
|
38 |
+
card = json.load(card_file)
|
39 |
+
|
40 |
+
return Attachment(
|
41 |
+
content_type="application/vnd.microsoft.card.adaptive", content=card
|
42 |
+
)
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/bots/dialog_bot.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
2 |
+
# Licensed under the MIT License.
|
3 |
+
|
4 |
+
from botbuilder.core import ActivityHandler, ConversationState, UserState, TurnContext
|
5 |
+
from botbuilder.dialogs import Dialog
|
6 |
+
|
7 |
+
from helpers import DialogHelper
|
8 |
+
|
9 |
+
|
10 |
+
class DialogBot(ActivityHandler):
|
11 |
+
def __init__(
|
12 |
+
self,
|
13 |
+
conversation_state: ConversationState,
|
14 |
+
user_state: UserState,
|
15 |
+
dialog: Dialog,
|
16 |
+
):
|
17 |
+
if conversation_state is None:
|
18 |
+
raise Exception(
|
19 |
+
"[DialogBot]: Missing parameter. conversation_state is required"
|
20 |
+
)
|
21 |
+
if user_state is None:
|
22 |
+
raise Exception("[DialogBot]: Missing parameter. user_state is required")
|
23 |
+
if dialog is None:
|
24 |
+
raise Exception("[DialogBot]: Missing parameter. dialog is required")
|
25 |
+
|
26 |
+
self.conversation_state = conversation_state
|
27 |
+
self.user_state = user_state
|
28 |
+
self.dialog = dialog
|
29 |
+
|
30 |
+
async def on_turn(self, turn_context: TurnContext):
|
31 |
+
await super().on_turn(turn_context)
|
32 |
+
|
33 |
+
# Save any state changes that might have occurred during the turn.
|
34 |
+
await self.conversation_state.save_changes(turn_context, False)
|
35 |
+
await self.user_state.save_changes(turn_context, False)
|
36 |
+
|
37 |
+
async def on_message_activity(self, turn_context: TurnContext):
|
38 |
+
await DialogHelper.run_dialog(
|
39 |
+
self.dialog,
|
40 |
+
turn_context,
|
41 |
+
self.conversation_state.create_property("DialogState"),
|
42 |
+
)
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/cards/welcomeCard.json
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
|
3 |
+
"type": "AdaptiveCard",
|
4 |
+
"version": "1.0",
|
5 |
+
"body": [
|
6 |
+
{
|
7 |
+
"type": "Image",
|
8 |
+
"url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQtB3AwMUeNoq4gUBGe6Ocj8kyh3bXa9ZbV7u1fVKQoyKFHdkqU",
|
9 |
+
"size": "stretch"
|
10 |
+
},
|
11 |
+
{
|
12 |
+
"type": "TextBlock",
|
13 |
+
"spacing": "medium",
|
14 |
+
"size": "default",
|
15 |
+
"weight": "bolder",
|
16 |
+
"text": "Welcome to Bot Framework!",
|
17 |
+
"wrap": true,
|
18 |
+
"maxLines": 0
|
19 |
+
},
|
20 |
+
{
|
21 |
+
"type": "TextBlock",
|
22 |
+
"size": "default",
|
23 |
+
"isSubtle": "true",
|
24 |
+
"text": "Now that you have successfully run your bot, follow the links in this Adaptive Card to expand your knowledge of Bot Framework.",
|
25 |
+
"wrap": true,
|
26 |
+
"maxLines": 0
|
27 |
+
}
|
28 |
+
],
|
29 |
+
"actions": [
|
30 |
+
{
|
31 |
+
"type": "Action.OpenUrl",
|
32 |
+
"title": "Get an overview",
|
33 |
+
"url": "https://docs.microsoft.com/azure/bot-service/?view=azure-bot-service-4.0"
|
34 |
+
},
|
35 |
+
{
|
36 |
+
"type": "Action.OpenUrl",
|
37 |
+
"title": "Ask a question",
|
38 |
+
"url": "https://stackoverflow.com/questions/tagged/botframework"
|
39 |
+
},
|
40 |
+
{
|
41 |
+
"type": "Action.OpenUrl",
|
42 |
+
"title": "Learn how to deploy",
|
43 |
+
"url": "https://docs.microsoft.com/azure/bot-service/bot-builder-howto-deploy-azure?view=azure-bot-service-4.0"
|
44 |
+
}
|
45 |
+
]
|
46 |
+
}
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/cognitiveModels/FlightBooking.json
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"luis_schema_version": "3.2.0",
|
3 |
+
"versionId": "0.1",
|
4 |
+
"name": "FlightBooking",
|
5 |
+
"desc": "Luis Model for CoreBot",
|
6 |
+
"culture": "en-us",
|
7 |
+
"tokenizerVersion": "1.0.0",
|
8 |
+
"intents": [
|
9 |
+
{
|
10 |
+
"name": "BookFlight"
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"name": "Cancel"
|
14 |
+
},
|
15 |
+
{
|
16 |
+
"name": "GetWeather"
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"name": "None"
|
20 |
+
}
|
21 |
+
],
|
22 |
+
"entities": [],
|
23 |
+
"composites": [
|
24 |
+
{
|
25 |
+
"name": "From",
|
26 |
+
"children": [
|
27 |
+
"Airport"
|
28 |
+
],
|
29 |
+
"roles": []
|
30 |
+
},
|
31 |
+
{
|
32 |
+
"name": "To",
|
33 |
+
"children": [
|
34 |
+
"Airport"
|
35 |
+
],
|
36 |
+
"roles": []
|
37 |
+
}
|
38 |
+
],
|
39 |
+
"closedLists": [
|
40 |
+
{
|
41 |
+
"name": "Airport",
|
42 |
+
"subLists": [
|
43 |
+
{
|
44 |
+
"canonicalForm": "Paris",
|
45 |
+
"list": [
|
46 |
+
"paris",
|
47 |
+
"cdg"
|
48 |
+
]
|
49 |
+
},
|
50 |
+
{
|
51 |
+
"canonicalForm": "London",
|
52 |
+
"list": [
|
53 |
+
"london",
|
54 |
+
"lhr"
|
55 |
+
]
|
56 |
+
},
|
57 |
+
{
|
58 |
+
"canonicalForm": "Berlin",
|
59 |
+
"list": [
|
60 |
+
"berlin",
|
61 |
+
"txl"
|
62 |
+
]
|
63 |
+
},
|
64 |
+
{
|
65 |
+
"canonicalForm": "New York",
|
66 |
+
"list": [
|
67 |
+
"new york",
|
68 |
+
"jfk"
|
69 |
+
]
|
70 |
+
},
|
71 |
+
{
|
72 |
+
"canonicalForm": "Seattle",
|
73 |
+
"list": [
|
74 |
+
"seattle",
|
75 |
+
"sea"
|
76 |
+
]
|
77 |
+
}
|
78 |
+
],
|
79 |
+
"roles": []
|
80 |
+
}
|
81 |
+
],
|
82 |
+
"patternAnyEntities": [],
|
83 |
+
"regex_entities": [],
|
84 |
+
"prebuiltEntities": [
|
85 |
+
{
|
86 |
+
"name": "datetimeV2",
|
87 |
+
"roles": []
|
88 |
+
}
|
89 |
+
],
|
90 |
+
"model_features": [],
|
91 |
+
"regex_features": [],
|
92 |
+
"patterns": [],
|
93 |
+
"utterances": [
|
94 |
+
{
|
95 |
+
"text": "book a flight",
|
96 |
+
"intent": "BookFlight",
|
97 |
+
"entities": []
|
98 |
+
},
|
99 |
+
{
|
100 |
+
"text": "book a flight from new york",
|
101 |
+
"intent": "BookFlight",
|
102 |
+
"entities": [
|
103 |
+
{
|
104 |
+
"entity": "From",
|
105 |
+
"startPos": 19,
|
106 |
+
"endPos": 26
|
107 |
+
}
|
108 |
+
]
|
109 |
+
},
|
110 |
+
{
|
111 |
+
"text": "book a flight from seattle",
|
112 |
+
"intent": "BookFlight",
|
113 |
+
"entities": [
|
114 |
+
{
|
115 |
+
"entity": "From",
|
116 |
+
"startPos": 19,
|
117 |
+
"endPos": 25
|
118 |
+
}
|
119 |
+
]
|
120 |
+
},
|
121 |
+
{
|
122 |
+
"text": "book a hotel in new york",
|
123 |
+
"intent": "None",
|
124 |
+
"entities": []
|
125 |
+
},
|
126 |
+
{
|
127 |
+
"text": "book a restaurant",
|
128 |
+
"intent": "None",
|
129 |
+
"entities": []
|
130 |
+
},
|
131 |
+
{
|
132 |
+
"text": "book flight from london to paris on feb 14th",
|
133 |
+
"intent": "BookFlight",
|
134 |
+
"entities": [
|
135 |
+
{
|
136 |
+
"entity": "From",
|
137 |
+
"startPos": 17,
|
138 |
+
"endPos": 22
|
139 |
+
},
|
140 |
+
{
|
141 |
+
"entity": "To",
|
142 |
+
"startPos": 27,
|
143 |
+
"endPos": 31
|
144 |
+
}
|
145 |
+
]
|
146 |
+
},
|
147 |
+
{
|
148 |
+
"text": "book flight to berlin on feb 14th",
|
149 |
+
"intent": "BookFlight",
|
150 |
+
"entities": [
|
151 |
+
{
|
152 |
+
"entity": "To",
|
153 |
+
"startPos": 15,
|
154 |
+
"endPos": 20
|
155 |
+
}
|
156 |
+
]
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"text": "book me a flight from london to paris",
|
160 |
+
"intent": "BookFlight",
|
161 |
+
"entities": [
|
162 |
+
{
|
163 |
+
"entity": "From",
|
164 |
+
"startPos": 22,
|
165 |
+
"endPos": 27
|
166 |
+
},
|
167 |
+
{
|
168 |
+
"entity": "To",
|
169 |
+
"startPos": 32,
|
170 |
+
"endPos": 36
|
171 |
+
}
|
172 |
+
]
|
173 |
+
},
|
174 |
+
{
|
175 |
+
"text": "bye",
|
176 |
+
"intent": "Cancel",
|
177 |
+
"entities": []
|
178 |
+
},
|
179 |
+
{
|
180 |
+
"text": "cancel booking",
|
181 |
+
"intent": "Cancel",
|
182 |
+
"entities": []
|
183 |
+
},
|
184 |
+
{
|
185 |
+
"text": "exit",
|
186 |
+
"intent": "Cancel",
|
187 |
+
"entities": []
|
188 |
+
},
|
189 |
+
{
|
190 |
+
"text": "find an airport near me",
|
191 |
+
"intent": "None",
|
192 |
+
"entities": []
|
193 |
+
},
|
194 |
+
{
|
195 |
+
"text": "flight to paris",
|
196 |
+
"intent": "BookFlight",
|
197 |
+
"entities": [
|
198 |
+
{
|
199 |
+
"entity": "To",
|
200 |
+
"startPos": 10,
|
201 |
+
"endPos": 14
|
202 |
+
}
|
203 |
+
]
|
204 |
+
},
|
205 |
+
{
|
206 |
+
"text": "flight to paris from london on feb 14th",
|
207 |
+
"intent": "BookFlight",
|
208 |
+
"entities": [
|
209 |
+
{
|
210 |
+
"entity": "To",
|
211 |
+
"startPos": 10,
|
212 |
+
"endPos": 14
|
213 |
+
},
|
214 |
+
{
|
215 |
+
"entity": "From",
|
216 |
+
"startPos": 21,
|
217 |
+
"endPos": 26
|
218 |
+
}
|
219 |
+
]
|
220 |
+
},
|
221 |
+
{
|
222 |
+
"text": "fly from berlin to paris on may 5th",
|
223 |
+
"intent": "BookFlight",
|
224 |
+
"entities": [
|
225 |
+
{
|
226 |
+
"entity": "From",
|
227 |
+
"startPos": 9,
|
228 |
+
"endPos": 14
|
229 |
+
},
|
230 |
+
{
|
231 |
+
"entity": "To",
|
232 |
+
"startPos": 19,
|
233 |
+
"endPos": 23
|
234 |
+
}
|
235 |
+
]
|
236 |
+
},
|
237 |
+
{
|
238 |
+
"text": "go to paris",
|
239 |
+
"intent": "BookFlight",
|
240 |
+
"entities": [
|
241 |
+
{
|
242 |
+
"entity": "To",
|
243 |
+
"startPos": 6,
|
244 |
+
"endPos": 10
|
245 |
+
}
|
246 |
+
]
|
247 |
+
},
|
248 |
+
{
|
249 |
+
"text": "going from paris to berlin",
|
250 |
+
"intent": "BookFlight",
|
251 |
+
"entities": [
|
252 |
+
{
|
253 |
+
"entity": "From",
|
254 |
+
"startPos": 11,
|
255 |
+
"endPos": 15
|
256 |
+
},
|
257 |
+
{
|
258 |
+
"entity": "To",
|
259 |
+
"startPos": 20,
|
260 |
+
"endPos": 25
|
261 |
+
}
|
262 |
+
]
|
263 |
+
},
|
264 |
+
{
|
265 |
+
"text": "i'd like to rent a car",
|
266 |
+
"intent": "None",
|
267 |
+
"entities": []
|
268 |
+
},
|
269 |
+
{
|
270 |
+
"text": "ignore",
|
271 |
+
"intent": "Cancel",
|
272 |
+
"entities": []
|
273 |
+
},
|
274 |
+
{
|
275 |
+
"text": "travel from new york to paris",
|
276 |
+
"intent": "BookFlight",
|
277 |
+
"entities": [
|
278 |
+
{
|
279 |
+
"entity": "From",
|
280 |
+
"startPos": 12,
|
281 |
+
"endPos": 19
|
282 |
+
},
|
283 |
+
{
|
284 |
+
"entity": "To",
|
285 |
+
"startPos": 24,
|
286 |
+
"endPos": 28
|
287 |
+
}
|
288 |
+
]
|
289 |
+
},
|
290 |
+
{
|
291 |
+
"text": "travel to new york",
|
292 |
+
"intent": "BookFlight",
|
293 |
+
"entities": [
|
294 |
+
{
|
295 |
+
"entity": "To",
|
296 |
+
"startPos": 10,
|
297 |
+
"endPos": 17
|
298 |
+
}
|
299 |
+
]
|
300 |
+
},
|
301 |
+
{
|
302 |
+
"text": "travel to paris",
|
303 |
+
"intent": "BookFlight",
|
304 |
+
"entities": [
|
305 |
+
{
|
306 |
+
"entity": "To",
|
307 |
+
"startPos": 10,
|
308 |
+
"endPos": 14
|
309 |
+
}
|
310 |
+
]
|
311 |
+
},
|
312 |
+
{
|
313 |
+
"text": "what's the forecast for this friday?",
|
314 |
+
"intent": "GetWeather",
|
315 |
+
"entities": []
|
316 |
+
},
|
317 |
+
{
|
318 |
+
"text": "what's the weather like for tomorrow",
|
319 |
+
"intent": "GetWeather",
|
320 |
+
"entities": []
|
321 |
+
},
|
322 |
+
{
|
323 |
+
"text": "what's the weather like in new york",
|
324 |
+
"intent": "GetWeather",
|
325 |
+
"entities": []
|
326 |
+
},
|
327 |
+
{
|
328 |
+
"text": "what's the weather like?",
|
329 |
+
"intent": "GetWeather",
|
330 |
+
"entities": []
|
331 |
+
},
|
332 |
+
{
|
333 |
+
"text": "winter is coming",
|
334 |
+
"intent": "None",
|
335 |
+
"entities": []
|
336 |
+
}
|
337 |
+
],
|
338 |
+
"settings": []
|
339 |
+
}
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/config.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3 |
+
# Licensed under the MIT License.
|
4 |
+
|
5 |
+
import os
|
6 |
+
|
7 |
+
class DefaultConfig:
|
8 |
+
""" Bot Configuration """
|
9 |
+
|
10 |
+
PORT = 3978
|
11 |
+
APP_ID = os.environ.get("MicrosoftAppId", "")
|
12 |
+
APP_PASSWORD = os.environ.get("MicrosoftAppPassword", "")
|
13 |
+
APP_TYPE = os.environ.get("MicrosoftAppType", "MultiTenant")
|
14 |
+
APP_TENANTID = os.environ.get("MicrosoftAppTenantId", "")
|
15 |
+
LUIS_APP_ID = os.environ.get("LuisAppId", "")
|
16 |
+
LUIS_API_KEY = os.environ.get("LuisAPIKey", "")
|
17 |
+
# LUIS endpoint host name, ie "westus.api.cognitive.microsoft.com"
|
18 |
+
LUIS_API_HOST_NAME = os.environ.get("LuisAPIHostName", "")
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
|
3 |
+
"contentVersion": "1.0.0.0",
|
4 |
+
"parameters": {
|
5 |
+
"azureBotId": {
|
6 |
+
"value": ""
|
7 |
+
},
|
8 |
+
"azureBotSku": {
|
9 |
+
"value": "S1"
|
10 |
+
},
|
11 |
+
"azureBotRegion": {
|
12 |
+
"value": "global"
|
13 |
+
},
|
14 |
+
"botEndpoint": {
|
15 |
+
"value": ""
|
16 |
+
},
|
17 |
+
"appId": {
|
18 |
+
"value": ""
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
|
3 |
+
"contentVersion": "1.0.0.0",
|
4 |
+
"parameters": {
|
5 |
+
"appServiceName": {
|
6 |
+
"value": ""
|
7 |
+
},
|
8 |
+
"existingAppServicePlanName": {
|
9 |
+
"value": ""
|
10 |
+
},
|
11 |
+
"existingAppServicePlanLocation": {
|
12 |
+
"value": ""
|
13 |
+
},
|
14 |
+
"newAppServicePlanName": {
|
15 |
+
"value": ""
|
16 |
+
},
|
17 |
+
"newAppServicePlanLocation": {
|
18 |
+
"value": ""
|
19 |
+
},
|
20 |
+
"newAppServicePlanSku": {
|
21 |
+
"value": {
|
22 |
+
"name": "S1",
|
23 |
+
"tier": "Standard",
|
24 |
+
"size": "S1",
|
25 |
+
"family": "S",
|
26 |
+
"capacity": 1
|
27 |
+
}
|
28 |
+
},
|
29 |
+
"appId": {
|
30 |
+
"value": ""
|
31 |
+
},
|
32 |
+
"appSecret": {
|
33 |
+
"value": ""
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
botbuilder-python/generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/readme.md
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Need deploy BotAppService before AzureBot
|
2 |
+
---
|
3 |
+
az login
|
4 |
+
az deployment group create --resource-group <group-name> --template-file <template-file> --parameters @<parameters-file>
|
5 |
+
---
|
6 |
+
|
7 |
+
# parameters-for-template-BotApp-with-rg:
|
8 |
+
|
9 |
+
**appServiceName**:(required) The Name of the Bot App Service.
|
10 |
+
|
11 |
+
(choose an existingAppServicePlan or create a new AppServicePlan)
|
12 |
+
**existingAppServicePlanName**: The name of the App Service Plan.
|
13 |
+
**existingAppServicePlanLocation**: The location of the App Service Plan.
|
14 |
+
**newAppServicePlanName**: The name of the App Service Plan.
|
15 |
+
**newAppServicePlanLocation**: The location of the App Service Plan.
|
16 |
+
**newAppServicePlanSku**: The SKU of the App Service Plan. Defaults to Standard values.
|
17 |
+
|
18 |
+
**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings.
|
19 |
+
**appSecret**:(required) Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings.
|
20 |
+
|
21 |
+
# parameters-for-template-AzureBot-with-rg:
|
22 |
+
|
23 |
+
**azureBotId**:(required) The globally unique and immutable bot ID.
|
24 |
+
**azureBotSku**: The pricing tier of the Bot Service Registration. **Allowed values are: F0, S1(default)**.
|
25 |
+
**azureBotRegion**: Specifies the location of the new AzureBot. **Allowed values are: global(default), westeurope**.
|
26 |
+
**botEndpoint**: Use to handle client messages, Such as https://<botappServiceName>.azurewebsites.net/api/messages.
|
27 |
+
|
28 |
+
**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings.
|