Skip to content

Commit 3d5e395

Browse files
Add CONTRIBUTION.md (#961)
1 parent 3fe4abe commit 3d5e395

File tree

1 file changed

+240
-0
lines changed

1 file changed

+240
-0
lines changed

CONTRIBUTION.md

+240
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
# Contributing to ChatALL
2+
3+
Thank you for considering contributing to ChatALL! We welcome contributions from everyone, regardless of your background or experience level. Your contributions help make this project better for everyone.
4+
5+
## Introduction
6+
7+
ChatALL is a project that allows users to chat with multiple AI bots concurrently, helping them discover the best results. Our goal is to provide a seamless and efficient experience for users to interact with various AI bots.
8+
9+
## Reporting Issues
10+
11+
If you find any issues while using ChatALL, please follow these steps to report them:
12+
13+
1. **Check for existing issues**: Before reporting a new issue, please check the [issue tracker](https://github.com/sunner/ChatALL/issues) to see if the issue has already been reported.
14+
2. **Create a new issue**: If the issue has not been reported, create a new issue using the appropriate [issue template](https://github.com/sunner/ChatALL/issues/new/choose).
15+
3. **Provide detailed information**: Include as much information as possible, such as the steps to reproduce the issue, your operating system, and any relevant screenshots.
16+
17+
## Submitting Pull Requests
18+
19+
We welcome pull requests from everyone. To submit a pull request, follow these steps:
20+
21+
1. **Fork the repository**: Click the "Fork" button at the top right corner of the repository page to create a copy of the repository in your GitHub account.
22+
2. **Create a new branch**: Create a new branch for your changes.
23+
3. **Make your changes**: Make the necessary changes to the codebase.
24+
4. **Commit your changes**: Commit your changes with a descriptive commit message.
25+
5. **Push your changes**: Push your changes to your forked repository.
26+
6. **Create a pull request**: Go to the original repository and click the "New pull request" button. Select your branch and provide a detailed description of your changes.
27+
28+
### Tips for Pull Requests
29+
30+
- **Control PR scope and size**:
31+
- Focus on a single feature or fix per PR
32+
- Break down large changes into smaller, independent PRs
33+
- Avoid mixing unrelated changes (e.g., refactoring + new feature)
34+
- Large PRs significantly slow down review process and increase merge conflicts
35+
- **Best practices**:
36+
- Update i18n files for any user-facing text changes
37+
- Follow project coding standards
38+
39+
## Project Structure
40+
41+
Key directories:
42+
43+
- `src/bots/` - AI bot implementations
44+
- `src/i18n/` - Localization files
45+
- `src/components/` - Vue components
46+
- `src/store/` - State management
47+
- `public/bots/` - Bot logos
48+
49+
## Code Style Guidelines
50+
51+
To maintain a consistent codebase, please follow these code style guidelines:
52+
53+
- Use 2 spaces for indentation.
54+
- Use camelCase for variable and function names.
55+
- Use PascalCase for class names.
56+
- Write clear and concise comments to explain your code.
57+
- Follow the existing code style in the project.
58+
59+
## Encouraging Contributions
60+
61+
We believe that community involvement is crucial for the success of ChatALL. Here are some ways you can contribute:
62+
63+
- **Report issues**: If you encounter any issues, please report them using the [issue tracker](https://github.com/sunner/ChatALL/issues).
64+
- **Submit pull requests**: If you have a fix or improvement, please submit a pull request.
65+
- **Suggest new features**: If you have an idea for a new feature, please create a new issue to discuss it with the community.
66+
- **Improve documentation**: If you find any errors or omissions in the documentation, please submit a pull request to improve it.
67+
68+
## Resources for New Contributors
69+
70+
If you are new to contributing to open source projects, here are some resources to help you get started:
71+
72+
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
73+
- [First Timers Only](https://www.firsttimersonly.com/)
74+
- [GitHub Docs](https://docs.github.com/en)
75+
76+
## Adding a New AI Bot
77+
78+
If you would like to add a new AI bot to ChatALL, please follow these steps:
79+
80+
1. **Create a new bot file**: In the `src/bots/` directory, create a new file for your bot. You can use the `TemplateBot.js` file as a starting point.
81+
2. **Implement the `_sendPrompt()` method**: In your new bot file, implement the `_sendPrompt()` method to handle sending prompts to the AI bot.
82+
3. **Add a reference to your bot**: In the `src/bots/index.js` file, add a reference to your new bot.
83+
4. **Add translations**: Update all locale files in `src/i18n/`:
84+
85+
```json
86+
// filepath: src/i18n/locales/en.json
87+
{
88+
"yourBot": {
89+
"name": "Your Bot Name"
90+
}
91+
}
92+
```
93+
94+
### Basic Bot Implementation Example
95+
96+
This is an example of using LangChainBot. Since LangChainBot uses LangChainJS, it is easy to integrate AI bots that are already supported by LangChainJS. For detailed steps, refer to the "Step-by-Step Guide to Adding a New AI Bot" section below. If you prefer not to use LangChain, you can directly extend the Bot class.
97+
98+
```javascript
99+
// filepath: src/bots/KnowNothingBot.js
100+
import LangChainBot from '@/bots/LangChainBot';
101+
102+
class KnowNothingBot extends LangChainBot {
103+
static _className = "KnowNothingBot";
104+
static _name = "Know Nothing Bot";
105+
static _description = "A bot that knows nothing";
106+
static _version = "1.0";
107+
108+
constructor() {
109+
super();
110+
}
111+
112+
async _sendPrompt(prompt) {
113+
try {
114+
// Implement your bot's logic here
115+
return response;
116+
} catch (error) {
117+
throw error;
118+
}
119+
}
120+
121+
// Required methods when extending LangChainBot
122+
_setupModel() {
123+
// Setup your LangChain model here
124+
}
125+
126+
getPastRounds() {
127+
// Return the number of past conversation rounds to keep
128+
return 1;
129+
}
130+
}
131+
132+
export default KnowNothingBot;
133+
```
134+
135+
### Step-by-Step Guide to Adding a New AI Bot
136+
137+
1. **Create a New Bot File**: Navigate to the `src/bots/` directory and create a new file for your bot. For example, if your bot is named "KnowNothing", create `KnowNothingBot.js`.
138+
139+
Basic Bot Implementation
140+
141+
```javascript
142+
import Bot from '@/bots/Bot';
143+
144+
class KnowNothingBot extends Bot {
145+
static _className = "KnowNothingBot";
146+
static _name = "Know Nothing Bot";
147+
static _description = "A bot that knows nothing";
148+
}
149+
```
150+
151+
Or for LangChain-based Bot
152+
153+
```javascript
154+
import LangChainBot from '@/bots/LangChainBot';
155+
156+
class KnowNothingBot extends LangChainBot {
157+
static _className = "KnowNothingBot";
158+
static _name = "Know Nothing Bot";
159+
static _description = "A bot that knows nothing";
160+
161+
_setupModel() {
162+
// Setup your LangChain model here
163+
}
164+
165+
getPastRounds() {
166+
return 1;
167+
}
168+
}
169+
```
170+
171+
2. **Implement the `_sendPrompt()` Method**: Implement the `_sendPrompt()` method to handle sending prompts to the AI bot.
172+
173+
```javascript
174+
async _sendPrompt(prompt) {
175+
try {
176+
// Your code to send the prompt to the AI bot
177+
return response;
178+
} catch (error) {
179+
throw error;
180+
}
181+
}
182+
```
183+
184+
3. **Add a Reference to Your Bot**: Add your bot to the `src/bots/index.js` file to ensure it is included in the application:
185+
186+
```javascript
187+
// First import your bot
188+
import KnowNothingBot from '@/bots/KnowNothingBot';
189+
190+
// Add to the main bot list
191+
const all = [
192+
ChatGPT35Bot.getInstance(),
193+
ChatGPT4Bot.getInstance(),
194+
KnowNothingBot.getInstance(), // Add your bot here
195+
...existing_bots...
196+
];
197+
198+
// Add to appropriate category arrays
199+
export const botTags = {
200+
free: [
201+
bots.getBotByClassName("BardBot"),
202+
bots.getBotByClassName("KnowNothingBot"), // If it's free
203+
...existing_free_bots...
204+
],
205+
openSource: [
206+
bots.getBotByClassName("AlpacaBot"),
207+
bots.getBotByClassName("KnowNothingBot"), // If it's open source
208+
...existing_opensource_bots...
209+
],
210+
api: [
211+
bots.getBotByClassName("KnowNothingBot"), // If it uses API
212+
bots.getBotByClassName("OpenAIAPI35Bot"),
213+
...existing_api_bots...
214+
],
215+
madeInChina: [
216+
bots.getBotByClassName("Qihoo360AIBrainBot"),
217+
bots.getBotByClassName("KnowNothingBot"), // If it's made in China
218+
...existing_china_bots...
219+
],
220+
};
221+
222+
// If needed, set custom user agent
223+
KnowNothingBot._userAgent = "THE_RIGHT_USER_AGENT";
224+
```
225+
226+
4. **Customize User-Agent (if needed)**: Some websites may restrict access to specific browsers. Set the user-agent in `KnowNothingBot.js` if required.
227+
228+
```javascript
229+
static _userAgent = "THE_RIGHT_USER_AGENT";
230+
```
231+
232+
5. **Test Your Bot**: Run the application and test your new bot to ensure it works correctly.
233+
234+
```bash
235+
npm run electron:serve
236+
```
237+
238+
6. **Submit a Pull Request**: Once you have tested your bot and ensured it works correctly, submit a pull request following the steps mentioned in the "How to Submit Pull Requests" section.
239+
240+
Thank you for your contributions! We appreciate your efforts and look forward to your involvement in our community.

0 commit comments

Comments
 (0)