Skip to content
This repository was archived by the owner on Apr 28, 2021. It is now read-only.

Commit 263211f

Browse files
author
pheel
authored
Merge pull request #25 from botfront/fix/stories-fingerprint
fix: fix oversensitive story fingerprint
2 parents 36aa24a + de4efdd commit 263211f

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

addons_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
requests==2.22.0
1+
requests==2.23.0
22
requests_futures==0.9.9
33
fuzzy_matcher==0.1.0
44
fbmessenger==6.00

rasa/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ async def model_fingerprint(file_importer: "TrainingDataImporter") -> Fingerprin
290290
# bf mod
291291
config = await file_importer.get_config()
292292
domain = await file_importer.get_domain()
293-
stories = await file_importer.get_stories()
293+
stories_hash = await file_importer.get_stories_hash()
294294
nlu_data = await file_importer.get_nlu_data()
295295

296296
nlu_config = await file_importer.get_nlu_config()
@@ -311,7 +311,7 @@ async def model_fingerprint(file_importer: "TrainingDataImporter") -> Fingerprin
311311
FINGERPRINT_NLG_KEY: get_dict_hash(templates),
312312
FINGERPRINT_NLU_DATA_KEY: {lang: hash(nlu_data[lang])
313313
for lang in nlu_data},
314-
FINGERPRINT_STORIES_KEY: hash(stories),
314+
FINGERPRINT_STORIES_KEY: stories_hash,
315315
FINGERPRINT_TRAINED_AT_KEY: time.time(),
316316
FINGERPRINT_RASA_VERSION_KEY: rasa.__version__,
317317
}

rasa_addons/core/policies/mapping.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ def predict_action_probabilities(
111111

112112
idx = domain.index_for_action(ACTION_LISTEN_NAME)
113113
prediction[idx] = 1
114-
else:
115-
logger.debug("Predicted intent is not handled by BotfrontMappingPolicy.")
116114
return prediction
117115

118116
def persist(self, path: Text) -> None:

rasa_addons/importers/botfront.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ async def get_stories(
7373
)
7474
return StoryGraph(story_steps)
7575

76+
async def get_stories_hash(self):
77+
# Use a file hash of stories file to figure out Core fingerprint, instead of
78+
# storygraph object hash which is unstable
79+
return get_file_hash(self._story_files[0])
80+
7681
async def get_nlu_data(self, languages=True) -> Dict[Text, TrainingData]:
7782
language = None
7883
if isinstance(languages, str):

0 commit comments

Comments
 (0)