Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# تنظیمات API Gemini
GEMINI_API_KEY=your_gemini_api_key_here

# تنظیمات اینستاگرام (اختیاری)
INSTAGRAM_ACCESS_TOKEN=your_instagram_access_token_here

# تنظیمات تلگرام (اختیاری)
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
TELEGRAM_CHAT_ID=your_telegram_chat_id_here

# تنظیمات سرور
HOST=0.0.0.0
PORT=8000
DEBUG=true
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM python:3.9-slim

# تنظیم متغیرهای محیطی
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

# نصب وابستگی‌های سیستم
RUN apt-get update && apt-get install -y \
gcc \
curl \
&& rm -rf /var/lib/apt/lists/*

# تنظیم دایرکتوری کاری
WORKDIR /app

# کپی فایل requirements
COPY requirements.txt .

# نصب وابستگی‌های Python
RUN pip install --no-cache-dir -r requirements.txt

# کپی کدهای پروژه
COPY . .

# ایجاد دایرکتوری‌های مورد نیاز
RUN mkdir -p logs data

# تغییر مجوزها
RUN chmod +x main.py

# پورت
EXPOSE 8000

# اجرای برنامه
CMD ["python", "main.py"]
306 changes: 251 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,271 @@
<header>
# 🚀 سیستم تولید محتوای هوش مصنوعی چندپلتفرمی

<!--
<<< Author notes: Course header >>>
Include a 1280×640 image, course title in sentence case, and a concise description in emphasis.
In your repository settings: enable template repository, add your 1280×640 social image, auto delete head branches.
Add your open source license, GitHub uses MIT license.
-->
یک سیستم پیشرفته تولید محتوا که با استفاده از **Gemini 2.5 Flash** و قابلیت **Function Calling**، محتوای بهینه برای چندین پلتفرم تولید می‌کند.

# GitHub Pages
## ✨ ویژگی‌های کلیدی

_Create a site or blog from your GitHub repositories with GitHub Pages._
- 🎯 **تولید محتوای چندپلتفرمی**: اینستاگرام، تلگرام، وب‌سایت، ایتا، روبیکا
- 🤖 **هوش مصنوعی پیشرفته**: استفاده از Gemini 2.5 Flash
- 🔧 **Function Calling**: پشتیبانی از فراخوانی توابع
- 📱 **بهینه‌سازی پلتفرم**: محتوای اختصاصی برای هر شبکه اجتماعی
- 🔍 **SEO بهینه**: بهینه‌سازی محتوای وب‌سایت
- 🎨 **پیشنهادات بصری**: ایده‌های تصویر و ویدئو
- ⏰ **زمان‌بندی خودکار**: انتشار خودکار محتوا
- 🌐 **API کامل**: RESTful API برای یکپارچه‌سازی

</header>
## 🏗️ معماری سیستم

<!--
<<< Author notes: Course start >>>
Include start button, a note about Actions minutes,
and tell the learner why they should take the course.
-->
```
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ FastAPI App │───▶│ Content Generator│───▶│ Gemini Client │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ API Manager │ │ Scheduler │ │ Function Call │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌──────────────────┐
│ Social Media │ │ Content DB │
│ APIs │ │ │
└─────────────────┘ └──────────────────┘
```

## Welcome
## 🚀 نصب و راه‌اندازی

With GitHub Pages, you can host project blogs, documentation, resumes, portfolios, or any other static content you'd like. Your GitHub repository can easily become its own website. In this course, we'll show you how to set up your own site or blog using GitHub Pages.
### پیش‌نیازها

- **Who is this for**: Beginners, students, project maintainers, small businesses.
- **What you'll learn**: How to build a GitHub Pages site.
- **What you'll build**: We'll build a simple GitHub Pages site with a blog. We'll use [Jekyll](https://jekyllrb.com), a static site generator.
- **Prerequisites**: If you need to learn about branches, commits, and pull requests, take [Introduction to GitHub](https://github.com/skills/introduction-to-github) first.
- **How long**: This course takes less than one hour to complete.
- Python 3.8+
- Gemini API Key
- pip

In this course, you will:
### نصب

1. Enable GitHub Pages
2. Configure your site
3. Customize your home page
4. Create a blog post
5. Merge your pull request
1. **کلون کردن مخزن**
```bash
git clone <repository-url>
cd ai-content-generator
```

### How to start this course
2. **نصب وابستگی‌ها**
```bash
pip install -r requirements.txt
```

<!-- For start course, run in JavaScript:
'https://github.com/new?' + new URLSearchParams({
template_owner: 'skills',
template_name: 'github-pages',
owner: '@me',
name: 'skills-github-pages',
description: 'My clone repository',
visibility: 'public',
}).toString()
-->
3. **تنظیم متغیرهای محیطی**
```bash
cp .env.example .env
# فایل .env را ویرایش کرده و API Key خود را اضافه کنید
```

[![start-course](https://user-images.githubusercontent.com/1221423/235727646-4a590299-ffe5-480d-8cd5-8194ea184546.svg)](https://github.com/new?template_owner=skills&template_name=github-pages&owner=%40me&name=skills-github-pages&description=My+clone+repository&visibility=public)
4. **اجرای سیستم**
```bash
python main.py
```

1. Right-click **Start course** and open the link in a new tab.
2. In the new tab, most of the prompts will automatically fill in for you.
- For owner, choose your personal account or an organization to host the repository.
- We recommend creating a public repository, as private repositories will [use Actions minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions).
- Scroll down and click the **Create repository** button at the bottom of the form.
3. After your new repository is created, wait about 20 seconds, then refresh the page. Follow the step-by-step instructions in the new repository's README.
5. **دسترسی به سیستم**
```
http://localhost:8000
```

<footer>
## 📚 راهنمای استفاده

<!--
<<< Author notes: Footer >>>
Add a link to get support, GitHub status page, code of conduct, license link.
-->
### API Endpoints

---
#### تولید محتوا
```http
POST /generate-content
Content-Type: application/json

{
"topic": "بازاریابی دیجیتال در سال 2024",
"keywords": ["بازاریابی دیجیتال", "شبکه‌های اجتماعی"],
"target_audience": "کارآفرینان",
"tone": "professional",
"platforms": ["instagram", "telegram", "website"],
"language": "persian",
"include_visual_suggestions": true,
"include_seo": true
}
```

#### بررسی وضعیت سیستم
```http
GET /health
```

#### دریافت پلتفرم‌های پشتیبانی شده
```http
GET /platforms
```

### مثال استفاده با Python

```python
import requests

# تولید محتوا
response = requests.post("http://localhost:8000/generate-content", json={
"topic": "هوش مصنوعی در کسب‌وکار",
"keywords": ["هوش مصنوعی", "کسب‌وکار", "دیجیتال"],
"target_audience": "مدیران ارشد",
"tone": "professional",
"platforms": ["instagram", "website"],
"language": "persian"
})

content = response.json()
print(f"محتوای اینستاگرام: {content['instagram_content']['caption']}")
```

### مثال استفاده با cURL

```bash
curl -X POST "http://localhost:8000/generate-content" \
-H "Content-Type: application/json" \
-d '{
"topic": "تست سیستم",
"keywords": ["تست", "سیستم"],
"target_audience": "توسعه‌دهندگان",
"tone": "friendly",
"platforms": ["telegram"],
"language": "persian"
}'
```

## 🔧 تنظیمات پیشرفته

### تنظیم API Keys

```bash
# فایل .env
GEMINI_API_KEY=your_gemini_api_key
INSTAGRAM_ACCESS_TOKEN=your_instagram_token
TELEGRAM_BOT_TOKEN=your_telegram_token
```

### تنظیمات پلتفرم‌ها

هر پلتفرم تنظیمات خاص خود را دارد:

- **اینستاگرام**: حداکثر 2200 کاراکتر در کپشن
- **تلگرام**: متن کامل بدون محدودیت
- **وب‌سایت**: بهینه‌سازی SEO
- **ایتا**: محتوای شبکه اجتماعی
- **روبیکا**: محتوای بهینه برای الگوریتم جدید

## 🎨 قالب‌های محتوا

### اینستاگرام
- کپشن جذاب و کوتاه
- هشتگ‌های مرتبط
- اموجی‌های مناسب
- CTA موثر

### تلگرام
- متن کامل و مفصل
- هشتگ‌های مرتبط
- اموجی‌های مناسب
- CTA موثر

### وب‌سایت
- عنوان SEO بهینه
- توضیحات متا
- محتوای اصلی با هدینگ‌ها
- کلمات کلیدی

## 🔍 Function Calling

سیستم از قابلیت Function Calling Gemini استفاده می‌کند:

Get help: [Post in our discussion board](https://github.com/orgs/skills/discussions/categories/github-pages) &bull; [Review the GitHub status page](https://www.githubstatus.com/)
```python
# تعریف توابع
functions = [
{
"name": "generate_content",
"description": "تولید محتوای متناسب با پلتفرم",
"parameters": {...}
},
{
"name": "optimize_for_seo",
"description": "بهینه‌سازی SEO",
"parameters": {...}
}
]
```

&copy; 2023 GitHub &bull; [Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/code_of_conduct.md) &bull; [MIT License](https://gh.io/mit)
## 📊 تست سیستم

```bash
# اجرای تست‌های کامل
python test_system.py

# تست ساده
python simple_test.py

# تست تولید محتوا
python -c "
from content_generator import ContentGenerator
generator = ContentGenerator()
# تست کد...
"
```

## 🚀 استقرار

### Docker

```bash
# ساخت و اجرای کانتینر
docker build -t ai-content-generator .
docker run -p 8000:8000 ai-content-generator
```

### Docker Compose

```bash
# اجرا با Docker Compose
docker-compose up -d
```

## 🔒 امنیت

- استفاده از متغیرهای محیطی برای API Keys
- اعتبارسنجی ورودی‌ها
- محدودیت نرخ درخواست
- CORS تنظیم شده

## 📈 عملکرد

- تولید محتوا در کمتر از 10 ثانیه
- پشتیبانی از 5 پلتفرم همزمان
- قابلیت تولید انبوه محتوا
- بهینه‌سازی خودکار

## 🤝 مشارکت

1. Fork کنید
2. Branch جدید ایجاد کنید (`git checkout -b feature/amazing-feature`)
3. تغییرات را commit کنید (`git commit -m 'Add amazing feature'`)
4. Push کنید (`git push origin feature/amazing-feature`)
5. Pull Request ایجاد کنید

## 📄 مجوز

این پروژه تحت مجوز MIT منتشر شده است. برای جزئیات بیشتر فایل `LICENSE` را مطالعه کنید.

## 📞 پشتیبانی

- 📧 ایمیل: support@example.com
- 💬 تلگرام: @support_channel
- 🐛 Issues: GitHub Issues
- 📚 مستندات: Wiki

## 🙏 تشکر

از تمامی افرادی که در توسعه این پروژه مشارکت داشته‌اند تشکر می‌کنیم.

---

</footer>
**نکته**: این سیستم برای استفاده تجاری و شخصی طراحی شده است. لطفاً قوانین و محدودیت‌های پلتفرم‌های مختلف را رعایت کنید.
Loading