unknown commited on
Commit ·
dfe8bb9
1
Parent(s): fe25cf6
argerg
Browse files- .env +4 -0
- dataset.txt +34 -0
- main.py +118 -0
- requirements.txt +4 -0
- responses.py +75 -0
- templates/index.html +28 -0
.env
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
DISCORD_TOKEN = 'MTE0NTc2OTMyNTI0MDc5NTE3Ng.GGG0tY.SAugPoB5baaIYwycmqJEr8J22yy1FWDycY0m9E'
|
| 2 |
+
OPENAI_API_KEY = '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'
|
| 3 |
+
|
| 4 |
+
#DISCORD_TOKEN = "MTIxMTM0Nzk3NjY2MDk3OTgyNA.GW3pLu.3qscRmjydb8VQV4V8gmKDE56qyg5yObN5lLR5E"
|
dataset.txt
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
How To Start An SMMA With $0 :- https://www.youtube.com/watch?v=KpJW8yyxNk0
|
| 2 |
+
|
| 3 |
+
Guide to build a SMMA:
|
| 4 |
+
|
| 5 |
+
Phase 1: Foundation and Setup (0-$10,000/month)
|
| 6 |
+
Niche Selection: Choose a niche or industry you're passionate about or have experience in. It's easier to sell your services when you understand the industry's pain points.
|
| 7 |
+
Service Offering: Decide on the services you'll offer (e.g., content creation, paid advertising, social media management).
|
| 8 |
+
Business Setup: Register your business, set up a professional website, and create social media profiles for your agency.
|
| 9 |
+
Pricing Strategy: Develop pricing packages that are competitive yet profitable.
|
| 10 |
+
Lead Generation: Start with free methods like cold emailing, networking, and social media outreach to get your first clients.
|
| 11 |
+
Portfolio Building: Offer discounted services or work for free in exchange for testimonials and case studies.
|
| 12 |
+
|
| 13 |
+
Phase 2: Growth and Scaling ($10,000-$100,000/month)
|
| 14 |
+
Paid Advertising: Invest in paid advertising (Facebook ads, Google ads) to reach a larger audience and generate leads.
|
| 15 |
+
Hiring: Start building a team to delegate tasks and focus on growing the business. Hire for roles like account manager, content creator, and ads specialist.
|
| 16 |
+
Systems and Processes: Implement systems and processes to streamline operations and ensure consistency in service delivery.
|
| 17 |
+
Client Retention: Focus on delivering excellent results and maintaining strong relationships with clients to ensure recurring revenue.
|
| 18 |
+
Referrals and Partnerships: Encourage satisfied clients to refer others and explore partnerships with complementary businesses.
|
| 19 |
+
|
| 20 |
+
Phase 3: Scaling to $1 Million/Month
|
| 21 |
+
Expansion: Consider expanding your service offerings or entering new markets to increase revenue streams.
|
| 22 |
+
Automation: Invest in automation tools to increase efficiency and reduce manual work.
|
| 23 |
+
Advanced Marketing Strategies: Utilize advanced marketing strategies like SEO, influencer marketing, and content marketing to attract high-ticket clients.
|
| 24 |
+
Sales Team: Build a dedicated sales team to handle lead generation and client acquisition.
|
| 25 |
+
Strategic Investments: Reinvest profits into the business for growth, such as hiring top talent, upgrading technology, and expanding marketing efforts.
|
| 26 |
+
|
| 27 |
+
Key Tips for Success:
|
| 28 |
+
|
| 29 |
+
Focus on Results: Always prioritize delivering measurable results for your clients.
|
| 30 |
+
Continuous Learning: Stay updated with the latest trends and best practices in social media marketing.
|
| 31 |
+
Networking: Build relationships with other agency owners, marketers, and industry prof essionals.
|
| 32 |
+
Client Communication: Maintain clear and transparent communication with your clients.
|
| 33 |
+
Adaptability: Be prepared to adapt your strategies and offerings based on market changes and client feedback.
|
| 34 |
+
Remember, scaling to $1 million a month requires dedication, hard work, and a focus on continuous improvement. It's not an overnight success, but with the right strategies and mindset, it's definitely achievable.
|
main.py
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import discord
|
| 2 |
+
from discord.ext import commands
|
| 3 |
+
from dotenv import load_dotenv, find_dotenv
|
| 4 |
+
import os
|
| 5 |
+
from langchain.prompts import SystemMessagePromptTemplate, PromptTemplate
|
| 6 |
+
from langchain.text_splitter import CharacterTextSplitter
|
| 7 |
+
from langchain.vectorstores import Chroma
|
| 8 |
+
from langchain.embeddings import OpenAIEmbeddings
|
| 9 |
+
from langchain.chat_models import ChatOpenAI
|
| 10 |
+
from langchain.document_loaders import TextLoader
|
| 11 |
+
from langchain.schema import HumanMessage
|
| 12 |
+
import re
|
| 13 |
+
from youtube_transcript_api import YouTubeTranscriptApi
|
| 14 |
+
from googlesearch import search
|
| 15 |
+
|
| 16 |
+
load_dotenv(find_dotenv())
|
| 17 |
+
|
| 18 |
+
YOUTUBE_PATTERN = r'(https?://)?(www\.)?(youtube\.com|youtu\.be)/.+$'
|
| 19 |
+
VIDEO_ID_PATTERN = r"(?<=watch\?v=)[\w-]+|youtu\.be/([\w-]+)"
|
| 20 |
+
VIDEO_ID_PATTERNN = r"(?<=watch\?v=)[\w-]+|youtu.be/([\w-]+)"
|
| 21 |
+
|
| 22 |
+
pattern = r'(https?://)?(www\.)?(youtube\.com|youtu\.be)/.+$'
|
| 23 |
+
|
| 24 |
+
TOKEN = os.environ.get('DISCORD_TOKEN')
|
| 25 |
+
OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY')
|
| 26 |
+
|
| 27 |
+
loader = TextLoader('data.txt')
|
| 28 |
+
documents = loader.load()
|
| 29 |
+
text_splitter = CharacterTextSplitter(chunk_size=1500, chunk_overlap=100)
|
| 30 |
+
texts = text_splitter.split_documents(documents)
|
| 31 |
+
|
| 32 |
+
embeddings = OpenAIEmbeddings()
|
| 33 |
+
retriever = Chroma.from_documents(texts, embeddings).as_retriever()
|
| 34 |
+
chat = ChatOpenAI(temperature=0.1, model="gpt-4")
|
| 35 |
+
|
| 36 |
+
yt_summary_prompt_template = """You are a helpful AI model named Liam AI. Summarize the following YouTube video transcript into bullet points in the following manner (with fun emojis)
|
| 37 |
+
|
| 38 |
+
1. start-overview (about the video)
|
| 39 |
+
|
| 40 |
+
2. bullet point (main content of the video)
|
| 41 |
+
|
| 42 |
+
3. end overview (overview of the video)
|
| 43 |
+
|
| 44 |
+
{context}
|
| 45 |
+
|
| 46 |
+
Please provide a summarized list of bullet points in atleast 10 - 20 bullet points.
|
| 47 |
+
Answer:"""
|
| 48 |
+
|
| 49 |
+
# Create a PromptTemplate object
|
| 50 |
+
yt_summary_prompt = PromptTemplate(template=yt_summary_prompt_template,
|
| 51 |
+
input_variables=["context"])
|
| 52 |
+
|
| 53 |
+
prompt_template = """As an AI named Liam Evans AI, your purpose is to assist users with questions about AI automation agency. provide very most savage and funny responses with 1 or 2 emojis. If a user's question relates to any of the YouTube links in the dataset, you should suggest those links. However, if you cannot find a relevant link for a user's question, you should refrain from providing any link.
|
| 54 |
+
|
| 55 |
+
{context}
|
| 56 |
+
|
| 57 |
+
Do not recommend any youtube or external links until a user asks for it .
|
| 58 |
+
|
| 59 |
+
Please provide the most sense making responses
|
| 60 |
+
Answer:"""
|
| 61 |
+
|
| 62 |
+
prompt = PromptTemplate(template=prompt_template, input_variables=["context"])
|
| 63 |
+
system_message_prompt = SystemMessagePromptTemplate(prompt=prompt)
|
| 64 |
+
|
| 65 |
+
intents = discord.Intents.default()
|
| 66 |
+
intents.message_content = True
|
| 67 |
+
|
| 68 |
+
bot = commands.Bot(command_prefix='!', intents=intents)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
@bot.event
|
| 72 |
+
async def on_message(message):
|
| 73 |
+
if message.author == bot.user:
|
| 74 |
+
return
|
| 75 |
+
|
| 76 |
+
if bot.user.mentioned_in(message):
|
| 77 |
+
question = message.content.replace(bot.user.mention, '').strip()
|
| 78 |
+
|
| 79 |
+
# Check if the message starts with "search"
|
| 80 |
+
if question.startswith('search'):
|
| 81 |
+
query = question[7:] # Remove the "search " part
|
| 82 |
+
search_results = [
|
| 83 |
+
result.url for result in search(query, num_results=2, advanced=True)
|
| 84 |
+
]
|
| 85 |
+
response = "\n".join(search_results)
|
| 86 |
+
await message.channel.send(response)
|
| 87 |
+
elif re.match(YOUTUBE_PATTERN, question):
|
| 88 |
+
try:
|
| 89 |
+
video_id_match = re.search(VIDEO_ID_PATTERN, question)
|
| 90 |
+
if video_id_match:
|
| 91 |
+
video_id = video_id_match.group(0)
|
| 92 |
+
transcript = YouTubeTranscriptApi.get_transcript(video_id)
|
| 93 |
+
transcript_text = "\n".join([
|
| 94 |
+
entry['text'] for entry in transcript
|
| 95 |
+
])[:3000] # Truncate to fit within token limit
|
| 96 |
+
formatted_prompt = yt_summary_prompt.format(context=transcript_text)
|
| 97 |
+
messages = [HumanMessage(content=formatted_prompt)]
|
| 98 |
+
result = chat(messages)
|
| 99 |
+
await message.channel.send(result.content)
|
| 100 |
+
except Exception as e:
|
| 101 |
+
print(f"Error occurred: {e}")
|
| 102 |
+
await message.channel.send(
|
| 103 |
+
"Sorry, I was unable to process your request.")
|
| 104 |
+
else:
|
| 105 |
+
try:
|
| 106 |
+
docs = retriever.get_relevant_documents(query=question)
|
| 107 |
+
formatted_prompt = system_message_prompt.format(context=docs)
|
| 108 |
+
messages = [formatted_prompt, HumanMessage(content=question)]
|
| 109 |
+
result = chat(messages)
|
| 110 |
+
await message.channel.send(result.content)
|
| 111 |
+
except Exception as e:
|
| 112 |
+
print(f"Error occurred: {e}")
|
| 113 |
+
await message.channel.send(
|
| 114 |
+
"Sorry, I was unable to process your question.")
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
bot.run(TOKEN)
|
| 118 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
discord.py
|
| 2 |
+
langchain
|
| 3 |
+
openai
|
| 4 |
+
chromadb
|
responses.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import discord
|
| 2 |
+
from discord.ext import commands
|
| 3 |
+
from dotenv import load_dotenv, find_dotenv
|
| 4 |
+
import os
|
| 5 |
+
from langchain.prompts import SystemMessagePromptTemplate, PromptTemplate
|
| 6 |
+
from langchain.text_splitter import CharacterTextSplitter
|
| 7 |
+
from langchain.vectorstores import Chroma
|
| 8 |
+
from langchain.embeddings import OpenAIEmbeddings
|
| 9 |
+
from langchain.chat_models import ChatOpenAI
|
| 10 |
+
from langchain.document_loaders import TextLoader
|
| 11 |
+
from langchain.schema import HumanMessage
|
| 12 |
+
from flask import Flask, request, jsonify
|
| 13 |
+
app = Flask(__name__)
|
| 14 |
+
|
| 15 |
+
load_dotenv(find_dotenv())
|
| 16 |
+
|
| 17 |
+
TOKEN = os.environ.get('DISCORD_TOKEN')
|
| 18 |
+
|
| 19 |
+
loader = TextLoader("./dataset.txt")
|
| 20 |
+
documents = loader.load()
|
| 21 |
+
text_splitter = CharacterTextSplitter(chunk_size=1700, chunk_overlap=100)
|
| 22 |
+
texts = text_splitter.split_documents(documents)
|
| 23 |
+
|
| 24 |
+
embeddings = OpenAIEmbeddings()
|
| 25 |
+
retriever = Chroma.from_documents(texts, embeddings).as_retriever()
|
| 26 |
+
chat = ChatOpenAI(temperature=0.7)
|
| 27 |
+
|
| 28 |
+
prompt_template = """As an AI named Liam Evans AI, your purpose is to assist users with questions about AI automation agency. provide very most savage and funny responses with 1 or 2 emojis. If a user's question relates to any of the YouTube links in the dataset, you should suggest those links. However, if you cannot find a relevant link for a user's question, you should refrain from providing any link.
|
| 29 |
+
|
| 30 |
+
{context}
|
| 31 |
+
|
| 32 |
+
Do not recommend any youtube or external links until a user asks for it .
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
{context}
|
| 36 |
+
|
| 37 |
+
Answer:"""
|
| 38 |
+
|
| 39 |
+
prompt = PromptTemplate(
|
| 40 |
+
template=prompt_template, input_variables=["context"]
|
| 41 |
+
)
|
| 42 |
+
system_message_prompt = SystemMessagePromptTemplate(prompt=prompt)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
intents = discord.Intents.default()
|
| 46 |
+
intents.message_content = True
|
| 47 |
+
|
| 48 |
+
bot = commands.Bot(command_prefix='/', intents=intents)
|
| 49 |
+
|
| 50 |
+
from flask import Flask, request, jsonify, render_template
|
| 51 |
+
|
| 52 |
+
@app.route('/')
|
| 53 |
+
def home():
|
| 54 |
+
return render_template('index.html')
|
| 55 |
+
|
| 56 |
+
@bot.event
|
| 57 |
+
async def on_message(message):
|
| 58 |
+
if message.author == bot.user:
|
| 59 |
+
return
|
| 60 |
+
command_prefix='/'
|
| 61 |
+
if bot.user.mentioned_in(message):
|
| 62 |
+
question = message.content.replace(bot.user.mention, '').strip()
|
| 63 |
+
try:
|
| 64 |
+
docs = retriever.get_relevant_documents(query=question)
|
| 65 |
+
formatted_prompt = system_message_prompt.format(context=docs)
|
| 66 |
+
|
| 67 |
+
messages = [formatted_prompt, HumanMessage(content=question)]
|
| 68 |
+
result = chat(messages)
|
| 69 |
+
await message.channel.send(result.content)
|
| 70 |
+
except Exception as e:
|
| 71 |
+
print(f"Error occurred: {e}")
|
| 72 |
+
await message.channel.send("Sorry, I was unable to process your question.")
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
bot.run(TOKEN)
|
templates/index.html
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<style>
|
| 5 |
+
body {
|
| 6 |
+
background: #2196F3;
|
| 7 |
+
display: flex;
|
| 8 |
+
align-items: center;
|
| 9 |
+
justify-content: center;
|
| 10 |
+
height: 100vh;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
h1 {
|
| 14 |
+
font-size: 60px;
|
| 15 |
+
font-family: sans-serif;
|
| 16 |
+
font-weight: bold;
|
| 17 |
+
color: white;
|
| 18 |
+
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
</style>
|
| 22 |
+
</head>
|
| 23 |
+
<body>
|
| 24 |
+
|
| 25 |
+
<h1>Bot is Working!</h1>
|
| 26 |
+
|
| 27 |
+
</body>
|
| 28 |
+
</html>
|