From 52e3e9cb2055c607932dd984a6c2a0c45b4320bd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 12:59:54 +0000 Subject: [PATCH 1/3] Initial plan From dc59906f79ff45bf7264a0aefc8010b17071b5b8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 13:07:22 +0000 Subject: [PATCH 2/3] Add greeting functionality to AI Agent Platform Co-authored-by: wasalstor-web <230709381+wasalstor-web@users.noreply.github.com> --- dlplus/core/arabic_processor.py | 10 +++++++++- dlplus/core/intelligence_core.py | 20 +++++++++++++++++--- tests/test_dlplus.py | 14 ++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/dlplus/core/arabic_processor.py b/dlplus/core/arabic_processor.py index 0f7775f..be3c838 100644 --- a/dlplus/core/arabic_processor.py +++ b/dlplus/core/arabic_processor.py @@ -10,6 +10,7 @@ class IntentType(Enum): """Types of user intents / أنواع النوايا""" + GREETING = "greeting" SEARCH = "search" GENERATE_CODE = "generate_code" EXECUTE_COMMAND = "execute_command" @@ -30,6 +31,10 @@ class ArabicProcessor: def __init__(self): # Arabic intent keywords / كلمات مفتاحية للنوايا self.intent_keywords = { + IntentType.GREETING: [ + "اهلا", "مرحبا", "السلام عليكم", "صباح الخير", "مساء الخير", + "اهلا وسهلا", "حياك", "اهلين", "يا هلا", "أهلا" + ], IntentType.SEARCH: [ "ابحث", "بحث", "ابحث عن", "جد", "ايجاد", "أبحث" ], @@ -101,7 +106,9 @@ def detect_intent(self, text: str) -> IntentType: return intent # Check English keywords - if any(word in text.lower() for word in ['search', 'find', 'look for']): + if any(word in text.lower() for word in ['hello', 'hi', 'hey', 'greetings', 'good morning', 'good evening', 'howdy']): + return IntentType.GREETING + elif any(word in text.lower() for word in ['search', 'find', 'look for']): return IntentType.SEARCH elif any(word in text.lower() for word in ['code', 'program', 'script', 'generate']): return IntentType.GENERATE_CODE @@ -148,6 +155,7 @@ def generate_response(self, intent: IntentType, context: Dict) -> str: توليد استجابة عربية بناءً على النية """ responses = { + IntentType.GREETING: "أهلاً وسهلاً! أنا وكيل ذكي جاهز لمساعدتك. كيف يمكنني خدمتك اليوم؟", IntentType.SEARCH: "سأقوم بالبحث عن المعلومات المطلوبة...", IntentType.GENERATE_CODE: "سأقوم بتوليد الكود البرمجي المطلوب...", IntentType.EXECUTE_COMMAND: "سأقوم بتنفيذ الأمر المطلوب...", diff --git a/dlplus/core/intelligence_core.py b/dlplus/core/intelligence_core.py index 96c3c36..d1804fd 100644 --- a/dlplus/core/intelligence_core.py +++ b/dlplus/core/intelligence_core.py @@ -127,7 +127,11 @@ def _select_tools(self, intent: IntentType, entities: Dict) -> List[str]: """Select tools needed based on intent and entities""" tools = [] - if intent == IntentType.SEARCH: + if intent == IntentType.GREETING: + # Greetings don't need any special tools + pass + + elif intent == IntentType.SEARCH: tools.append("run_web_search") elif intent == IntentType.GENERATE_CODE: @@ -167,7 +171,13 @@ def _create_execution_plan( } # Build steps based on intent - if intent == IntentType.SEARCH: + if intent == IntentType.GREETING: + plan["steps"] = [ + {"action": "generate_greeting", "tool": "arabic_processor"} + ] + plan["expected_output"] = "Friendly greeting response" + + elif intent == IntentType.SEARCH: plan["steps"] = [ {"action": "web_search", "tool": "run_web_search"}, {"action": "analyze_results", "tool": "intelligence_core"}, @@ -217,7 +227,11 @@ async def _execute_plan( {} ) else: - response = f"Processing your request with intent: {intent}" + # English responses + if intent == "greeting": + response = "Hello! I'm an intelligent AI agent ready to assist you. How can I help you today?" + else: + response = f"Processing your request with intent: {intent}" results["response"] = response results["steps_completed"] = [step["action"] for step in plan["steps"]] diff --git a/tests/test_dlplus.py b/tests/test_dlplus.py index f09c4a9..aa6fba1 100644 --- a/tests/test_dlplus.py +++ b/tests/test_dlplus.py @@ -46,6 +46,20 @@ def test_detect_intent_english(self): assert self.processor.detect_intent("generate code") == IntentType.GENERATE_CODE assert self.processor.detect_intent("run command") == IntentType.EXECUTE_COMMAND + def test_detect_greeting_arabic(self): + """Test greeting detection for Arabic""" + assert self.processor.detect_intent("اهلا") == IntentType.GREETING + assert self.processor.detect_intent("مرحبا") == IntentType.GREETING + assert self.processor.detect_intent("السلام عليكم") == IntentType.GREETING + assert self.processor.detect_intent("صباح الخير") == IntentType.GREETING + + def test_detect_greeting_english(self): + """Test greeting detection for English""" + assert self.processor.detect_intent("hello") == IntentType.GREETING + assert self.processor.detect_intent("hi") == IntentType.GREETING + assert self.processor.detect_intent("hey") == IntentType.GREETING + assert self.processor.detect_intent("good morning") == IntentType.GREETING + def test_extract_entities(self): """Test entity extraction""" text = "Read file test.py and search https://example.com" From 6e463330786190a13ecc6ab4e81623159c8c5e76 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 13:09:05 +0000 Subject: [PATCH 3/3] Fix: Use IntentType enum value for greeting comparison Co-authored-by: wasalstor-web <230709381+wasalstor-web@users.noreply.github.com> --- dlplus/core/intelligence_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlplus/core/intelligence_core.py b/dlplus/core/intelligence_core.py index d1804fd..7e99fee 100644 --- a/dlplus/core/intelligence_core.py +++ b/dlplus/core/intelligence_core.py @@ -228,7 +228,7 @@ async def _execute_plan( ) else: # English responses - if intent == "greeting": + if intent == IntentType.GREETING.value: response = "Hello! I'm an intelligent AI agent ready to assist you. How can I help you today?" else: response = f"Processing your request with intent: {intent}"