Skip to content

Commit

Permalink
Merge pull request #25 from DIME-XAI/dev
Browse files Browse the repository at this point in the history
dime-xai 1.2.0rc
  • Loading branch information
thisisishara authored Oct 11, 2022
2 parents f78978d + 0e91f39 commit 2660eba
Show file tree
Hide file tree
Showing 30 changed files with 38 additions and 123 deletions.
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

16 changes: 0 additions & 16 deletions .idea/dime-xai.iml

This file was deleted.

58 changes: 0 additions & 58 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/) starting with version 0.0.1a1

## [1.2.0] - 2022-10-11
### Improvements
- added the support for toggle between `HTTP` and `HTTPS` for securing `bot URL` when explaining models via `REST API`

## [1.1.3] - 2022-10-10
### Improvements
- redefined file io constants for source code clarity
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DIME XAI 1.1.3 Release ⚡
# DIME XAI 1.2.0 Release ⚡

### DIME (Dual Interpretable Model-agnostic Explanations) is mainly aimed at Explaining DIET Classifiers in RASA 2.8.X. Models.

Expand All @@ -25,5 +25,5 @@
- Benchmark tests are in progress

📒 Docs: https://dime-xai.github.io
📦 PyPi: https://pypi.org/project/dime-xai/1.1.3/
📦 PyPi: https://pypi.org/project/dime-xai/1.2.0/
🪵 Full Changelog: https://github.com/DIME-XAI/dime-xai/blob/main/CHANGELOG.md
2 changes: 1 addition & 1 deletion READMEPyPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
- Benchmark tests are in progress

📒 Docs: https://dime-xai.github.io
📦 PyPi: https://pypi.org/project/dime-xai/1.1.3/
📦 PyPi: https://pypi.org/project/dime-xai/1.2.0/
🪵 Full Changelog: https://github.com/DIME-XAI/dime-xai/blob/main/CHANGELOG.md
Binary file modified dime_xai/server/dime_api/__pycache__/routes.cpython-38.pyc
Binary file not shown.
6 changes: 5 additions & 1 deletion dime_xai/server/dime_api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,11 @@ def configs():
try:
request_data = request.get_json()
updated_configs = request_data['updated_configs']
validate_status, validate_res = server_configs.validate(configs=updated_configs)

# passing secure_url via .env
secure_url = request_data['secure_url']

validate_status, validate_res = server_configs.validate(configs=updated_configs, secure_url=secure_url)
if not validate_status:
return {"status": Validity.INVALID, "metadata": validate_res}, 200

Expand Down
Binary file not shown.
7 changes: 5 additions & 2 deletions dime_xai/server/dime_api/utils/server_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
MODEL_MODE_LOCAL,
MODEL_MODE_REST,
BOT_URL_REGEX,
BOT_URL_REGEX_HTTP,
Validity,
ServerConfigType,
FilePermission,
Expand Down Expand Up @@ -71,7 +72,7 @@ def _initialize(self) -> NoReturn:
raise DIMEConfigException(e)

@staticmethod
def validate(configs: Dict) -> Tuple[bool, Dict]:
def validate(configs: Dict, secure_url: bool = True) -> Tuple[bool, Dict]:
validate_status_obj = {
"keys": Validity.NOTSET,
DIMEConfig.SUB_KEY_BASE_DATA_PATH: Validity.NOTSET,
Expand Down Expand Up @@ -137,13 +138,15 @@ def validate(configs: Dict) -> Tuple[bool, Dict]:
validate_status_obj[DIMEConfig.SUB_KEY_BASE_MODEL_NAME] = Validity.VALID

# url endpoint validation
bot_url_regex_ = BOT_URL_REGEX if secure_url else BOT_URL_REGEX_HTTP
if not re.findall(
BOT_URL_REGEX,
bot_url_regex_,
configs[DIMEConfig.SUB_KEY_BASE_URL_ENDPOINT]
):
logger.error("Failed to validate url endpoint in updated server configs")
validate_status_obj[DIMEConfig.SUB_KEY_BASE_URL_ENDPOINT] = Validity.INVALID
else:

validate_status_obj[DIMEConfig.SUB_KEY_BASE_URL_ENDPOINT] = Validity.VALID

# ranking length validation
Expand Down
1 change: 1 addition & 0 deletions dime_xai/server/dime_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def run(self) -> None:
"APP_ENV": os.environ.get("APP_ENV") or "prod",
"SINHALA_ENABLED": os.environ.get("SINHALA_ENABLED") or True,
"VERSION": PACKAGE_VERSION,
"SECURE_BOT_URL": os.environ.get("SECURE_BOT_URL") or True,
}
create_in_memory_process_queue()

