Skip to content

Commit

Permalink
Merge pull request #48 from brunohjs/#46
Browse files Browse the repository at this point in the history
#46 - Model download link parameter
  • Loading branch information
brunohjs authored Jan 28, 2023
2 parents 06a27fd + 2f260f3 commit caed755
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 188 deletions.
15 changes: 10 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.0] - In progress...
## [1.2.0] - 2023-01-28
### Added
- [#43](https://github.com/brunohjs/rasa-model-report/issues/43) End-to-end coverage feature.
- [#46](https://github.com/brunohjs/rasa-model-report/issues/46) Created `--model-link` CLI command parameter. This command is used to inform the model link that will be displayed in the report to download.

### Changed
- [#33](https://github.com/brunohjs/rasa-model-report/issues/33) Change response section title to `Core`.


## [1.1.0] - 2022-12-28
### Added
- [#31](https://github.com/brunohjs/rasa-model-report/issues/30) Support for python version 3.8 or higher.
- [#38](https://github.com/brunohjs/rasa-model-report/issues/38) Created `--version` CLI command. This command shows installed **rasa-model-report** version.
- [#15](https://github.com/brunohjs/rasa-model-report/issues/15) Created `--rasa-version` CLI command. This command is used to inform the Rasa version that will be displayed in the report.
- [#15](https://github.com/brunohjs/rasa-model-report/issues/15) Added `-p` to abbreviate `--path` parameter.
- [#15](https://github.com/brunohjs/rasa-model-report/issues/15) Created `--rasa-version` CLI command parameter. This command is used to inform the Rasa version that will be displayed in the report.
- [#18](https://github.com/brunohjs/rasa-model-report/issues/18) Created repository social media preview.
- [#31](https://github.com/brunohjs/rasa-model-report/issues/30) Support for python version 3.8 or higher.
- [#38](https://github.com/brunohjs/rasa-model-report/issues/38) Created `--version` CLI command parameter. This command shows installed **rasa-model-report** version.

### Changed
- [#15](https://github.com/brunohjs/rasa-model-report/issues/15) Changed CLI parameters to be clearer:
Expand All @@ -43,7 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#16](https://github.com/brunohjs/rasa-model-report/issues/16) Created a handler for retrieval intents in the report.


[1.2.0]: https://github.com/brunohjs/rasa-model-report/compare/1.1.0...HEAD
<!-- [1.2.0]: https://github.com/brunohjs/rasa-model-report/compare/1.2.0...HEAD -->
[1.2.0]: https://github.com/brunohjs/rasa-model-report/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/brunohjs/rasa-model-report/compare/1.0.1...1.1.0
[1.0.1]: https://github.com/brunohjs/rasa-model-report/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/brunohjs/rasa-model-report/releases/tag/1.0.0
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ There are parameters that can be used. Available options are below:
not be generated in the report. Required Rasa API.
(default: false)
-h, --help Show this help message.
--model-link TEXT Model download link. It's only displayed in the
report to model download.
--output-path TEXT Report output path. (default: ./)
-p, --path TEXT Rasa project path. (default: ./)
--project-name TEXT Rasa project name. It's only displayed in the
Expand Down
181 changes: 0 additions & 181 deletions e2e_coverage.py

This file was deleted.

3 changes: 3 additions & 0 deletions rasa_model_report/controllers/markdown_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(
self.rasa_version: str = rasa_version
self.output_report_path: str = f"{self.output_path}/model_report.md".replace("//", "/")
self.readme_path: str = "README.md"
self.model_link: str = kwargs.get("model_link")
self.json: JsonController = JsonController(rasa_path, output_path, project_name, project_version)
self.csv: CsvController = CsvController(rasa_path, output_path, project_name, project_version)
self.nlu: NluController = NluController(
Expand Down Expand Up @@ -167,6 +168,8 @@ def build_overview(self) -> str:
["Creation date", overview["created_at"]],
["Updated date", overview["updated_at"]]
])
if self.model_link:
data.append(["Model", f"[Download]({self.model_link})"])
text += "|" + "|".join([item[0] for item in data]) + "|\n"
text += "|" + "|".join([":-:" for i in range(len(data))]) + "|\n"
text += "|" + "|".join([f"<span {style}>{item[1]}</span>" for item in data]) + "|\n\n"
Expand Down
11 changes: 9 additions & 2 deletions rasa_model_report/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
"-h",
help="Show this help message."
)
@click.option(
"--model-link",
type=str,
required=False,
help="Model download link. It's only displayed in the report to model download."
)
@click.option(
"--output-path",
type=str,
Expand Down Expand Up @@ -71,7 +77,7 @@
message="v%(version)s",
help="Show installed rasa-model-report version.",
)
def main(disable_nlu, output_path, path, project_name, project_version, rasa_api, rasa_version):
def main(disable_nlu, model_link, output_path, path, project_name, project_version, rasa_api, rasa_version):
"""
Simple add-on that generates training model health reports for your Rasa projects. 📈🔍🧾🤖🧠
"""
Expand All @@ -82,6 +88,7 @@ def main(disable_nlu, output_path, path, project_name, project_version, rasa_api
rasa_version,
project_version,
disable_nlu=disable_nlu,
rasa_api_url=rasa_api
rasa_api_url=rasa_api,
model_link=model_link
)
return report
9 changes: 9 additions & 0 deletions tests/test_markdown_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ def test_build_overview():
assert "## Overview" in text


def test_build_overview_with_model_link():
markdown_controller = pytest.markdown_controller
markdown_controller.model_link = "http://teste.com"
text = markdown_controller.build_overview()
assert markdown_controller.model_link
assert "|Model|" in text
assert f"[Download]({markdown_controller.model_link})" in text


def test_build_intent_title():
markdown_controller = pytest.markdown_controller
text = markdown_controller.build_intent_title()
Expand Down

0 comments on commit caed755

Please sign in to comment.