Skip to content

Commit

Permalink
Auto-translate README
Browse files Browse the repository at this point in the history
  • Loading branch information
Continuous Integration committed Oct 27, 2023
1 parent 54dbbc8 commit c5f8b6d
Show file tree
Hide file tree
Showing 4 changed files with 238 additions and 165 deletions.
104 changes: 66 additions & 38 deletions README.Arabic.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,83 @@
# ChatGPT خط بوت

* [الإنجليزية](README.md)
* [README.zh-TW.md](README.zh-TW.md) بنسخة تقليدية صينية
* [الصينية المبسطة](README.zh-CN.md)
* [الفرنسية](README.French.md)
* [English](README.md)
* [繁體中文版README.md](README.zh-TW.md)
* [简体中文](README.zh-CN.md)
* [Française](README.French.md)
* [عربى](README.Arabic.md)

هذا المشروع سيعلمك كيفية إنشاء **خط بوت ChatGPT** مجاني!

## مقدمة
## 介紹

يمكنك استيراد بوت ChatGPT في Line عن طريق إدخال النص مباشرة في مربع الإدخال.
في Line ، يمكنك استيراد ChatGPT Bot ببساطة عن طريق إدخال النص في مربع الإدخال لبدء التفاعل مع ChatGPT.

<img src="img/2023-10-25-10-03-47.png" width="30%" />

## الأدوات والميزات
## 工具與特色

* `Python FastAPI`: إنشاء استجابة API لـ ChatGPT
* `gpt4free`: **استخدام مجاني لواجهة برمجة التطبيقات من OpenAI**
* `قناة واجهة رسائل Line`: تكامل مع واجهة برمجة التطبيقات لـ ChatGPT
* `Python FastAPI`: إنشاء استجابة ChatGPT API
* `gpt4free`: **استخدام OpenAI API مجانًا**
* `قناة Line messaging API`: ربط ChatGPT API
* `Github`: تخزين الشيفرة
* `replit`: **نشر FastAPI الخاص بك مجانًا**
* `CronJob`: إرسال طلبات بشكل دوري مجانًا لتجنب انقطاع واجهة البرمجة
* `CronJob`: إرسال طلبات منتظمة مجانًا لتجنب انقطاع الاتصال

## خطوات التثبيت
## 安裝步驟

### الحصول على الرمز المميز (Token)
### Token 取得

