-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
803 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DJANGO_SECRET_KEY=your_django_secret_key_here | ||
DEBUG=False | ||
ALLOWED_HOSTS=localhost,127.0.0.1 | ||
ALIEXPRESS_APP_KEY=your_aliexpress_app_key_here | ||
ALIEXPRESS_APP_SECRET=your_aliexpress_app_secret_here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[user] | ||
name = CrazYH@xs | ||
email = worlddre3mer1991.proton.nu | ||
email = worlddre3mer1991@proton.nu | ||
[safe] | ||
directory = /home/user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# This workflow integrates njsscan with GitHub's Code Scanning feature | ||
# nodejsscan is a static security code scanner that finds insecure code patterns in your Node.js applications | ||
|
||
name: njsscan sarif | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "main" ] | ||
schedule: | ||
- cron: '31 0 * * 5' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
njsscan: | ||
permissions: | ||
contents: read # for actions/checkout to fetch code | ||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | ||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | ||
runs-on: ubuntu-latest | ||
name: njsscan code scanning | ||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v4 | ||
- name: nodejsscan scan | ||
id: njsscan | ||
uses: ajinabraham/njsscan-action@7237412fdd36af517e2745077cedbf9d6900d711 | ||
with: | ||
args: '. --sarif --output results.sarif || true' | ||
- name: Upload njsscan report | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: results.sarif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,95 @@ | ||
# Dropship V2 | ||
|
||
Dropship V2 is an e-commerce application built with Django. | ||
|
||
## Prerequisites | ||
Dropship V2 is an automated dropshipping application that integrates with AliExpress and includes an AI-assisted Helpdesk. | ||
|
||
- Docker | ||
- Docker Compose | ||
## Features | ||
|
||
## Getting Started | ||
- Automatic product syncing with AliExpress | ||
- User registration and authentication | ||
- Shopping cart functionality | ||
- Automated order processing | ||
- Admin dashboard for managing orders and sales | ||
- AI-assisted Helpdesk for customer support | ||
|
||
1. Clone the repository: | ||
``` | ||
git clone https://github.com/CrzyHAX91/dropshipv2.git | ||
cd dropshipv2 | ||
``` | ||
## Installation and Setup | ||
|
||
2. Run the start script: | ||
``` | ||
./start.sh | ||
``` | ||
|
||
3. Access the application at http://localhost:8000 | ||
## Installation and Setup Instructions To install and set up Dropship V2, follow these steps: | ||
[Your existing installation and setup instructions] | ||
|
||
## Features | ||
## AI Helpdesk | ||
|
||
The AI Helpdesk provides automated customer support. To access the helpdesk, navigate to the '/helpdesk/' URL after starting the application. | ||
|
||
Note: The current implementation is a placeholder. To fully implement the AI functionality, update the helpdesk_api view in views.py. | ||
|
||
- Product catalog | ||
- Shopping cart | ||
- User authentication | ||
- Order management | ||
## Running the Application | ||
|
||
[Your existing instructions for running the application] | ||
|
||
## Admin Access | ||
|
||
To access the admin panel: | ||
To access the admin dashboard, navigate to the '/admin/' URL after starting the application. Use the | ||
|
||
[Your existing admin access instructions] | ||
|
||
1. Create a superuser: `python manage.py createsuperuser` | ||
2. Access the admin dashboard: `http://localhost:8000/admin/` | ||
|
||
## Security and Automation | ||
|
||
[Your existing security and automation details] | ||
- The application uses SSL encryption for secure data transmission | ||
- Automated backups are performed daily using a cron job | ||
- The application is deployed on a cloud platform for scalability and reliability | ||
|
||
|
||
## Future Improvements | ||
|
||
- Implement actual AI model integration for the helpdesk | ||
- Add conversation history storage for the helpdesk | ||
- Develop admin controls for managing the helpdesk | ||
|
||
|
||
- Integrate with real customer data for more accurate personalization | ||
- Improve the user interface for better user experience | ||
- Implement more advanced automation features for order processing and inventory management | ||
- Integrate with other e-commerce platforms for expanded market reach | ||
- Develop a mobile application for on-the-go access | ||
- Implement a loyalty program for repeat customers | ||
- Integrate with social media platforms for enhanced marketing | ||
- Implement a customer review system | ||
## AI-Assisted Helpdesk | ||
|
||
We've implemented an AI-assisted helpdesk to improve customer support. Key features include: | ||
|
||
1. Go to http://localhost:8000/admin | ||
2. Login with the following credentials: | ||
- Username: admin | ||
- Password: adminpassword | ||
- Natural language processing for understanding customer queries | ||
- Personalized responses based on user profiles | ||
- Sentiment analysis to detect customer frustration | ||
- Multi-turn conversation handling | ||
- Feedback system for continuous improvement | ||
|
||
## Running Tests | ||
To use the AI Helpdesk, run the `ai_helpdesk.py` script and interact with the prompts. | ||
|
||
To run the tests, use the following command: | ||
``` | ||
docker-compose exec web python dropship_project/manage.py test | ||
``` | ||
Future improvements: | ||
- Integration with the main dropshipping application | ||
- Expansion of the knowledge base | ||
- Implementation of more advanced NLP techniques | ||
- Connection to real customer data for more accurate personalization | ||
- Development of a user interface for the AI Helpdesk | ||
- Integration with other customer support channels | ||
- Development of a feedback system for continuous improvement | ||
- Implementation of a knowledge base for storing and retrieving customer information | ||
- Development of a sentiment analysis system for detecting customer frustration | ||
- Implementation of a multi-turn conversation handling system | ||
- Development of a feedback system for continuous improvement | ||
- Integration with other e-commerce platforms for expanded market reach | ||
- Development of a mobile application for on-the-go access | ||
- Implementation of a loyalty program for repeat customers | ||
- Integration with social media platforms for enhanced marketing | ||
## Contact | ||
|
||
## Stopping the Application | ||
If you have any questions or feedback, please contact us at [[email protected]]. We would love to hear from you!import logging | ||
|
||
To stop the application, run: | ||
``` | ||
docker-compose down | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import re | ||
from fuzzywuzzy import fuzz | ||
import random | ||
from textblob import TextBlob | ||
|
||
class AdvancedAIHelpdesk: | ||
def __init__(self): | ||
self.context = [] | ||
self.feedback_scores = [] | ||
self.user_profiles = {} | ||
self.knowledge_base = self.load_knowledge_base() | ||
|
||
def load_knowledge_base(self): | ||
# Placeholder for loading a more comprehensive knowledge base | ||
return { | ||
"track|tracking|find|locate order": "To track your order, please follow these steps:\n1. Log in to your account on our website.\n2. Go to the 'Order History' section.\n3. Find your order and click on 'Track Order'.\n4. You'll see the current status and estimated delivery date of your order.", | ||
"delay|delayed|late order": "If your order is delayed, please follow these steps:\n1. Check your order status on our website.\n2. If it's been more than 7 days past the estimated delivery date, please contact our customer support team.\n3. Provide your order number when contacting us for faster assistance.", | ||
"cancel|cancellation|stop order": "To cancel your order:\n1. Log in to your account on our website.\n2. Go to 'Order History' and find the order you want to cancel.\n3. If the order hasn't been shipped yet, you should see a 'Cancel Order' button.\n4. Click the button and confirm the cancellation.\n5. If you don't see the cancel button, the order may have already been shipped. In this case, please contact our customer support team for assistance.", | ||
"return policy|returns|refund": "Our return policy allows returns within 30 days of receiving your order. Please ensure the item is unused and in its original packaging. To initiate a return, log in to your account and go to the 'Returns' section.", | ||
"shipping time|delivery time|how long|when will I receive": "Shipping times vary depending on your location and the shipping method chosen. Typically, orders are processed within 1-2 business days, and shipping can take 3-7 business days for standard shipping, or 1-3 business days for express shipping.", | ||
"international shipping|ship to other countries": "Yes, we offer international shipping to many countries. Shipping costs and delivery times may vary depending on the destination. Please check our shipping information page or contact customer support for specific details about shipping to your country.", | ||
"payment methods|how to pay": "We accept various payment methods including credit/debit cards (Visa, MasterCard, American Express), PayPal, and Apple Pay. You can select your preferred payment method during checkout.", | ||
"size guide|sizing": "You can find our size guide on the product page of each item. Click on the 'Size Guide' link to view detailed measurements and find the best fit for you.", | ||
"product availability|in stock": "Product availability is shown on each item's page. If an item is out of stock, you can sign up for email notifications to be alerted when it's back in stock.", | ||
"discount|coupon|promo code": "To use a discount or promo code, enter it in the designated field during checkout. Make sure to check the terms and conditions of the coupon, as some may have restrictions or expiration dates." | ||
} | ||
|
||
def generate_response(self, prompt, user_id): | ||
prompt_lower = prompt.lower() | ||
best_match = None | ||
best_score = 0 | ||
|
||
for key, response in self.knowledge_base.items(): | ||
for k in key.split('|'): | ||
score = fuzz.partial_ratio(k, prompt_lower) | ||
if score > best_score: | ||
best_score = score | ||
best_match = response | ||
|
||
if best_score >= 80: | ||
self.context.append(prompt) | ||
response = self.personalize_response(best_match, user_id) | ||
follow_up = self.generate_follow_up(prompt_lower) | ||
return f"{response}\n\n{follow_up}" | ||
elif self.context: | ||
return self.handle_follow_up(prompt_lower, user_id) | ||
else: | ||
return "I apologize, but I don't have specific information about that. Would you like me to connect you with a human customer service representative?" | ||
|
||
def personalize_response(self, response, user_id): | ||
if user_id in self.user_profiles: | ||
if "shipping" in response.lower() and "location" in self.user_profiles[user_id]: | ||
response += f"\n\nBased on your location in {self.user_profiles[user_id]['location']}, shipping might take an additional 1-2 days." | ||
return response | ||
|
||
def generate_follow_up(self, prompt): | ||
if "track" in prompt: | ||
return "Would you like to know about our shipping times as well?" | ||
elif "return" in prompt: | ||
return "Do you need any information about our refund process?" | ||
elif "shipping" in prompt: | ||
return "Would you like to know about our international shipping options?" | ||
else: | ||
return "Is there anything else I can help you with?" | ||
|
||
def handle_follow_up(self, prompt, user_id): | ||
prev_context = self.context[-1].lower() | ||
if "track" in prev_context and "shipping" in prompt: | ||
return self.personalize_response(self.knowledge_base["shipping time|delivery time|how long|when will I receive"], user_id) | ||
elif "return" in prev_context and "refund" in prompt: | ||
return "Refunds are typically processed within 5-10 business days after we receive the returned item. The refund will be issued to the original payment method." | ||
else: | ||
return f"Regarding your previous question about '{prev_context}', could you please provide more specific information about what you'd like to know?" | ||
|
||
def get_feedback(self): | ||
score = random.randint(1, 5) # Simulating user feedback | ||
self.feedback_scores.append(score) | ||
return score | ||
|
||
def average_feedback(self): | ||
if self.feedback_scores: | ||
return sum(self.feedback_scores) / len(self.feedback_scores) | ||
return 0 | ||
|
||
def analyze_sentiment(self, prompt): | ||
analysis = TextBlob(prompt) | ||
if analysis.sentiment.polarity < -0.3: # Lowered threshold | ||
return "I apologize for any inconvenience. Would you like me to connect you with a human customer service representative?" | ||
return None | ||
|
||
def set_user_profile(self, user_id, profile): | ||
self.user_profiles[user_id] = profile | ||
|
||
# Usage example | ||
if __name__ == "__main__": | ||
helpdesk = AdvancedAIHelpdesk() | ||
helpdesk.set_user_profile("user123", {"location": "California"}) | ||
|
||
test_prompts = [ | ||
"How can I track my order?", | ||
"Yes, tell me about shipping times.", | ||
"What's your return policy?", | ||
"Yes, I need information about refunds.", | ||
"Do you offer international shipping?", | ||
"This is frustrating, I can't find my order!", | ||
"I'm not happy with the service.", | ||
] | ||
|
||
for prompt in test_prompts: | ||
sentiment_response = helpdesk.analyze_sentiment(prompt) | ||
if sentiment_response: | ||
print(f"Prompt: {prompt}") | ||
print(f"Response: {sentiment_response}") | ||
else: | ||
response = helpdesk.generate_response(prompt, "user123") | ||
print(f"Prompt: {prompt}") | ||
print(f"Response: {response}") | ||
feedback = helpdesk.get_feedback() | ||
print(f"Feedback score: {feedback}") | ||
print("-" * 50) | ||
|
||
print(f"Average feedback score: {helpdesk.average_feedback():.2f}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import logging | ||
import re | ||
from rapidfuzz import fuzz | ||
from textblob import TextBlob | ||
|
||
# Configure logging | ||
logging.basicConfig( | ||
filename="advanced_helpdesk.log", | ||
level=logging.INFO, | ||
format="%(asctime)s - %(levelname)s - %(message)s" | ||
) | ||
|
||
class AdvancedAIHelpdesk: | ||
def __init__(self): | ||
self.context = {} | ||
self.feedback_scores = [] | ||
self.user_profiles = {} | ||
self.knowledge_base = self.load_knowledge_base() | ||
|
||
def load_knowledge_base(self): | ||
"""Load a predefined knowledge base with regex-like keys.""" | ||
return { | ||
r"track|tracking|find|locate order": "To track your order, please follow these steps:\n1. Log in to your account on our website.\n2. Go to the 'Order History' section.\n3. Find your order and click on 'Track Order'.\n4. You'll see the current status and estimated delivery date of your order.", | ||
r"delay|delayed|late order": "If your order is delayed, please follow these steps:\n1. Check your order status on our website.\n2. If it's been more than 7 days past the estimated delivery date, please contact our customer support team.\n3. Provide your order number when contacting us for faster assistance.", | ||
r"cancel|cancellation|stop order": "To cancel your order:\n1. Log in to your account on our website.\n2. Go to 'Order History' and find the order you want to cancel.\n3. If the order hasn't been shipped yet, you should see a 'Cancel Order' button.\n4. Click the button and confirm the cancellation.\n5. If you don't see the cancel button, the order may have already been shipped. In this case, please contact our customer support team for assistance.", | ||
r"return policy|returns|refund": "Our return policy allows returns within 30 days of receiving your order. Please ensure the item is unused and in its original packaging. To initiate a return, log in to your account and go to the 'Returns' section.", | ||
r"shipping time|delivery time|how long|when will I receive": "Shipping times vary depending on your location and the shipping method chosen. Typically, orders are processed within 1-2 business days, and shipping can take 3-7 business days for standard shipping, or 1-3 business days for express shipping.", | ||
r"international shipping|ship to other countries": "Yes, we offer international shipping to many countries. Shipping costs and delivery times may vary depending on the destination. Please check our shipping information page or contact customer support for specific details about shipping to your country.", | ||
r"payment methods|how to pay": "We accept various payment methods including credit/debit cards (Visa, MasterCard, American Express), PayPal, and Apple Pay. You can select your preferred payment method during checkout.", | ||
r"size guide|sizing": "You can find our size guide on the product page of each item. Click on the 'Size Guide' link to view detailed measurements and find the best fit for you.", | ||
r"product availability|in stock": "Product availability is shown on each item's page. If an item is out of stock, you can sign up for email notifications to be alerted when it's back in stock.", | ||
r"discount|coupon|promo code": "To use a discount or promo code, enter it in the designated field during checkout. Make sure to check the terms and conditions of the coupon, as some may have restrictions or expiration dates." | ||
} | ||
|
||
def generate_response(self, prompt, user_id): | ||
"""Generate a response based on the user's query.""" | ||
prompt_lower = prompt.lower() | ||
best_match = None | ||
best_score = 0 | ||
|
||
for pattern, response in self.knowledge_base.items(): | ||
if re.search(pattern, prompt_lower): | ||
score = fuzz |
Oops, something went wrong.