diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/.env.example b/full/.env.example similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/.env.example rename to full/.env.example diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/README.md b/full/README.md similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/README.md rename to full/README.md diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/__init__.py b/full/agenticcore/__init__.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/__init__.py rename to full/agenticcore/__init__.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/chatbot/__init__.py b/full/agenticcore/chatbot/__init__.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/chatbot/__init__.py rename to full/agenticcore/chatbot/__init__.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/chatbot/services.py b/full/agenticcore/chatbot/services.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/chatbot/services.py rename to full/agenticcore/chatbot/services.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/providers_unified.py b/full/agenticcore/providers_unified.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/providers_unified.py rename to full/agenticcore/providers_unified.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/integrations/web/fastapi/web_agentic.py b/full/agenticcore/web_agentic.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/integrations/web/fastapi/web_agentic.py rename to full/agenticcore/web_agentic.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/backend/__init__.py b/full/backend/__init__.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/backend/__init__.py rename to full/backend/__init__.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/backend/app/__init__.py b/full/backend/app/__init__.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/backend/app/__init__.py rename to full/backend/app/__init__.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/backend/app/main.py b/full/backend/app/main.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/backend/app/main.py rename to full/backend/app/main.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/backend/app/routers/__init__.py b/full/backend/app/routers/__init__.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/backend/app/routers/__init__.py rename to full/backend/app/routers/__init__.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/backend/app/routers/chatbot.py b/full/backend/app/routers/chatbot.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/backend/app/routers/chatbot.py rename to full/backend/app/routers/chatbot.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/__init__.py b/full/extras/__init__.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/__init__.py rename to full/extras/__init__.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/mbf_bot/__init__.py b/full/extras/mbf_bot/__init__.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/mbf_bot/__init__.py rename to full/extras/mbf_bot/__init__.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/integrations/botframework/app.py b/full/extras/mbf_bot/app.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/integrations/botframework/app.py rename to full/extras/mbf_bot/app.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/integrations/botframework/bot.py b/full/extras/mbf_bot/bot.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/integrations/botframework/bot.py rename to full/extras/mbf_bot/bot.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/mbf_bot/skills.py b/full/extras/mbf_bot/skills.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/mbf_bot/skills.py rename to full/extras/mbf_bot/skills.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/__init__.py b/full/frontend/__init__.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/__init__.py rename to full/frontend/__init__.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/app/assets/html/agenticcore_frontend.html b/full/frontend/agenticcore_frontend.html similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/app/assets/html/agenticcore_frontend.html rename to full/frontend/agenticcore_frontend.html diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/app/assets/html/chat_console.html b/full/frontend/chat_console.html similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/app/assets/html/chat_console.html rename to full/frontend/chat_console.html diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/app/assets/html/chat_minimal.html b/full/frontend/chat_minimal.html similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/app/assets/html/chat_minimal.html rename to full/frontend/chat_minimal.html diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/requirements.txt b/full/requirements.txt similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/requirements.txt rename to full/requirements.txt diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/tests/__init__.py b/full/tests/__init__.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/tests/__init__.py rename to full/tests/__init__.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/tests/test_routes.py b/full/tests/test_routes.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/tests/test_routes.py rename to full/tests/test_routes.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/tools/__init__.py b/full/tools/__init__.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/tools/__init__.py rename to full/tools/__init__.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/tools/quick_sanity.py b/full/tools/quick_sanity.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/tools/quick_sanity.py rename to full/tools/quick_sanity.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/tools/smoke_test.py b/full/tools/smoke_test.py similarity index 100% rename from storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/tools/smoke_test.py rename to full/tools/smoke_test.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/MAPPING_TABLE.csv b/storefront-chatbot_scaffold_merged/storefront-chatbot/MAPPING_TABLE.csv deleted file mode 100644 index 4ce2b461d03e9dda18e0f738030351e11a09ef8a..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/MAPPING_TABLE.csv +++ /dev/null @@ -1,23 +0,0 @@ -source_zip,source_path,target_path,status -full,/mnt/data/storefront-chatbot_full_merge/_ext_full/extras/mbf_bot/app.py,storefront_chatbot/app/app.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/anon_bot/handler.py,storefront_chatbot/anon_bot/handler.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/anon_bot/rules.py,storefront_chatbot/anon_bot/rules.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/app/app.py,storefront_chatbot/app/app.py,overwrote_full -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/app/routes.py,storefront_chatbot/app/routes.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/core/config.py,storefront_chatbot/core/config.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/core/logging.py,storefront_chatbot/core/logging.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/core/types.py,storefront_chatbot/core/types.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/guardrails/pii_redaction.py,storefront_chatbot/guardrails/pii_redaction.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/guardrails/safety.py,storefront_chatbot/guardrails/safety.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/logged_in_bot/handler.py,storefront_chatbot/logged_in_bot/handler.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/logged_in_bot/sentiment_azure.py,storefront_chatbot/logged_in_bot/sentiment_azure.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/logged_in_bot/tools.py,storefront_chatbot/logged_in_bot/tools.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/memory/sessions.py,storefront_chatbot/memory/sessions.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/memory/store.py,storefront_chatbot/memory/store.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/memory/rag/indexer.py,storefront_chatbot/memory/rag/indexer.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/memory/rag/retriever.py,storefront_chatbot/memory/rag/retriever.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/nlu/pipeline.py,storefront_chatbot/nlu/pipeline.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/nlu/prompts.py,storefront_chatbot/nlu/prompts.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/storefront_chatbot_skeleton/nlu/router.py,storefront_chatbot/nlu/router.py,placed -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/integrations/botframework/app.py,storefront_chatbot/app/app.py,overwrote_full -agentic,/mnt/data/storefront-chatbot_full_merge/_ext_agentic/logged_in_bot/handler.py,storefront_chatbot/logged_in_bot/handler.py,placed diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/README_MERGE_NOTES.md b/storefront-chatbot_scaffold_merged/storefront-chatbot/README_MERGE_NOTES.md deleted file mode 100644 index ca8f7a26a8cdf1c8e20a8cddb16306980f300098..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/README_MERGE_NOTES.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Merge Notes -Timestamp: 2025-09-26T04:21:21.687107 - -- Scaffold created under `storefront-chatbot/storefront_chatbot/`. -- Both zips extracted to `legacy_src/` for full traceability. -- Heuristic filename-based mapping used; **agentic** overwrites **full** on conflicts. -- Any unmapped files remain in `legacy_src/...` for manual triage. - -## Quickstart -```bash -cd storefront-chatbot -make dev -make run -# open http://localhost:7860 -``` diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/README.md b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/README.md deleted file mode 100644 index 2da4701fbbf3619c13db54434f0a55d61ad793c8..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/README.md +++ /dev/null @@ -1,6 +0,0 @@ - -## Agentic Integration -- Core bot: `agenticcore/chatbot/services.py` -- Providers: `agenticcore/providers_unified.py` -- CLI: `python -m agenticcore.cli agentic "hello"` (loads .env) -- FastAPI demo: `uvicorn integrations.web.fastapi.web_agentic:app --reload` diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/__init__.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/__init__.py deleted file mode 100644 index 5bb534f795ae0f566ba9f57c31944d8c6f45284c..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# package diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/chatbot/__init__.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/chatbot/__init__.py deleted file mode 100644 index 5bb534f795ae0f566ba9f57c31944d8c6f45284c..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/chatbot/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# package diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/cli.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/cli.py deleted file mode 100644 index 1e880c409a523dcd4108b0ac83e6d198c15df34b..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/agenticcore/cli.py +++ /dev/null @@ -1,186 +0,0 @@ -""" -agenticcore.cli -Console entrypoints: - - agentic: send a message to ChatBot and print reply JSON - - repo-tree: print a filtered tree view (uses tree.txt if present) - - repo-flatten: flatten code listing to stdout (uses FLATTENED_CODE.txt if present) -""" -import argparse, json, sys, traceback -from pathlib import Path -from dotenv import load_dotenv -import os - -# Load .env variables into os.environ (project root .env by default) -load_dotenv() - - -def cmd_agentic(argv=None): - # Lazy import so other commands don't require ChatBot to be importable - from agenticcore.chatbot.services import ChatBot - # We call analyze_sentiment only for 'status' to reveal the actual chosen provider - try: - from agenticcore.providers_unified import analyze_sentiment - except Exception: - analyze_sentiment = None # still fine; we'll show mode only - - p = argparse.ArgumentParser(prog="agentic", description="Chat with AgenticCore ChatBot") - p.add_argument("message", nargs="*", help="Message to send") - p.add_argument("--debug", action="store_true", help="Print debug info") - args = p.parse_args(argv) - msg = " ".join(args.message).strip() or "hello" - - if args.debug: - print(f"DEBUG argv={sys.argv}", flush=True) - print(f"DEBUG raw message='{msg}'", flush=True) - - bot = ChatBot() - - # Special commands for testing / assignments - # Special commands for testing / assignments - if msg.lower() == "status": - import requests # local import to avoid hard dep for other commands - - # Try a lightweight provider probe via analyze_sentiment - provider = None - if analyze_sentiment is not None: - try: - probe = analyze_sentiment("status ping") - provider = (probe or {}).get("provider") - except Exception: - if args.debug: - traceback.print_exc() - - # Hugging Face whoami auth probe - tok = os.getenv("HF_API_KEY", "") - who = None - auth_ok = False - err = None - try: - if tok: - r = requests.get( - "https://huggingface.co/api/whoami-v2", - headers={"Authorization": f"Bearer {tok}"}, - timeout=15, - ) - auth_ok = (r.status_code == 200) - who = r.json() if auth_ok else None - if not auth_ok: - err = r.text # e.g., {"error":"Invalid credentials in Authorization header"} - else: - err = "HF_API_KEY not set (load .env or export it)" - except Exception as e: - err = str(e) - - # Extract fine-grained scopes for visibility - fg = (((who or {}).get("auth") or {}).get("accessToken") or {}).get("fineGrained") or {} - scoped = fg.get("scoped") or [] - global_scopes = fg.get("global") or [] - - # ---- tiny inference ping (proves 'Make calls to Inference Providers') ---- - infer_ok, infer_err = False, None - try: - if tok: - model = os.getenv( - "HF_MODEL_SENTIMENT", - "distilbert-base-uncased-finetuned-sst-2-english" - ) - r2 = requests.post( - f"https://api-inference.huggingface.co/models/{model}", - headers={"Authorization": f"Bearer {tok}", "x-wait-for-model": "true"}, - json={"inputs": "ping"}, - timeout=int(os.getenv("HTTP_TIMEOUT", "60")), - ) - infer_ok = (r2.status_code == 200) - if not infer_ok: - infer_err = f"HTTP {r2.status_code}: {r2.text}" - except Exception as e: - infer_err = str(e) - # ------------------------------------------------------------------------- - - # Mask + length to verify what .env provided - mask = (tok[:3] + "..." + tok[-4:]) if tok else None - out = { - "provider": provider or "unknown", - "mode": getattr(bot, "_mode", "auto"), - "auth_ok": auth_ok, - "whoami": who, - "token_scopes": { # <--- added - "global": global_scopes, - "scoped": scoped, - }, - "inference_ok": infer_ok, - "inference_error": infer_err, - "env": { - "HF_API_KEY_len": len(tok) if tok else 0, - "HF_API_KEY_mask": mask, - "HF_MODEL_SENTIMENT": os.getenv("HF_MODEL_SENTIMENT"), - "HTTP_TIMEOUT": os.getenv("HTTP_TIMEOUT"), - }, - "capabilities": bot.capabilities(), - "error": err, - } - - elif msg.lower() == "help": - out = {"capabilities": bot.capabilities()} - - else: - try: - out = bot.reply(msg) - except Exception as e: - if args.debug: - traceback.print_exc() - out = {"error": str(e), "message": msg} - - if args.debug: - print(f"DEBUG out={out}", flush=True) - - print(json.dumps(out, indent=2), flush=True) - - -def cmd_repo_tree(argv=None): - p = argparse.ArgumentParser(prog="repo-tree", description="Print repo tree (from tree.txt if available)") - p.add_argument("--path", default="tree.txt", help="Path to precomputed tree file") - args = p.parse_args(argv) - path = Path(args.path) - if path.exists(): - print(path.read_text(encoding="utf-8"), flush=True) - else: - print("(no tree.txt found)", flush=True) - - -def cmd_repo_flatten(argv=None): - p = argparse.ArgumentParser(prog="repo-flatten", description="Print flattened code listing") - p.add_argument("--path", default="FLATTENED_CODE.txt", help="Path to pre-flattened code file") - args = p.parse_args(argv) - path = Path(args.path) - if path.exists(): - print(path.read_text(encoding="utf-8"), flush=True) - else: - print("(no FLATTENED_CODE.txt found)", flush=True) - - -def _dispatch(): - # Allow: python -m agenticcore.cli [args...] - if len(sys.argv) <= 1: - print("Usage: python -m agenticcore.cli [args]", file=sys.stderr) - sys.exit(2) - cmd, argv = sys.argv[1], sys.argv[2:] - try: - if cmd == "agentic": - cmd_agentic(argv) - elif cmd == "repo-tree": - cmd_repo_tree(argv) - elif cmd == "repo-flatten": - cmd_repo_flatten(argv) - else: - print(f"Unknown subcommand: {cmd}", file=sys.stderr) - sys.exit(2) - except SystemExit: - raise - except Exception: - traceback.print_exc() - sys.exit(1) - - -if __name__ == "__main__": - _dispatch() diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/logged_in_bot/handler.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/logged_in_bot/handler.py deleted file mode 100644 index 42488cd43c647dfd7f1ff6189fb4ad008d21f18f..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/logged_in_bot/handler.py +++ /dev/null @@ -1,17 +0,0 @@ -from agenticcore.chatbot.services import ChatBot - -_bot = ChatBot() - -def handle_turn(message, history, user): - history = history or [] - try: - res = _bot.reply(message) - reply = res.get("reply") or "Noted." - label = res.get("sentiment") - conf = res.get("confidence") - if label is not None and conf is not None: - reply = f"{reply} (sentiment: {label}, confidence: {float(conf):.2f})" - except Exception as e: - reply = f"Sorry—error in ChatBot: {type(e).__name__}. Using fallback." - history = history + [[message, reply]] - return history diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/requirements.txt b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/requirements.txt deleted file mode 100644 index eee348aaada32fe4ad42fb5406eab15c2666269b..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ - -python-dotenv>=1.0 -fastapi>=0.115.0 -uvicorn[standard]>=0.30.0 -# Optional for Bot Framework sample: -# aiohttp>=3.9 -# botbuilder-core>=4.14 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/.env.sample b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/.env.sample deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/Makefile b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/Makefile deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/README.md b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/README.md deleted file mode 100644 index 9bea57d1cb9e65551241d34e41fbab607b355945..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/README.md +++ /dev/null @@ -1 +0,0 @@ -# Storefront Chatbot (skeleton) diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/anon_bot/handler.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/anon_bot/handler.py deleted file mode 100644 index 04907a388c5f485a55f941252f09fe9af3504faa..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/anon_bot/handler.py +++ /dev/null @@ -1 +0,0 @@ -def handle_turn(m,h,u): return (h or [])+[[m,'hi']] diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/anon_bot/rules.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/anon_bot/rules.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/app/app.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/app/app.py deleted file mode 100644 index cb83de1596ffab86c4770b5be0aac4b2680251f2..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/app/app.py +++ /dev/null @@ -1 +0,0 @@ -print('stub app.py') diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/app/routes.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/app/routes.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/core/config.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/core/config.py deleted file mode 100644 index 77f363b6df321c56f03a2a76166a1dd71ea68958..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/core/config.py +++ /dev/null @@ -1,2 +0,0 @@ -class Settings: pass -settings = Settings() diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/core/logging.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/core/logging.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/core/types.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/core/types.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/docs/architecture.md b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/docs/architecture.md deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/docs/design.md b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/docs/design.md deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/docs/results.md b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/docs/results.md deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/guardrails/pii_redaction.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/guardrails/pii_redaction.py deleted file mode 100644 index 09bbfdc84ce7ad778bb4c128a6ed3d6c4b2185f5..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/guardrails/pii_redaction.py +++ /dev/null @@ -1 +0,0 @@ -def redact(t): return t diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/guardrails/safety.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/guardrails/safety.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/integrations/azure/bot_framework.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/integrations/azure/bot_framework.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/integrations/email/ticket_stub.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/integrations/email/ticket_stub.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/logged_in_bot/handler.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/logged_in_bot/handler.py deleted file mode 100644 index 04800bc418b6da89c5f65d770cdc8807967b4df1..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/logged_in_bot/handler.py +++ /dev/null @@ -1 +0,0 @@ -def handle_turn(m,h,u): return (h or [])+[[m,'hi-logged']] diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/logged_in_bot/sentiment_azure.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/logged_in_bot/sentiment_azure.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/logged_in_bot/tools.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/logged_in_bot/tools.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/memory/rag/indexer.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/memory/rag/indexer.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/memory/rag/retriever.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/memory/rag/retriever.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/memory/sessions.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/memory/sessions.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/memory/store.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/memory/store.py deleted file mode 100644 index f1f8fc1367351ebdb6f66e0ae63170d72ab49c3d..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/memory/store.py +++ /dev/null @@ -1 +0,0 @@ -DB={} diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/nlu/pipeline.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/nlu/pipeline.py deleted file mode 100644 index bf3d76e8b4e2f3dd602d4019f2127f53bc461ab0..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/nlu/pipeline.py +++ /dev/null @@ -1 +0,0 @@ -def analyze(t): return {'intent':'general'} diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/nlu/prompts.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/nlu/prompts.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/nlu/router.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/nlu/router.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/pyproject.toml b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/pyproject.toml deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/requirements.txt b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/requirements.txt deleted file mode 100644 index b880164032e207e96b8ce3960b58ade69971be01..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -gradio==4.44.0 -pytest==8.3.3 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/scripts/check_compliance.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/scripts/check_compliance.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/scripts/run_local.sh b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/scripts/run_local.sh deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/scripts/seed_data.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/scripts/seed_data.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/tests/test_anon_bot.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/tests/test_anon_bot.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/tests/test_guardrails.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/tests/test_guardrails.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/tests/test_logged_in_bot.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/tests/test_logged_in_bot.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/tests/test_memory.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/tests/test_memory.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/tests/test_nlu.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/agentic/storefront_chatbot_skeleton/tests/test_nlu.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/chatbot/services.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/chatbot/services.py deleted file mode 100644 index 94c5f7df595c4f3b524387303672885ec13d90c4..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/chatbot/services.py +++ /dev/null @@ -1,102 +0,0 @@ -from __future__ import annotations - -import json -import os -from dataclasses import dataclass -from typing import Dict - -# Delegate sentiment to the unified provider layer -# If you put providers_unified.py under agenticcore/chatbot/, change the import to: -# from agenticcore.chatbot.providers_unified import analyze_sentiment -from agenticcore.providers_unified import analyze_sentiment -from ..providers_unified import analyze_sentiment - - -def _trim(s: str, max_len: int = 2000) -> str: - s = (s or "").strip() - return s if len(s) <= max_len else s[: max_len - 1] + "…" - - -@dataclass(frozen=True) -class SentimentResult: - label: str # "positive" | "neutral" | "negative" | "mixed" | "unknown" - confidence: float # 0.0 .. 1.0 - - -class ChatBot: - """ - Minimal chatbot that uses provider-agnostic sentiment via providers_unified. - Public API: - - reply(text: str) -> Dict[str, object] - - capabilities() -> Dict[str, object] - """ - - def __init__(self, system_prompt: str = "You are a concise helper.") -> None: - self._system_prompt = _trim(system_prompt, 800) - # Expose which provider is intended/active (for diagnostics) - self._mode = os.getenv("AI_PROVIDER") or "auto" - - def capabilities(self) -> Dict[str, object]: - """List what this bot can do.""" - return { - "system": "chatbot", - "mode": self._mode, # "auto" or a pinned provider (hf/azure/openai/cohere/deepai/offline) - "features": ["text-input", "sentiment-analysis", "help"], - "commands": {"help": "Describe capabilities and usage."}, - } - - def reply(self, text: str) -> Dict[str, object]: - """Produce a reply and sentiment for one user message.""" - user = _trim(text) - if not user: - return self._make_response( - "I didn't catch that. Please provide some text.", - SentimentResult("unknown", 0.0), - ) - - if user.lower() in {"help", "/help"}: - return {"reply": self._format_help(), "capabilities": self.capabilities()} - - s = analyze_sentiment(user) # -> {"provider", "label", "score", ...} - sr = SentimentResult(label=str(s.get("label", "neutral")), confidence=float(s.get("score", 0.5))) - return self._make_response(self._compose(sr), sr) - - # ---- internals ---- - - def _format_help(self) -> str: - caps = self.capabilities() - feats = ", ".join(caps["features"]) - return f"I can analyze sentiment and respond concisely. Features: {feats}. Send any text or type 'help'." - - @staticmethod - def _make_response(reply: str, s: SentimentResult) -> Dict[str, object]: - return {"reply": reply, "sentiment": s.label, "confidence": round(float(s.confidence), 2)} - - @staticmethod - def _compose(s: SentimentResult) -> str: - if s.label == "positive": - return "Thanks for sharing. I detected a positive sentiment." - if s.label == "negative": - return "I hear your concern. I detected a negative sentiment." - if s.label == "neutral": - return "Noted. The sentiment appears neutral." - if s.label == "mixed": - return "Your message has mixed signals. Can you clarify?" - return "I could not determine the sentiment. Please rephrase." - - -# Optional: local REPL for quick manual testing -def _interactive_loop() -> None: - bot = ChatBot() - try: - while True: - msg = input("> ").strip() - if msg.lower() in {"exit", "quit"}: - break - print(json.dumps(bot.reply(msg), ensure_ascii=False)) - except (EOFError, KeyboardInterrupt): - pass - - -if __name__ == "__main__": - _interactive_loop() diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/providers_unified.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/providers_unified.py deleted file mode 100644 index 921c0eeafce6f620f92e80112f7c5cd1bb6cb6a6..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/providers_unified.py +++ /dev/null @@ -1,273 +0,0 @@ -""" -providers_unified.py -Unified, switchable providers for sentiment + (optional) text generation. -Selection order unless AI_PROVIDER is set: - HF -> AZURE -> OPENAI -> COHERE -> DEEPAI -> OFFLINE -Env vars: - HF_API_KEY - MICROSOFT_AI_SERVICE_ENDPOINT, MICROSOFT_AI_API_KEY - OPENAI_API_KEY, OPENAI_MODEL=gpt-3.5-turbo - COHERE_API_KEY, COHERE_MODEL=command - DEEPAI_API_KEY - AI_PROVIDER = hf|azure|openai|cohere|deepai|offline - HTTP_TIMEOUT = 20 -""" -from __future__ import annotations -import os, json -from typing import Dict, Any, Optional -import requests - -TIMEOUT = float(os.getenv("HTTP_TIMEOUT", "20")) - -def _env(name: str, default: Optional[str] = None) -> Optional[str]: - v = os.getenv(name) - return v if (v is not None and str(v).strip() != "") else default - -def _pick_provider() -> str: - forced = _env("AI_PROVIDER") - if forced in {"hf", "azure", "openai", "cohere", "deepai", "offline"}: - return forced - if _env("HF_API_KEY"): return "hf" - if _env("MICROSOFT_AI_API_KEY") and _env("MICROSOFT_AI_SERVICE_ENDPOINT"): return "azure" - if _env("OPENAI_API_KEY"): return "openai" - if _env("COHERE_API_KEY"): return "cohere" - if _env("DEEPAI_API_KEY"): return "deepai" - return "offline" - -# --------------------------- -# Sentiment -# --------------------------- - -def analyze_sentiment(text: str) -> Dict[str, Any]: - provider = _pick_provider() - try: - if provider == "hf": return _sentiment_hf(text) - if provider == "azure": return _sentiment_azure(text) - if provider == "openai": return _sentiment_openai_prompt(text) - if provider == "cohere": return _sentiment_cohere_prompt(text) - if provider == "deepai": return _sentiment_deepai(text) - return _sentiment_offline(text) - except Exception as e: - return {"provider": provider, "label": "neutral", "score": 0.5, "error": str(e)} - -def _sentiment_offline(text: str) -> Dict[str, Any]: - t = (text or "").lower() - pos = any(w in t for w in ["love","great","good","awesome","fantastic","thank","excellent","amazing"]) - neg = any(w in t for w in ["hate","bad","terrible","awful","worst","angry","horrible"]) - label = "positive" if pos and not neg else "negative" if neg and not pos else "neutral" - score = 0.9 if label != "neutral" else 0.5 - return {"provider": "offline", "label": label, "score": score} - -def _sentiment_hf(text: str) -> Dict[str, Any]: - """ - Hugging Face Inference API for sentiment. - Uses canonical repo id and handles 404/401 and various payload shapes. - """ - key = _env("HF_API_KEY") - if not key: - return _sentiment_offline(text) - - # canonical repo id to avoid 404 - model = _env("HF_MODEL_SENTIMENT", "distilbert/distilbert-base-uncased-finetuned-sst-2-english") - timeout = int(_env("HTTP_TIMEOUT", "30")) - - headers = { - "Authorization": f"Bearer {key}", - "x-wait-for-model": "true", - "Accept": "application/json", - "Content-Type": "application/json", - } - - r = requests.post( - f"https://api-inference.huggingface.co/models/{model}", - headers=headers, - json={"inputs": text}, - timeout=timeout, - ) - - if r.status_code != 200: - return {"provider": "hf", "label": "neutral", "score": 0.5, "error": f"HTTP {r.status_code}: {r.text[:500]}"} - - try: - data = r.json() - except Exception as e: - return {"provider": "hf", "label": "neutral", "score": 0.5, "error": str(e)} - - if isinstance(data, dict) and "error" in data: - return {"provider": "hf", "label": "neutral", "score": 0.5, "error": data["error"]} - - # normalize list shape - arr = data[0] if isinstance(data, list) and data and isinstance(data[0], list) else (data if isinstance(data, list) else []) - if not (isinstance(arr, list) and arr): - return {"provider": "hf", "label": "neutral", "score": 0.5, "error": f"Unexpected payload: {data}"} - - top = max(arr, key=lambda x: x.get("score", 0.0) if isinstance(x, dict) else 0.0) - raw = str(top.get("label", "")).upper() - score = float(top.get("score", 0.5)) - - mapping = { - "LABEL_0": "negative", "LABEL_1": "neutral", "LABEL_2": "positive", - "NEGATIVE": "negative", "NEUTRAL": "neutral", "POSITIVE": "positive", - } - label = mapping.get(raw, (raw.lower() or "neutral")) - - neutral_floor = float(os.getenv("SENTIMENT_NEUTRAL_THRESHOLD", "0.65")) - if label in {"positive", "negative"} and score < neutral_floor: - label = "neutral" - - return {"provider": "hf", "label": label, "score": score} - -def _sentiment_azure(text: str) -> Dict[str, Any]: - try: - from azure.core.credentials import AzureKeyCredential # type: ignore - from azure.ai.textanalytics import TextAnalyticsClient # type: ignore - except Exception: - return _sentiment_offline(text) - endpoint = _env("MICROSOFT_AI_SERVICE_ENDPOINT") - key = _env("MICROSOFT_AI_API_KEY") - if not (endpoint and key): return _sentiment_offline(text) - client = TextAnalyticsClient(endpoint=endpoint.strip(), credential=AzureKeyCredential(key.strip())) - resp = client.analyze_sentiment(documents=[text], show_opinion_mining=False)[0] - scores = { - "positive": float(getattr(resp.confidence_scores, "positive", 0.0) or 0.0), - "neutral": float(getattr(resp.confidence_scores, "neutral", 0.0) or 0.0), - "negative": float(getattr(resp.confidence_scores, "negative", 0.0) or 0.0), - } - label = max(scores, key=scores.get) - return {"provider": "azure", "label": label, "score": scores[label]} - -def _sentiment_openai_prompt(text: str) -> Dict[str, Any]: - key = _env("OPENAI_API_KEY") - model = _env("OPENAI_MODEL", "gpt-3.5-turbo") - if not key: return _sentiment_offline(text) - url = "https://api.openai.com/v1/chat/completions" - prompt = f"Classify the sentiment of this text as positive, negative, or neutral. Reply JSON with keys label and score (0..1). Text: {text!r}" - r = requests.post( - url, - headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"}, - json={"model": model, "messages": [{"role": "user", "content": prompt}], "temperature": 0}, - timeout=TIMEOUT, - ) - r.raise_for_status() - content = r.json()["choices"][0]["message"]["content"] - try: - obj = json.loads(content) - label = str(obj.get("label", "neutral")).lower() - score = float(obj.get("score", 0.5)) - return {"provider": "openai", "label": label, "score": score} - except Exception: - l = "positive" if "positive" in content.lower() else "negative" if "negative" in content.lower() else "neutral" - return {"provider": "openai", "label": l, "score": 0.5} - -def _sentiment_cohere_prompt(text: str) -> Dict[str, Any]: - key = _env("COHERE_API_KEY") - model = _env("COHERE_MODEL", "command") - if not key: return _sentiment_offline(text) - url = "https://api.cohere.ai/v1/generate" - prompt = f"Classify the sentiment (positive, negative, neutral) and return JSON with keys label and score (0..1). Text: {text!r}" - r = requests.post( - url, - headers={ - "Authorization": f"Bearer {key}", - "Content-Type": "application/json", - "Cohere-Version": "2022-12-06", - }, - json={"model": model, "prompt": prompt, "max_tokens": 30, "temperature": 0}, - timeout=TIMEOUT, - ) - r.raise_for_status() - gen = (r.json().get("generations") or [{}])[0].get("text", "") - try: - obj = json.loads(gen) - label = str(obj.get("label", "neutral")).lower() - score = float(obj.get("score", 0.5)) - return {"provider": "cohere", "label": label, "score": score} - except Exception: - l = "positive" if "positive" in gen.lower() else "negative" if "negative" in gen.lower() else "neutral" - return {"provider": "cohere", "label": l, "score": 0.5} - -def _sentiment_deepai(text: str) -> Dict[str, Any]: - key = _env("DEEPAI_API_KEY") - if not key: return _sentiment_offline(text) - url = "https://api.deepai.org/api/sentiment-analysis" - r = requests.post(url, headers={"api-key": key}, data={"text": text}, timeout=TIMEOUT) - r.raise_for_status() - data = r.json() - label = (data.get("output") or ["neutral"])[0].lower() - return {"provider": "deepai", "label": label, "score": 0.5 if label == "neutral" else 0.9} - -# --------------------------- -# Text generation (optional) -# --------------------------- - -def generate_text(prompt: str, max_tokens: int = 128) -> Dict[str, Any]: - provider = _pick_provider() - try: - if provider == "hf": return _gen_hf(prompt, max_tokens) - if provider == "openai": return _gen_openai(prompt, max_tokens) - if provider == "cohere": return _gen_cohere(prompt, max_tokens) - if provider == "deepai": return _gen_deepai(prompt, max_tokens) - return {"provider": "offline", "text": f"(offline) {prompt[:160]}"} - except Exception as e: - return {"provider": provider, "text": f"(error) {str(e)}"} - -def _gen_hf(prompt: str, max_tokens: int) -> Dict[str, Any]: - key = _env("HF_API_KEY") - if not key: return {"provider": "offline", "text": f"(offline) {prompt[:160]}"} - model = _env("HF_MODEL_GENERATION", "tiiuae/falcon-7b-instruct") - r = requests.post( - f"https://api-inference.huggingface.co/models/{model}", - headers={"Authorization": f"Bearer {key}"}, - json={"inputs": prompt, "parameters": {"max_new_tokens": max_tokens}}, - timeout=TIMEOUT, - ) - r.raise_for_status() - data = r.json() - if isinstance(data, list) and data and "generated_text" in data[0]: - return {"provider": "hf", "text": data[0]["generated_text"]} - return {"provider": "hf", "text": str(data)} - -def _gen_openai(prompt: str, max_tokens: int) -> Dict[str, Any]: - key = _env("OPENAI_API_KEY") - model = _env("OPENAI_MODEL", "gpt-3.5-turbo") - if not key: return {"provider": "offline", "text": f"(offline) {prompt[:160]}"} - url = "https://api.openai.com/v1/chat/completions" - r = requests.post( - url, - headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"}, - json={"model": model, "messages": [{"role": "user", "content": prompt}], "max_tokens": max_tokens}, - timeout=TIMEOUT, - ) - r.raise_for_status() - data = r.json() - text = data["choices"][0]["message"]["content"] - return {"provider": "openai", "text": text} - -def _gen_cohere(prompt: str, max_tokens: int) -> Dict[str, Any]: - key = _env("COHERE_API_KEY") - model = _env("COHERE_MODEL", "command") - if not key: return {"provider": "offline", "text": f"(offline) {prompt[:160]}"} - url = "https://api.cohere.ai/v1/generate" - r = requests.post( - url, - headers={ - "Authorization": f"Bearer {key}", - "Content-Type": "application/json", - "Cohere-Version": "2022-12-06", - }, - json={"model": model, "prompt": prompt, "max_tokens": max_tokens}, - timeout=TIMEOUT, - ) - r.raise_for_status() - data = r.json() - text = data.get("generations", [{}])[0].get("text", "") - return {"provider": "cohere", "text": text} - -def _gen_deepai(prompt: str, max_tokens: int) -> Dict[str, Any]: - key = _env("DEEPAI_API_KEY") - if not key: return {"provider": "offline", "text": f"(offline) {prompt[:160]}"} - url = "https://api.deepai.org/api/text-generator" - r = requests.post(url, headers={"api-key": key}, data={"text": prompt}, timeout=TIMEOUT) - r.raise_for_status() - data = r.json() - return {"provider": "deepai", "text": data.get("output", "")} diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/web_agentic.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/web_agentic.py deleted file mode 100644 index 5807d4bcf0f9eb328cc4f57e64f56331108110d6..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/agenticcore/web_agentic.py +++ /dev/null @@ -1,22 +0,0 @@ -# agenticcore/web_agentic.py -from fastapi import FastAPI, Query -from fastapi.responses import HTMLResponse -from agenticcore.chatbot.services import ChatBot - -app = FastAPI(title="AgenticCore Web UI") - -# 1. Simple HTML form at / -@app.get("/", response_class=HTMLResponse) -def index(): - return """ -
- - -
- """ - -# 2. Agentic endpoint -@app.get("/agentic") -def run_agentic(msg: str = Query(..., description="Message to send to ChatBot")): - bot = ChatBot() - return bot.reply(msg) diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/mbf_bot/app.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/mbf_bot/app.py deleted file mode 100644 index eb54bf07d1c4b27a80245c48c356f390985d0758..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/mbf_bot/app.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python3 -# app.py — aiohttp + Bot Framework Echo bot - -import os -import sys -import json -from logic import handle_text -from aiohttp import web -from botbuilder.core import BotFrameworkAdapter, BotFrameworkAdapterSettings, TurnContext -from botbuilder.schema import Activity -import aiohttp_cors -from pathlib import Path - - -# ------------------------------------------------------------------- -# Your bot implementation -# ------------------------------------------------------------------- -# Make sure this exists at packages/bots/echo_bot.py -# from bots.echo_bot import EchoBot -# Minimal inline fallback if you want to test quickly: -class EchoBot: - async def on_turn(self, turn_context: TurnContext): - if turn_context.activity.type == "message": - text = (turn_context.activity.text or "").strip() - if not text: - await turn_context.send_activity("Input was empty. Type 'help' for usage.") - return - - lower = text.lower() - if lower == "help": - await turn_context.send_activity("Try: echo | reverse: | capabilities") - elif lower == "capabilities": - await turn_context.send_activity("- echo\n- reverse\n- help\n- capabilities") - elif lower.startswith("reverse:"): - payload = text.split(":", 1)[1].strip() - await turn_context.send_activity(payload[::-1]) - elif lower.startswith("echo "): - await turn_context.send_activity(text[5:]) - else: - await turn_context.send_activity("Unsupported command. Type 'help' for examples.") - else: - await turn_context.send_activity(f"[{turn_context.activity.type}] event received.") - -# ------------------------------------------------------------------- -# Adapter / bot setup -# ------------------------------------------------------------------- -APP_ID = os.environ.get("MicrosoftAppId") or None -APP_PASSWORD = os.environ.get("MicrosoftAppPassword") or None - -adapter_settings = BotFrameworkAdapterSettings(APP_ID, APP_PASSWORD) -adapter = BotFrameworkAdapter(adapter_settings) - -async def on_error(context: TurnContext, error: Exception): - print(f"[on_turn_error] {error}", file=sys.stderr, flush=True) - try: - await context.send_activity("Oops. Something went wrong!") - except Exception as send_err: - print(f"[on_turn_error][send_activity_failed] {send_err}", file=sys.stderr, flush=True) - -adapter.on_turn_error = on_error -bot = EchoBot() - -# ------------------------------------------------------------------- -# HTTP handlers -# ------------------------------------------------------------------- -async def messages(req: web.Request) -> web.Response: - # Content-Type can include charset; do a contains check - ctype = (req.headers.get("Content-Type") or "").lower() - if "application/json" not in ctype: - return web.Response(status=415, text="Unsupported Media Type: expected application/json") - - try: - body = await req.json() - except json.JSONDecodeError: - return web.Response(status=400, text="Invalid JSON body") - - activity = Activity().deserialize(body) - auth_header = req.headers.get("Authorization") - - invoke_response = await adapter.process_activity(activity, auth_header, bot.on_turn) - if invoke_response: - # For invoke activities, adapter returns explicit status/body - return web.json_response(data=invoke_response.body, status=invoke_response.status) - # Acknowledge standard message activities - return web.Response(status=202, text="Accepted") - -async def home(_req: web.Request) -> web.Response: - return web.Response( - text="Bot is running. POST Bot Framework activities to /api/messages.", - content_type="text/plain" - ) - -async def messages_get(_req: web.Request) -> web.Response: - return web.Response( - text="This endpoint only accepts POST (Bot Framework activities).", - content_type="text/plain", - status=405 - ) - -async def healthz(_req: web.Request) -> web.Response: - return web.json_response({"status": "ok"}) - -async def plain_chat(req: web.Request) -> web.Response: - try: - payload = await req.json() - except Exception: - return web.json_response({"error": "Invalid JSON"}, status=400) - user_text = payload.get("text", "") - reply = handle_text(user_text) - return web.json_response({"reply": reply}) - -# ------------------------------------------------------------------- -# App factory and entrypoint -# ------------------------------------------------------------------- -from pathlib import Path - -def create_app() -> web.Application: - app = web.Application() - app.router.add_get("/", home) - app.router.add_get("/healthz", healthz) - app.router.add_get("/api/messages", messages_get) - app.router.add_post("/api/messages", messages) - app.router.add_post("/plain-chat", plain_chat) - - static_dir = Path(__file__).parent / "static" - if static_dir.exists(): - app.router.add_static("/static/", path=static_dir, show_index=True) - else: - print(f"[warn] static directory not found: {static_dir}", flush=True) - - return app - -app = create_app() - -if __name__ == "__main__": - host = os.environ.get("HOST", "127.0.0.1") # use 0.0.0.0 in containers - port = int(os.environ.get("PORT", 3978)) - web.run_app(app, host=host, port=port) diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/mbf_bot/bot.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/mbf_bot/bot.py deleted file mode 100644 index 4cb889920c8265d0630fa203ec85773533fa5a79..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/extras/mbf_bot/bot.py +++ /dev/null @@ -1,86 +0,0 @@ -# bot.py -""" -Simple MBF bot: -- 'help' / 'capabilities' shows features -- 'reverse ' returns reversed text -- otherwise delegates to AgenticCore ChatBot (sentiment) if available -""" - -from typing import List, Optional, Dict, Any -from botbuilder.core import ActivityHandler, TurnContext -from botbuilder.schema import ChannelAccount, ActivityTypes - -from skills import normalize, reverse_text, capabilities, is_empty - -# Try to import AgenticCore; if unavailable, provide a tiny fallback. -try: - from agenticcore.chatbot.services import ChatBot # real provider-backed bot -except Exception: - class ChatBot: # fallback shim for offline/dev - def reply(self, message: str) -> Dict[str, Any]: - return { - "reply": "Noted. (local fallback reply)", - "sentiment": "neutral", - "confidence": 0.5, - } - -def _format_sentiment(res: Dict[str, Any]) -> str: - """Compose a user-facing string from ChatBot reply payload.""" - reply = (res.get("reply") or "").strip() - label: Optional[str] = res.get("sentiment") - conf = res.get("confidence") - if label is not None and conf is not None: - return f"{reply} (sentiment: {label}, confidence: {float(conf):.2f})" - return reply or "I'm not sure what to say." - -def _help_text() -> str: - """Single source of truth for the help/capability text.""" - feats = "\n".join(f"- {c}" for c in capabilities()) - return ( - "I can reverse text and provide concise replies with sentiment.\n" - "Commands:\n" - "- help | capabilities\n" - "- reverse \n" - "General text will be handled by the ChatBot service.\n\n" - f"My capabilities:\n{feats}" - ) - -class SimpleBot(ActivityHandler): - """Minimal ActivityHandler with local commands + ChatBot fallback.""" - - def __init__(self, chatbot: Optional[ChatBot] = None): - self._chatbot = chatbot or ChatBot() - - async def on_members_added_activity( - self, members_added: List[ChannelAccount], turn_context: TurnContext - ): - for member in members_added: - if member.id != turn_context.activity.recipient.id: - await turn_context.send_activity("Hello! Type 'help' to see what I can do.") - - async def on_message_activity(self, turn_context: TurnContext): - if turn_context.activity.type != ActivityTypes.message: - return - - text = (turn_context.activity.text or "").strip() - if is_empty(text): - await turn_context.send_activity("Please enter a message (try 'help').") - return - - cmd = normalize(text) - - if cmd in {"help", "capabilities"}: - await turn_context.send_activity(_help_text()) - return - - if cmd.startswith("reverse "): - original = text.split(" ", 1)[1] if " " in text else "" - await turn_context.send_activity(reverse_text(original)) - return - - # ChatBot fallback (provider-agnostic sentiment/reply) - try: - result = self._chatbot.reply(text) - await turn_context.send_activity(_format_sentiment(result)) - except Exception: - await turn_context.send_activity(f"You said: {text}") diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/agenticcore_frontend.html b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/agenticcore_frontend.html deleted file mode 100644 index 39d63a7bc4a2daada334e8d2d64577f9e7078882..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/agenticcore_frontend.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - AgenticCore Chatbot Frontend - - - -
-
-

AgenticCore Chatbot Frontend

-
Frontend → FastAPI → providers_unified
-
- -
-
-
- -
- - -
-
Not checked
-
-
- -
- - -
-
- - - -
-
-
-
-
- -
- Use with your FastAPI backend at /chatbot/message. Configure CORS if you serve this file from a different origin. -
-
- - - - diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/chat_console.html b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/chat_console.html deleted file mode 100644 index c2cf2ca34021674756a9e61906fe6b8f75948724..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/chat_console.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Console Chat Tester - - - - -

AgenticCore Console

- -
- - - - -
- -
- - -
- -
- Mode: - API -
- -

-
-
-
-
diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/chat_minimal.html b/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/chat_minimal.html
deleted file mode 100644
index 0b3fb325ece7bf9972b31d977e4aeee0e167c025..0000000000000000000000000000000000000000
--- a/storefront-chatbot_scaffold_merged/storefront-chatbot/legacy_src/full/frontend/chat_minimal.html
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-  
-  Minimal Chat Tester
-  
-  
-
-
-

Minimal Chat Tester → FastAPI /chatbot/message

- -
- - - - -
- -
- - -
- -

- - - - - diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/.env.sample b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/.env.sample deleted file mode 100644 index cc4d3812f29b8c9d0ebd71cb1d62d46b9d1f41c3..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/.env.sample +++ /dev/null @@ -1,7 +0,0 @@ -# Feature toggles -AZURE_ENABLED=false -SENTIMENT_ENABLED=false -DB_URL=memory:// -# Azure (optional) -AZURE_TEXT_ANALYTICS_ENDPOINT= -AZURE_TEXT_ANALYTICS_KEY= diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/Makefile b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/Makefile deleted file mode 100644 index 5f5636501fb59339863a6be7d0d116d21cb0bda8..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -.PHONY: dev test run seed check -dev: - pip install -r requirements.txt -test: - pytest -q -run: - export PYTHONPATH=. && python -c "from storefront_chatbot.app.app import build; build().launch(server_name='0.0.0.0', server_port=7860)" -seed: - python storefront_chatbot/scripts/seed_data.py -check: - python storefront_chatbot/scripts/check_compliance.py diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/README.md b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/README.md deleted file mode 100644 index ff8da746f63798ed65a18326962f9139347b2e0e..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Storefront Chatbot - -This repo follows a modular layout with a Gradio UI, NLU pipeline, anonymous and logged-in flows, -guardrails, and optional Azure sentiment. - -## Quickstart -```bash -make dev -make run -# open http://localhost:7860 -``` diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/anon_bot/handler.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/anon_bot/handler.py deleted file mode 100644 index 04907a388c5f485a55f941252f09fe9af3504faa..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/anon_bot/handler.py +++ /dev/null @@ -1 +0,0 @@ -def handle_turn(m,h,u): return (h or [])+[[m,'hi']] diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/anon_bot/rules.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/anon_bot/rules.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/app/app.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/app/app.py deleted file mode 100644 index eb54bf07d1c4b27a80245c48c356f390985d0758..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/app/app.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python3 -# app.py — aiohttp + Bot Framework Echo bot - -import os -import sys -import json -from logic import handle_text -from aiohttp import web -from botbuilder.core import BotFrameworkAdapter, BotFrameworkAdapterSettings, TurnContext -from botbuilder.schema import Activity -import aiohttp_cors -from pathlib import Path - - -# ------------------------------------------------------------------- -# Your bot implementation -# ------------------------------------------------------------------- -# Make sure this exists at packages/bots/echo_bot.py -# from bots.echo_bot import EchoBot -# Minimal inline fallback if you want to test quickly: -class EchoBot: - async def on_turn(self, turn_context: TurnContext): - if turn_context.activity.type == "message": - text = (turn_context.activity.text or "").strip() - if not text: - await turn_context.send_activity("Input was empty. Type 'help' for usage.") - return - - lower = text.lower() - if lower == "help": - await turn_context.send_activity("Try: echo | reverse: | capabilities") - elif lower == "capabilities": - await turn_context.send_activity("- echo\n- reverse\n- help\n- capabilities") - elif lower.startswith("reverse:"): - payload = text.split(":", 1)[1].strip() - await turn_context.send_activity(payload[::-1]) - elif lower.startswith("echo "): - await turn_context.send_activity(text[5:]) - else: - await turn_context.send_activity("Unsupported command. Type 'help' for examples.") - else: - await turn_context.send_activity(f"[{turn_context.activity.type}] event received.") - -# ------------------------------------------------------------------- -# Adapter / bot setup -# ------------------------------------------------------------------- -APP_ID = os.environ.get("MicrosoftAppId") or None -APP_PASSWORD = os.environ.get("MicrosoftAppPassword") or None - -adapter_settings = BotFrameworkAdapterSettings(APP_ID, APP_PASSWORD) -adapter = BotFrameworkAdapter(adapter_settings) - -async def on_error(context: TurnContext, error: Exception): - print(f"[on_turn_error] {error}", file=sys.stderr, flush=True) - try: - await context.send_activity("Oops. Something went wrong!") - except Exception as send_err: - print(f"[on_turn_error][send_activity_failed] {send_err}", file=sys.stderr, flush=True) - -adapter.on_turn_error = on_error -bot = EchoBot() - -# ------------------------------------------------------------------- -# HTTP handlers -# ------------------------------------------------------------------- -async def messages(req: web.Request) -> web.Response: - # Content-Type can include charset; do a contains check - ctype = (req.headers.get("Content-Type") or "").lower() - if "application/json" not in ctype: - return web.Response(status=415, text="Unsupported Media Type: expected application/json") - - try: - body = await req.json() - except json.JSONDecodeError: - return web.Response(status=400, text="Invalid JSON body") - - activity = Activity().deserialize(body) - auth_header = req.headers.get("Authorization") - - invoke_response = await adapter.process_activity(activity, auth_header, bot.on_turn) - if invoke_response: - # For invoke activities, adapter returns explicit status/body - return web.json_response(data=invoke_response.body, status=invoke_response.status) - # Acknowledge standard message activities - return web.Response(status=202, text="Accepted") - -async def home(_req: web.Request) -> web.Response: - return web.Response( - text="Bot is running. POST Bot Framework activities to /api/messages.", - content_type="text/plain" - ) - -async def messages_get(_req: web.Request) -> web.Response: - return web.Response( - text="This endpoint only accepts POST (Bot Framework activities).", - content_type="text/plain", - status=405 - ) - -async def healthz(_req: web.Request) -> web.Response: - return web.json_response({"status": "ok"}) - -async def plain_chat(req: web.Request) -> web.Response: - try: - payload = await req.json() - except Exception: - return web.json_response({"error": "Invalid JSON"}, status=400) - user_text = payload.get("text", "") - reply = handle_text(user_text) - return web.json_response({"reply": reply}) - -# ------------------------------------------------------------------- -# App factory and entrypoint -# ------------------------------------------------------------------- -from pathlib import Path - -def create_app() -> web.Application: - app = web.Application() - app.router.add_get("/", home) - app.router.add_get("/healthz", healthz) - app.router.add_get("/api/messages", messages_get) - app.router.add_post("/api/messages", messages) - app.router.add_post("/plain-chat", plain_chat) - - static_dir = Path(__file__).parent / "static" - if static_dir.exists(): - app.router.add_static("/static/", path=static_dir, show_index=True) - else: - print(f"[warn] static directory not found: {static_dir}", flush=True) - - return app - -app = create_app() - -if __name__ == "__main__": - host = os.environ.get("HOST", "127.0.0.1") # use 0.0.0.0 in containers - port = int(os.environ.get("PORT", 3978)) - web.run_app(app, host=host, port=port) diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/app/routes.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/app/routes.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/core/config.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/core/config.py deleted file mode 100644 index 77f363b6df321c56f03a2a76166a1dd71ea68958..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/core/config.py +++ /dev/null @@ -1,2 +0,0 @@ -class Settings: pass -settings = Settings() diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/core/logging.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/core/logging.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/core/types.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/core/types.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/architecture.md b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/architecture.md deleted file mode 100644 index 931999fd4baec8ab8f5d524ad3ddd123e278ebb4..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/architecture.md +++ /dev/null @@ -1 +0,0 @@ -# Architecture\n\nShort explainer tied to the flowchart.\n \ No newline at end of file diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/design.md b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/design.md deleted file mode 100644 index 257007bc4a973df95b8c0853985ad077a3070ddb..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/design.md +++ /dev/null @@ -1 +0,0 @@ -# Design notes\n\nAPI notes, security, tradeoffs.\n \ No newline at end of file diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/flowchart.png b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/flowchart.png deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/results.md b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/results.md deleted file mode 100644 index 497ecabbd2021246019ae3d643d48dde8c930f94..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/docs/results.md +++ /dev/null @@ -1 +0,0 @@ -# Results\n\nChallenges, metrics, screenshots.\n \ No newline at end of file diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/guardrails/pii_redaction.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/guardrails/pii_redaction.py deleted file mode 100644 index 09bbfdc84ce7ad778bb4c128a6ed3d6c4b2185f5..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/guardrails/pii_redaction.py +++ /dev/null @@ -1 +0,0 @@ -def redact(t): return t diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/guardrails/safety.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/guardrails/safety.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/integrations/azure/bot_framework.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/integrations/azure/bot_framework.py deleted file mode 100644 index 444dc91cc163307b248b4e821adc1ea47b9116f0..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/integrations/azure/bot_framework.py +++ /dev/null @@ -1 +0,0 @@ -# Azure Bot Framework (placeholder) diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/integrations/email/ticket_stub.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/integrations/email/ticket_stub.py deleted file mode 100644 index 0c28e0c8155d74be301d68aa2d7909cf5282a4c2..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/integrations/email/ticket_stub.py +++ /dev/null @@ -1 +0,0 @@ -# Email ticket stub (placeholder) diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/logged_in_bot/handler.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/logged_in_bot/handler.py deleted file mode 100644 index 42488cd43c647dfd7f1ff6189fb4ad008d21f18f..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/logged_in_bot/handler.py +++ /dev/null @@ -1,17 +0,0 @@ -from agenticcore.chatbot.services import ChatBot - -_bot = ChatBot() - -def handle_turn(message, history, user): - history = history or [] - try: - res = _bot.reply(message) - reply = res.get("reply") or "Noted." - label = res.get("sentiment") - conf = res.get("confidence") - if label is not None and conf is not None: - reply = f"{reply} (sentiment: {label}, confidence: {float(conf):.2f})" - except Exception as e: - reply = f"Sorry—error in ChatBot: {type(e).__name__}. Using fallback." - history = history + [[message, reply]] - return history diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/logged_in_bot/sentiment_azure.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/logged_in_bot/sentiment_azure.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/logged_in_bot/tools.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/logged_in_bot/tools.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/memory/rag/indexer.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/memory/rag/indexer.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/memory/rag/retriever.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/memory/rag/retriever.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/memory/sessions.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/memory/sessions.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/memory/store.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/memory/store.py deleted file mode 100644 index f1f8fc1367351ebdb6f66e0ae63170d72ab49c3d..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/memory/store.py +++ /dev/null @@ -1 +0,0 @@ -DB={} diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/nlu/pipeline.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/nlu/pipeline.py deleted file mode 100644 index bf3d76e8b4e2f3dd602d4019f2127f53bc461ab0..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/nlu/pipeline.py +++ /dev/null @@ -1 +0,0 @@ -def analyze(t): return {'intent':'general'} diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/nlu/prompts.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/nlu/prompts.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/nlu/router.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/nlu/router.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/pyproject.toml b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/pyproject.toml deleted file mode 100644 index 28f8b61d577755d6ba78475f57c78169f27ad6d3..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/pyproject.toml +++ /dev/null @@ -1,9 +0,0 @@ -[tool.black] -line-length = 100 -target-version = ["py310"] - -[tool.isort] -profile = "black" - -[tool.pytest.ini_options] -addopts = "-q" diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/requirements.txt b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/requirements.txt deleted file mode 100644 index caf3e0a6b2da6d44b32e077675eae58dfacbf6c4..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -gradio>=4.0 -transformers>=4.41.0 -torch>=2.2.0 -scikit-learn>=1.3.0 -pandas>=2.1.0 -numpy>=1.26.0 -pytest>=7.4.0 -# Optional Azure -azure-ai-textanalytics>=5.3.0 diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/scripts/check_compliance.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/scripts/check_compliance.py deleted file mode 100644 index 783aad1e3e269c5e1b3f64b395dc980a60b6e76c..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/scripts/check_compliance.py +++ /dev/null @@ -1 +0,0 @@ -# Fails if disallowed deps appear (placeholder) diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/scripts/run_local.sh b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/scripts/run_local.sh deleted file mode 100644 index 1574d429e034e078de6319b6c0c7e4f7cd513a8c..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/scripts/run_local.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -export PYTHONPATH=. -python -c "from storefront_chatbot.app.app import build; build().launch(server_name='0.0.0.0', server_port=7860)" diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/scripts/seed_data.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/scripts/seed_data.py deleted file mode 100644 index 7182ae7271ee5dda3ed7e67799b408766c77c377..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/scripts/seed_data.py +++ /dev/null @@ -1 +0,0 @@ -# Load sample products/FAQs (placeholder) diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_anon_bot.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_anon_bot.py deleted file mode 100644 index 9f9192473f115338b5490683f0ac7169338d4f96..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_anon_bot.py +++ /dev/null @@ -1 +0,0 @@ -def test_anon_stub(): assert True diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_guardrails.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_guardrails.py deleted file mode 100644 index 846d874cdede0615ea40741d3283c5107d509e81..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_guardrails.py +++ /dev/null @@ -1 +0,0 @@ -def test_guardrails_stub(): assert True diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_logged_in_bot.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_logged_in_bot.py deleted file mode 100644 index 7c5df721836277c95479ae5780a569bfe795a78e..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_logged_in_bot.py +++ /dev/null @@ -1 +0,0 @@ -def test_logged_stub(): assert True diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_memory.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_memory.py deleted file mode 100644 index f6dca01a4a4125febb46974b9a0500801001cd2d..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_memory.py +++ /dev/null @@ -1 +0,0 @@ -def test_memory_stub(): assert True diff --git a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_nlu.py b/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_nlu.py deleted file mode 100644 index da354911445cbb8dcb9705b6c31ac0bb9e988dad..0000000000000000000000000000000000000000 --- a/storefront-chatbot_scaffold_merged/storefront-chatbot/storefront_chatbot/tests/test_nlu.py +++ /dev/null @@ -1 +0,0 @@ -def test_nlu_stub(): assert True diff --git a/tests/test_guardrails.py b/tests/test_guardrails.py index f4294c3c2697e495e4497e8359c6409de21b0704..846d874cdede0615ea40741d3283c5107d509e81 100644 --- a/tests/test_guardrails.py +++ b/tests/test_guardrails.py @@ -1 +1 @@ -# /test/test_guardrails.py +def test_guardrails_stub(): assert True