diff --git a/agent_chat/app.py b/agent_chat/app.py index 52a9f2a5d..aee3fbc60 100644 --- a/agent_chat/app.py +++ b/agent_chat/app.py @@ -530,10 +530,15 @@ def api_chat(): result = {"error": "Pas de workflow spécifié"} elif intent.intent_type == IntentType.LIST: - # Lister les workflows + # Lister les workflows avec métadonnées enrichies if matcher: workflows = [ - {"name": wf.name, "description": wf.description} + { + "name": wf.name, + "description": wf.description or "Workflow appris automatiquement", + "tags": wf.tags[:3] if wf.tags else [], + "id": wf.workflow_id, + } for wf in matcher.get_all_workflows() ] result = {"workflows": workflows} @@ -558,6 +563,33 @@ def api_chat(): result = {"history": command_history[-10:]} action_taken = "history_shown" + elif intent.intent_type == IntentType.QUERY: + # Rechercher des infos sur le workflow demandé + topic = intent.workflow_hint or intent.raw_query + if matcher and topic: + # Tenter de trouver le workflow correspondant + match = matcher.find_workflow(topic, min_confidence=0.3) + if match: + help_text = matcher.get_workflow_help(match.workflow_id) + result = {"answer": help_text} + else: + # Peut-être une question générale sur les workflows dispo + all_wf = matcher.get_all_workflows() + if all_wf: + wf_list = "\n".join( + f"• **{wf.name}**: {wf.description or 'Pas de description'}" + for wf in all_wf[:10] + ) + result = { + "answer": f"Je n'ai pas trouvé de workflow '{topic}', " + f"mais voici les workflows disponibles :\n{wf_list}" + } + else: + result = {} + else: + result = {} + action_taken = "query_answered" + elif intent.intent_type == IntentType.HELP: result = {} action_taken = "help_shown"