diff --git a/src/components/iSee/persona/PersonaIntents.tsx b/src/components/iSee/persona/PersonaIntents.tsx
index 6166d8b..6e495c2 100644
--- a/src/components/iSee/persona/PersonaIntents.tsx
+++ b/src/components/iSee/persona/PersonaIntents.tsx
@@ -235,52 +235,56 @@ const PersonaIntents: React.FC = (props) => {
};
useEffect(() => {
- const handleVisibilityChange = () => {
+ const handleVisibilityChange = async () => {
if (document.visibilityState === 'visible' && chosenStrategy?.tree !== "" && chosenStrategy?.tree !== undefined) {
+ const hide = message.loading(
+ 'Updating explanation strategies from the Explanation Experience Editor!',
+ 0,
+ );
+ const data = await refresh_reuse_cases(usecaseId, chosenStrategy.tree);
+
+ const methods = data.methods;
+ const applicabilities = data.applicabilities;
+ let selectedIntent: PersonaIntent = {
+ id: "",
+ completed: false,
+ name: "",
+ evaluation: {}
+ };
- refresh_reuse_cases(chosenStrategy.tree).then(methods => {
-
-
- let selectedIntent: PersonaIntent = {
- id: "",
- completed: false,
- name: "",
- evaluation: {}
- };
-
- let intent_idx = 0;
- personaState?.intents?.forEach((intent_, i) => {
- intent_.strategies?.forEach((strat) => {
- if (strat.id == chosenStrategy?.id) {
- selectedIntent = intent_;
- intent_idx = i;
- }
- })
- });
-
- const UPDATED_STRATEGIES = personaState.intents?.[intent_idx].strategies?.map((s) => {
- if (s.tree === chosenStrategy.tree) {
- s.methods = methods;
+ let intent_idx = 0;
+ personaState?.intents?.forEach((intent_, i) => {
+ intent_.strategies?.forEach((strat) => {
+ if (strat.id == chosenStrategy?.id) {
+ selectedIntent = intent_;
+ intent_idx = i;
}
- return s;
- });
-
- const UPDATED_INTENTS = personaState.intents;
+ })
+ });
- if (typeof UPDATED_INTENTS !== "undefined") {
- UPDATED_INTENTS[intent_idx].strategies = UPDATED_STRATEGIES;
+ const UPDATED_STRATEGIES = personaState.intents?.[intent_idx].strategies?.map((s) => {
+ if (s.tree === chosenStrategy.tree) {
+ s.methods = methods;
+ s.applicabilities = applicabilities;
}
+ return s;
+ });
+
+ const UPDATED_INTENTS = personaState.intents;
- selectedIntent.strategies = UPDATED_STRATEGIES;
+ if (typeof UPDATED_INTENTS !== "undefined") {
+ UPDATED_INTENTS[intent_idx].strategies = UPDATED_STRATEGIES;
+ }
- api_persona_update_intent(usecaseId, personaState._id, selectedIntent.id, selectedIntent).then(res => {
+ selectedIntent.strategies = UPDATED_STRATEGIES;
- const PERSONA_IDX = personas.findIndex(p => p._id === persona._id);
- setPersonaState(res.personas[PERSONA_IDX]);
- });
+ api_persona_update_intent(usecaseId, personaState._id, selectedIntent.id, selectedIntent).then(res => {
+ const PERSONA_IDX = personas.findIndex(p => p._id === persona._id);
+ setPersonaState(res.personas[PERSONA_IDX]);
});
+ hide();
}
};
@@ -401,7 +405,7 @@ const PersonaIntents: React.FC = (props) => {
key: 'select',
render: (_: any, strategy: any) =>
( setSelectedStrategy(event, strategy)}
checkedChildren={}
@@ -500,7 +504,7 @@ const PersonaIntents: React.FC = (props) => {
-
>
diff --git a/src/pages/chatbot/DialogQuestionnaires.tsx b/src/pages/chatbot/DialogQuestionnaires.tsx
index 5da5393..f71f944 100644
--- a/src/pages/chatbot/DialogQuestionnaires.tsx
+++ b/src/pages/chatbot/DialogQuestionnaires.tsx
@@ -476,7 +476,7 @@ const DialogQuestionnaires: React.FC = (props) => {
onClick={sendAndReceive}
disabled={
(text == '' && responseType == ResponseType.NUMBER) ||
- (words(text) < 100 && responseType == ResponseType.OPEN) ||
+ (words(text) < 1 && responseType == ResponseType.OPEN) ||
(!check && responseType == ResponseType.CHECK) ||
(!radio && responseType == ResponseType.RADIO) ||
(!likert && responseType == ResponseType.LIKERT) ||
diff --git a/src/services/isee/editor.ts b/src/services/isee/editor.ts
index 9892f40..a16f0ed 100644
--- a/src/services/isee/editor.ts
+++ b/src/services/isee/editor.ts
@@ -20,15 +20,19 @@ export const open_editor_with_token = async (strategy: string, usecaseId: string
}
};
-export const refresh_reuse_cases = async (strategy: string) => {
+export const refresh_reuse_cases = async (usecase: string, strategy: string) => {
try {
- const STRATEGY_URL = `${BASE_URL}/trees/Projects/${strategy}/methods`;
+ const STRATEGY_URL = `${BASE_URL}/trees/Projects/methods`;
const data = await fetch(STRATEGY_URL, {
- method: 'GET',
+ method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-access-token': getToken()
},
+ body: JSON.stringify({
+ usecaseId: usecase,
+ treeId: strategy
+ })
});
const result = await data.json();
return result || [];