Expand Down
6 changes: 3 additions & 3 deletions dime_xai/server/frontend/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"files": {
"main.css": "/static/css/main.fbd77886.css",
"main.js": "/static/js/main.dfe68403.js",
"main.js": "/static/js/main.4990931a.js",
"static/js/787.0f148dca.chunk.js": "/static/js/787.0f148dca.chunk.js",
"static/media/dimeGray.png": "/static/media/dimeGray.99c075f2b43327a0161f.png",
"index.html": "/index.html",
"main.fbd77886.css.map": "/static/css/main.fbd77886.css.map",
"main.dfe68403.js.map": "/static/js/main.dfe68403.js.map",
"main.4990931a.js.map": "/static/js/main.4990931a.js.map",
"787.0f148dca.chunk.js.map": "/static/js/787.0f148dca.chunk.js.map"
},
"entrypoints": [
"static/css/main.fbd77886.css",
"static/js/main.dfe68403.js"
"static/js/main.4990931a.js"
]
}
2 changes: 1 addition & 1 deletion dime_xai/server/frontend/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1"/><meta http-equiv="X-UA-Compatible" content="ie=edge"/><link rel="stylesheet" href="\res\styles\app_styles.css"/><link href="http://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet"/><link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/><link href="https://fonts.googleapis.com/css?family=JetBrains Mono" rel="stylesheet"/><link href="https://fonts.googleapis.com/css?family=Rubik" rel="stylesheet"/><link href="\res\styles\bootstrap.min.css" rel="stylesheet"/><link rel="apple-touch-icon" sizes="180x180" href="\res\images\apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="\res\images\favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="\res\images\favicon-16x16.png"/><link rel="manifest" href="\manifest.json"/><title>DIME Dev Console</title><script defer="defer" src="/static/js/main.dfe68403.js"></script><link href="/static/css/main.fbd77886.css" rel="stylesheet"></head><body class="user-select-none"><div id="reactFrontendContainer"><script type="text/javascript">window.appTheme="{{ config['APP_THEME'] }}",window.appEnv="{{ config['APP_ENV'] }}",window.appSinhala="{{ config['SINHALA_ENABLED'] }}",window.appVersion="{{ config['VERSION'] }}"</script><script type="text/javascript" src="\res\scripts\bootstrap.min.js"></script><script type="text/javascript" src="\res\scripts\jquery-3.6.0.min.js"></script></div></body></html>
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1"/><meta http-equiv="X-UA-Compatible" content="ie=edge"/><link rel="stylesheet" href="\res\styles\app_styles.css"/><link href="http://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet"/><link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/><link href="https://fonts.googleapis.com/css?family=JetBrains Mono" rel="stylesheet"/><link href="https://fonts.googleapis.com/css?family=Rubik" rel="stylesheet"/><link href="\res\styles\bootstrap.min.css" rel="stylesheet"/><link rel="apple-touch-icon" sizes="180x180" href="\res\images\apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="\res\images\favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="\res\images\favicon-16x16.png"/><link rel="manifest" href="\manifest.json"/><title>DIME Dev Console</title><script defer="defer" src="/static/js/main.4990931a.js"></script><link href="/static/css/main.fbd77886.css" rel="stylesheet"></head><body class="user-select-none"><div id="reactFrontendContainer"><script type="text/javascript">window.appTheme="{{ config['APP_THEME'] }}",window.appEnv="{{ config['APP_ENV'] }}",window.appSinhala="{{ config['SINHALA_ENABLED'] }}",window.appVersion="{{ config['VERSION'] }}",window.secureUrl="{{ config['SECURE_BOT_URL'] }}"</script><script type="text/javascript" src="\res\scripts\bootstrap.min.js"></script></div></body></html>
5 changes: 3 additions & 2 deletions dime_xai/server/frontend/react-frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@
window.appEnv = "{{ config['APP_ENV'] }}";
window.appSinhala = "{{ config['SINHALA_ENABLED'] }}";
window.appVersion = "{{ config['VERSION'] }}";
window.secureUrl = "{{ config['SECURE_BOT_URL'] }}";
</script>
<script
type="text/javascript"
src="%PUBLIC_URL%\res\scripts\bootstrap.min.js"
></script>
<script
<!-- <script
type="text/javascript"
src="%PUBLIC_URL%\res\scripts\jquery-3.6.0.min.js"
></script>
></script> -->
</div>
</body>
</html>
1 change: 1 addition & 0 deletions dime_xai/server/frontend/react-frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export default class App extends React.Component {
element={
<Dashboard
appConfigs={this.state.appConfigs}
secureUrl={this.props.secureUrl}
showAppNotification={this.showAppNotification}
hideAppNotification={this.hideAppNotification}
scrollToTop={this.scrollToTop}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default class ConfigForm extends Component {
models_path: "notset",
url_endpoint: "notset",
},
secureUrl: props.secureUrl,
};
this.botURLRef = React.createRef();
this.dataPathRef = React.createRef();
Expand Down Expand Up @@ -144,6 +145,7 @@ export default class ConfigForm extends Component {
}
let payload = {
updated_configs: this.state.configs,
secure_url: this.state.secureUrl
};

this.setState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default class ConfigTab extends Component {
<Box sx={{ marginTop: 5 }}>
<ConfigForm
appConfigs={this.props.appConfigs}
secureUrl={this.props.secureUrl}
modelList={this.state.modelList}
fetchModels={this.fetchModels}
fetchStats={this.props.fetchStats}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default class DashboardPageTabsExplanations extends Component {
/>
<ConfigTab
appConfigs={this.props.appConfigs}
secureUrl={this.props.secureUrl}
showAppNotification={this.props.showAppNotification}
hideAppNotification={this.props.hideAppNotification}
scrollToTop={this.props.scrollToTop}
Expand Down
1 change: 1 addition & 0 deletions dime_xai/server/frontend/react-frontend/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ root.render(
appEnv={window.appEnv.toString().toLowerCase() || "prod"}
appSinhala={Boolean(window.appSinhala) || true}
appVersion={window.appVersion || "N/A"}
secureUrl={Boolean(window.secureUrl) || true}
/>
</React.StrictMode>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default class Dashboard extends Component {
/>
<DashboardPageTabsExplanations
appConfigs={this.props.appConfigs}
secureUrl={this.props.secureUrl}
showAppNotification={this.props.showAppNotification}
hideAppNotification={this.props.hideAppNotification}
scrollToTop={this.props.scrollToTop}
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dime_xai/server/frontend/static/js/main.4990931a.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dime_xai/server/frontend/static/js/main.dfe68403.js.map

This file was deleted.

Binary file modified dime_xai/shared/__pycache__/constants.cpython-38.pyc
Binary file not shown.
3 changes: 2 additions & 1 deletion dime_xai/shared/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

PACKAGE_NAME = "dime"
PACKAGE_NAME_PYPI = "dime_xai"
PACKAGE_VERSION = "1.1.3"
PACKAGE_VERSION = "1.2.0"
PACKAGE_VERSION_LONG = f'DIME Version:{PACKAGE_VERSION}\n[Supported RASA Version:\t2.8.x]'
RASA_CORE_VERSION = "2.8.8"
RASA_SDK_VERSION = "2.8.4"
Expand Down Expand Up @@ -103,6 +103,7 @@ class Encoding:
DEFAULT_DIME_SERVER_LOCALHOST_DEC = "0.0.0.0"
DEFAULT_DIME_SERVER_LOCALHOST = "localhost"
BOT_URL_REGEX = r"^(https?:\/\/((localhost)|(0.0.0.0)|(127.0.0.1)):[\d]{4}([a-zA-Z\d\-\/\#\_\$\@]+)?)|(https:\/\/[a-zA-Z\d\-\/\#\_\$\@]+\.[a-zA-Z\d\-\/\#\_\$\@]+\.[a-zA-Z\d\-\/\#\_\$\@]+(:[\d]{4})?([a-zA-Z\d\-\/\#\_\$\@]+)?)$"
BOT_URL_REGEX_HTTP = r"^(https?:\/\/((localhost)|(0.0.0.0)|(127.0.0.1)):[\d]{4}([a-zA-Z\d\-\/\#\_\$\@]+)?)|(http(s?):\/\/[a-zA-Z\d\-\/\#\_\$\@]+\.[a-zA-Z\d\-\/\#\_\$\@]+\.[a-zA-Z\d\-\/\#\_\$\@]+(:[\d]{4})?([a-zA-Z\d\-\/\#\_\$\@]+)?|(http(s?):\/\/[a-zA-Z\d\-\/\#\_\$\@]+\.[a-zA-Z\d\-\/\#\_\$\@]+\.[a-zA-Z\d\-\/\#\_\$\@]+(:[\d]{4})?([a-zA-Z\d\-\/\#\_\$\@\.]+)?))$"

# scaffold
DEFAULT_INIT_SRC_DIR_NAME = "init_dir"
Expand Down

0 comments on commit 2660eba

Please sign in to comment.