1. الحصول على رمز مميز Line:
1. تسجيل الدخول إلى [مطوري Line](https://developers.line.biz/zh-hant/)
1. الحصول على رمز Line:
1. تسجيل الدخول إلى [Line Developer](https://developers.line.biz/zh-hant/)
2. إنشاء روبوت:
1. إنشاء "مزود" -> انقر فوق "إنشاء"
2. إنشاء "قناة" -> حدد "إنشاء واجهة برمجة التطبيقات للرسائل"
1. إنشاء `موفر` -> انقر فوق `Create`
2. إنشاء `قناة` -> اختر `Create a Messaging API channel`
3. أدخل المعلومات الأساسية المطلوبة
4. بعد الانتهاء من الإدخال، يتواجد في الأسفل تحت "الإعدادات الأساسية" "الرمز السري للقناة" -> انقر فوق "الإصدار"، وهو يصبح بمثابة "LINE_CHANNEL_SECRET" (ستحتاج إليه لاحقًا)
5. في "واجهة برمجة التطبيقات للرسائل" أسفل "واجهة البرمجة" هناك "رمز الوصول للقناة" -> انقر فوق "الإصدار"، وهو يصبح بمثابة "LINE_CHANNEL_ACCESS_TOKEN" (ستحتاج إليه لاحقًا)

### إعداد المشروع
1. استنسخ مستودع Github:
1. سجّل الدخول/سجّل حسابًا في [GitHub](https://github.com/)
2. انتقل إلى [ChatGPT-Line-Bot](https://github.com/Lin-jun-xiang/ChatGPT-Line-Bot)
3. انقر على "النجمة" لدعم المطور
4. انقر على "استنساخ" لنسخ جميع شيفرة المشروع إلى مستودعك الخاص
2. نشر (مساحة مجانية):
1. انتقل إلى [replit](https://replit.com/)
2. انقر على "التسجيل" وسجّل الدخول بحساب "GitHub" الخاص بك وقم بمنح التصريح -> انقر على "تخطي" لتخطي إعدادات البداية
3. بعد الدخول، انقر على "إنشاء" في الوسط على الصفحة الرئيسية وسيظهر مربعًا، انقر فوق "استيراد من GitHub" في الزاوية اليمنى العلوية
4. إذا لم تكن قد أضفت مستودع GitHub بعد، فانقر على "الاتصال بـGitHub لاستيراد المستودعات الخاصة الخاصة بك." -> حدد "حدد مستودعات فقط" -> حدد "ChatGPT-Line-Bot"
5. عد إلى الخطوة الرابعة، في هذا الوقت "عنوان GitHub" يمكن أن تختار مشروع "ChatGPT-Line-Bot" -> انقر على "استيراد من GitHub".

### تشغيل المشروع
1. إعداد متغيرات البيئة
1. بعد الانتهاء من الخطوة السابقة "الاستيراد" في "Replit"، انتقل إلى صفحة إدارة المشروع على اليسار أسفل "الأدوات" وانقر على "الأسرار".
2. بعد النقر على "استلامتم" على اليمين، يمكنك إضافة متغيرات ب
4. بعد الانتهاء من الإدخال ، في الجزء السفلي من "الإعدادات الأساسية" ، هناك "سر القناة" -> انقر فوق "Issue" ، وسيتم إنشاء "LINE_CHANNEL_SECRET" بعد ذلك (سيتم استخدامه في وقت لاحق)
5. في "واجهة برمجة التطبيقات الرسائل" ، هناك "رمز الوصول للقناة" -> انقر فوق "Issue" ، وسيتم إنشاء "LINE_CHANNEL_ACCESS_TOKEN" بعد ذلك (سيتم استخدامه في وقت لاحق)

### 專案設置
1. Fork Github 專案:
1. التسجيل / تسجيل الدخول إلى [GitHub](https://github.com/)
2. الانتقال إلى [ChatGPT-Line-Bot](https://github.com/Lin-jun-xiang/ChatGPT-Line-Bot)
3. انقر على `Star` لدعم المطور
4. انقر على `Fork` لنسخ جميع الشفرة إلى السجل الخاص بك
2. النشر (مساحة مجانية):
1. الانتقال إلى [replit](https://replit.com/)
2. انقر على "Sign Up" وقم بتسجيل الدخول باستخدام حسابك في `Github` والموافقة على الوصول -> انقر فوق "Skip" لتجاوز الإعداد الأولي
3. بمجرد الوصول إلى الصفحة الرئيسية في الوسط ، انقر فوق "Create" -> ستظهر نافذة منبثقة ، انقر فوق "Import from Github" في الزاوية العلوية اليمنى
4. إذا لم تكن قد قمت بإضافة مستودع Github بعد ، فانقر فوق الارتباط "Connect GitHub to import your private repos." -> حدد "Only select repositories" -> حدد "ChatGPT-Line-Bot"
5. عد إلى الخطوة الرابعة ، وفي هذا الوقت يمكنك اختيار مشروع "Github URL" -> انقر فوق "Import from Github".

### 專案執行
1. إعدادات المتغيرات البيئية
1. بعد استكمال الخطوة السابقة "Import" ، انتقل إلى صفحة إدارة المشروع في "Replit" وانقر على "Tools" في الزاوية اليسرى السفلى للوصول إلى "Secrets".
2. بعد النقر فوق الزر "Got it" في الجانب الأيمن ، يمكنك إضافة متغيرات البيئة ، ويجب إضافة:
1. Line Channel Secret:
- المفتاح: `LINE_CHANNEL_SECRET`
- القيمة: `[الحصول من الخطوة الأولى]`
2. Line Channel Access Token:
- المفتاح: `LINE_CHANNEL_ACCESS_TOKEN`
- القيمة: `[الحصول من الخطوة الأولى]`

<img src="img/2023-10-25-10-00-59.png" width="60%"/>

2. بدء التشغيل
1. انقر فوق "Run" في الأعلى
2. بعد النجاح ، ستظهر "Hello World" في الجزء العلوي الأيمن من الشاشة ، وقم بنسخ عنوان الويب الموجود في الأعلى
3. اعود إلى Line Developer وفي "Messaging API" تحت "Webhook URL" ، قم بلصق العنوان الذي قمت بنسخه في الخطوة السابقة وأضف "/callback" مثل: `https://ChatGPT-Line-Bot.jimmylin.repl.co/callback`
4. قم بتشغيل خيار "Use webhook" في الأسفل
5. قم بإيقاف تشغيل "Auto-reply messages" في الأسفل
- ملاحظة: إذا لم يتم تلقي أي طلب خلال ساعة واحدة ، سيتم إيقاف تشغيل البرنامج ، لذا يجب اتباع الخطوات التالية

<img src="img/2023-10-25-10-01-21.png" width="60%"/>

3. CronJob 定時發送請求
1. التسجيل / تسجيل الدخول إلى [cron-job.org](https://cron-job.org/en/)
2. بعد الوصول إلى اللوحة ، انقر فوق "CREATE CRONJOB" في الزاوية العلوية اليمنى
3. أدخل "Title" كـ "ChatGPT-Line-Bot" ، وأدخل عنوان الويب الذي قمت بنسخه في الخطوة السابقة ، على سبيل المثال: `https://ChatGPT-Line-Bot.jimmylin.repl.co/`
4. في الأسفل ، قم بالنقر على الوقت "كل 5 دقائق"
5. انقر فوق "CREATE"

### 連結服務與 Line Bot

العودة إلى [Line Developer](https://manager.line.biz/account) الصفحة الرئيسية وانقر فوق "دليل إضافة صديق
153 changes: 85 additions & 68 deletions README.French.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,83 +6,100 @@
* [Française](README.French.md)
* [عربى](README.Arabic.md)

Ce projet vous montrera comment créer un **ChatGPT Line Bot** gratuit !

## Introduction

Intégrez le ChatGPT Bot dans Line en saisissant simplement du texte dans la zone de saisie pour commencer à interagir avec ChatGPT.
Integrate ChatGPT Bot in Line by simply entering text in the input box to start interacting with ChatGPT.

<img src="img/2023-10-25-10-03-47.png" width="30%" />

## Outils et fonctionnalités

* `Python FastAPI` : Créez une API de réponse ChatGPT
* `gpt4free` : **Utilisation gratuite de l'API OpenAI**
* `Line messaging API channel` : Intégration de l'API ChatGPT
* `Github` : Stockage du code
* `replit` : **Déploiement gratuit de votre propre FastAPI**
* `CronJob` : Envoi de requêtes planifiées gratuites pour éviter les interruptions de l'API


## Étapes d'installation

### Obtention du jeton

1. Obtenez le jeton Line :
1. Connectez-vous à [Line Developer](https://developers.line.biz/zh-hant/)
2. Créez un robot :
1. Créez un `Provider` -> Cliquez sur `Create`
2. Créez un `Channel` -> Sélectionnez `Create a Messaging API channel`
3. Saisissez les informations de base obligatoires
4. Une fois terminé, sous `Basic Settings`, vous trouverez un `Channel Secret` -> Cliquez sur `Issue`, cela générera le `LINE_CHANNEL_SECRET` (utilisé plus tard)
5. Sous `Messaging API`, vous trouverez un `Channel access token` -> Cliquez sur `Issue`, cela générera le `LINE_CHANNEL_ACCESS_TOKEN` (utilisé plus tard)

### Configuration du projet
1. Fork du projet Github :
1. Inscrivez-vous / Connectez-vous à [GitHub](https://github.com/)
2. Accédez à [ChatGPT-Line-Bot](https://github.com/Lin-jun-xiang/ChatGPT-Line-Bot)
3. Cliquez sur `Star` pour soutenir le développeur
4. Cliquez sur `Fork` pour copier tout le code dans votre propre dépôt
2. Déploiement (espace gratuit) :
1. Accédez à [replit](https://replit.com/)
2. Cliquez sur `Sign Up` pour vous connecter directement avec votre compte `Github` et autoriser l'accès -> Cliquez sur `Skip` pour ignorer la configuration initiale
3. Une fois connecté, cliquez sur `Create` sur la page principale au milieu -> Une fenêtre contextuelle apparaîtra, cliquez sur `Import from Github` en haut à droite
4. Si vous n'avez pas encore ajouté de dépôt Github, cliquez sur le lien `Connect GitHub to import your private repos.` -> Cochez `Only select repositories` -> Sélectionnez `ChatGPT-Line-Bot`
5. Revenez à l'étape 4, à ce stade, vous pouvez sélectionner le projet `ChatGPT-Line-Bot` dans `Github URL` -> Cliquez sur `Import from Github`.

### Exécution du projet
1. Configuration des variables d'environnement
1. Une fois l'étape précédente d'importation terminée, cliquez sur `Tools` en bas à gauche de la page de gestion du projet dans `Replit` -> Cliquez sur `Secrets`.
2. Cliquez sur `Got it` à droite pour ajouter des variables d'environnement, vous devez ajouter :
1. Line Channel Secret :
- clé : `LINE_CHANNEL_SECRET`
- valeur : `[obtenue à l'étape 1]`
2. Line Channel Access Token :
- clé : `LINE_CHANNEL_ACCESS_TOKEN`
- valeur : `[obtenue à l'étape 1]`

2. Démarrage de l'exécution
1. Cliquez sur `Run` en haut
2. Une fois terminé avec succès, l'écran de droite affichera `Hello World`, copiez l'**URL en haut de l'écran**.
3. Retournez à Line Developer, dans `Messaging API`, collez l'URL ci-dessus dans `Webhook URL` et ajoutez `/callback`, par exemple : `https://ChatGPT-Line-Bot.jimmylin.repl.co/callback`
4. Activez `Use webhook`
5. Désactivez les `Auto-reply messages` ci-dessous
- Remarque : si aucune requête n'est effectuée dans l'heure, le programme s'arrêtera, vous devez donc suivre l'étape suivante

3. Envoi de requêtes planifiées avec CronJob
1. Inscrivez-vous / Connectez-vous à [cron-job.org](https://cron-job.org/en/)
2. Une fois connecté, sélectionnez `CREATE CRONJOB` dans le coin supérieur droit du tableau de bord
3. Saisissez `ChatGPT-Line-Bot` dans `Title`, entrez l'URL de l'étape précédente, par exemple : `https://ChatGPT-Line-Bot.jimmylin.repl.co/`
4. En dessous, sélectionnez toutes les `5 minutes`
5. Cliquez sur `CREATE`

### Lier le service et le Line Bot

Revenez à la page d'accueil de [Line Developer](https://developers.line.biz/zh-hant/) et cliquez sur `加入好友指南` pour scanner le code et ajouter le LINE Bot. Félicitations, vous avez créé votre premier LINE Bot ! Essayez de lui parler et voyez sa réponse !
## Tools and Features

* `Python FastAPI`: Create ChatGPT response API
* `gpt4free`: **Free to use OpenAI API**
* `Line messaging API channel`: Connect to ChatGPT API
* `Github`: Store the code
* `replit`: **Free deployment of your own FastAPI**
* `CronJob`: Free scheduled requests to prevent API interruption


## Installation Steps

### Obtain Token

1. Get Line Token:
1. Log in to [Line Developer](https://developers.line.biz/zh-hant/)
2. Create a bot:
1. Create `Provider` -> Click `Create`
2. Create `Channel` -> Choose `Create a Messaging API channel`
3. Fill in the required basic information
4. After filling in, under `Basic Settings`, there is a `Channel Secret` -> Click `Issue`, and the generated value is `LINE_CHANNEL_SECRET` (will be used later)
5. Under `Messaging API`, there is a `Channel access token` -> Click `Issue`, and the generated value is `LINE_CHANNEL_ACCESS_TOKEN` (will be used later)

### Project Setup
1. Fork the Github project:
1. Register/Log in to [GitHub](https://github.com/)
2. Go to [ChatGPT-Line-Bot](https://github.com/Lin-jun-xiang/ChatGPT-Line-Bot)
3. Click `Star` to support the developer
4. Click `Fork` to copy all the code to your own repository
2. Deployment (Free Space):
1. Go to [replit](https://replit.com/)
2. Click `Sign Up` to log in with your `Github` account and authorize it -> Click `Skip` to skip the initial setup
3. On the main page in the middle, click `Create` -> A pop-up window will appear, click the top-right corner `Import from Github`
4. If you haven't added the Github repository, click the link `Connect GitHub to import your private repos.` -> Check `Only select repositories` -> Choose `ChatGPT-Line-Bot`
5. Go back to step four, at this time, the `Github URL` can choose the `ChatGPT-Line-Bot` project -> Click `Import from Github`.

### Project Execution
1. Environment Variable Setup
1. After completing the previous `Import` step, click `Tools` at the bottom left of the project management page in `Replit` and click `Secrets`.
2. After clicking `Got it` on the right, you can add environment variables. You need to add:
1. Line Channel Secret:
- key: `LINE_CHANNEL_SECRET`
- value: `[Obtained from step one]`
2. Line Channel Access Token:
- key: `LINE_CHANNEL_ACCESS_TOKEN`
- value: `[Obtained from step one]`

<img src="img/2023-10-25-10-00-59.png" width="60%"/>

2. Start Execution
1. Click `Run` at the top
2. After successful execution, the right panel will display `Hello World`, and copy the URL in the upper right corner of the panel
3. Go back to Line Developer, in `Messaging API`, paste the above URL in `Webhook URL`, and add `/callback` to it, for example: `https://ChatGPT-Line-Bot.jimmylin.repl.co/callback`
4. Turn on `Use webhook`
5. Turn off `Auto-reply messages` below
- Note: If there are no requests within an hour, the program will be interrupted, so the next step is needed

<img src="img/2023-10-25-10-01-21.png" width="60%"/>

3. CronJob Scheduled Requests
1. Register/Log in to [cron-job.org](https://cron-job.org/en/)
2. After logging in, choose `CREATE CRONJOB` at the top right of the panel
3. Enter `ChatGPT-Line-Bot` for `Title`, enter the URL from the previous step, for example: `https://ChatGPT-Line-Bot.jimmylin.repl.co/`
4. Set it to run every `5 minutes` below
5. Click `CREATE`

### Connect Services and Line Bot

Go back to [Line Developer](https://manager.line.biz/account) homepage and click `Add Friend Guide` to scan and add the LINE Bot:

Homepage -> Click on your bot -> Click `Add Friend Tools` -> Create Friend QR Code (https://manager.line.biz/account/<yourBotId>/gainfriends)

Congratulations on creating your first LINE Bot! Try talking to it and it will reply to you!

### Advanced - Personalized Bot

In addition, we can make the Line Bot answer more personalized by using the `prompt` method. In `./chatgpt_linebot/prompts/template.py`, we can define a `template`, for example:

<img src="img/2023-10-27-10-09-17.png" width="60%" />

**Question**: What did you have for breakfast today?

**Bot Answer**: Darling, are you awake yet? I've been waiting for you in bed and I'm feeling so hungry just thinking about your body. What should we have for breakfast today? How about some spicy scrambled eggs, as hot as your charming figure? 😏🍳

---

## Références
## References

[Line_Bot_Tutorial](https://github.com/FawenYo/LINE_Bot_Tutorial)

Expand Down
Loading

0 comments on commit c5f8b6d

Please sign in to comment.