Spaces:
Sleeping
Sleeping
AI Assistant
feat: add support for Gemini API and implement state management for quiz turns and answers
b85377a Download app/main.py from amer003100/securityChatbot: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/spaces/amer003100/securityChatbot/resolve/main/app/main.py
- Command line
-
hf download hf://spaces/amer003100/securityChatbot/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/amer003100/securityChatbot/resolve/main/app/main.py
2.01 kB
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from app.routers import webhook | |
| app_description = """ | |
| **منصة شات بوت التوعية الأمنية (Security Awareness Chatbot)** | |
| هذا الـ API يقدم تجربة تفاعلية باللغة العربية (اللهجة المصرية) لتدريب المستخدمين على الأمن السيبراني. | |
| ### 🚀 المميزات الرئيسية: | |
| 1. **المساعد الذكي العادي:** التحدث مع خبير أمن معلومات للرد على أسئلتك بأسلوب مبسط. | |
| 2. **محاكاة الاختراق (Simulation):** تجربة عملية للتدريب على اكتشاف هجمات الهندسة الاجتماعية. يمكنك اختيار سيناريو (بنك، شحن، دعم فني، إلخ) ومستوى صعوبة (سهل، متوسط، صعب). الذكاء الاصطناعي سيلعب دور المهاجم، وسيقوم نموذج آخر بتقييم ردودك! | |
| 3. **اختبار المعلومات (Quiz):** تحدي سريع في شكل سؤال اختيارات (MCQ) لاختبار معلوماتك في مجالات الأمن السيبراني المختلفة. | |
| **للبدء، أرسل `/train` في رسالة للمسار `/webhook`.** | |
| """ | |
| app = FastAPI( | |
| title="Security Awareness Chatbot API 🛡️", | |
| description=app_description, | |
| version="1.1.0" | |
| ) | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| app.include_router(webhook.router) | |
| def read_root(): | |
| return { | |
| "status": "active", | |
| "message": "مرحباً بك في الخادم الخاص بشات بوت التوعية الأمنية. النظام يعمل بكفاءة.", | |
| "documentation_url": "/docs", | |
| "usage_instruction": "أرسل طلبات POST إلى المسار /webhook لبدء المحادثة والتدريب." | |
| } |