Initial commit: Llama API Client with full documentation
- Added complete Python client for Llama AI models - Support for internal network endpoints (tested and working) - Support for external network endpoints (configured) - Interactive chat interface with multiple models - Automatic endpoint testing and failover - Response cleaning for special markers - Full documentation in English and Chinese - Complete test suite and examples - MIT License and contribution guidelines
This commit is contained in:
196
CONTRIBUTING.md
Normal file
196
CONTRIBUTING.md
Normal file
@@ -0,0 +1,196 @@
|
||||
# Contributing to Llama API Client
|
||||
|
||||
Thank you for your interest in contributing to Llama API Client! This document provides guidelines for contributing to the project.
|
||||
|
||||
## How to Contribute
|
||||
|
||||
### Reporting Bugs
|
||||
|
||||
Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, include:
|
||||
|
||||
- A clear and descriptive title
|
||||
- Steps to reproduce the issue
|
||||
- Expected behavior
|
||||
- Actual behavior
|
||||
- System information (OS, Python version, etc.)
|
||||
- Error messages or logs
|
||||
|
||||
### Suggesting Enhancements
|
||||
|
||||
Enhancement suggestions are welcome! Please provide:
|
||||
|
||||
- A clear and descriptive title
|
||||
- Detailed description of the proposed feature
|
||||
- Use cases and benefits
|
||||
- Possible implementation approach
|
||||
|
||||
### Pull Requests
|
||||
|
||||
1. **Fork the repository** and create your branch from `main`
|
||||
2. **Follow the coding style** used in the project
|
||||
3. **Write clear commit messages**
|
||||
4. **Add tests** if applicable
|
||||
5. **Update documentation** if needed
|
||||
6. **Test your changes** thoroughly
|
||||
|
||||
## Development Setup
|
||||
|
||||
```bash
|
||||
# Clone your fork
|
||||
git clone https://github.com/yourusername/llama-api-client.git
|
||||
cd llama-api-client
|
||||
|
||||
# Create virtual environment
|
||||
python -m venv venv
|
||||
source venv/bin/activate # On Windows: venv\Scripts\activate
|
||||
|
||||
# Install dependencies
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Run tests
|
||||
python quick_test.py
|
||||
```
|
||||
|
||||
## Coding Standards
|
||||
|
||||
### Python Style Guide
|
||||
|
||||
- Follow PEP 8
|
||||
- Use meaningful variable names
|
||||
- Add docstrings to functions and classes
|
||||
- Keep functions focused and small
|
||||
- Handle exceptions appropriately
|
||||
|
||||
### Example Code Style
|
||||
|
||||
```python
|
||||
def clean_response(text: str) -> str:
|
||||
"""
|
||||
Clean AI response by removing special markers.
|
||||
|
||||
Args:
|
||||
text: Raw response text from AI
|
||||
|
||||
Returns:
|
||||
Cleaned text without special markers
|
||||
"""
|
||||
# Implementation here
|
||||
return cleaned_text
|
||||
```
|
||||
|
||||
### Commit Message Format
|
||||
|
||||
Use clear and descriptive commit messages:
|
||||
|
||||
- `feat:` New feature
|
||||
- `fix:` Bug fix
|
||||
- `docs:` Documentation changes
|
||||
- `style:` Code style changes
|
||||
- `refactor:` Code refactoring
|
||||
- `test:` Test additions or changes
|
||||
- `chore:` Maintenance tasks
|
||||
|
||||
Examples:
|
||||
```
|
||||
feat: Add support for new model endpoint
|
||||
fix: Handle encoding errors in Windows terminals
|
||||
docs: Update README with troubleshooting section
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Quick connection test
|
||||
python quick_test.py
|
||||
|
||||
# Test all models
|
||||
python test_all_models.py
|
||||
|
||||
# Test specific endpoint
|
||||
python local_api_test.py
|
||||
```
|
||||
|
||||
### Writing Tests
|
||||
|
||||
When adding new features, include appropriate tests:
|
||||
|
||||
```python
|
||||
def test_endpoint_connection():
|
||||
"""Test if endpoint is reachable"""
|
||||
assert test_endpoint({"url": "...", "models": ["..."]})
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
- Update README.md for user-facing changes
|
||||
- Update 操作指南.md for Chinese documentation
|
||||
- Add docstrings to all public functions
|
||||
- Include usage examples for new features
|
||||
|
||||
## Code Review Process
|
||||
|
||||
1. All submissions require review before merging
|
||||
2. Reviews focus on:
|
||||
- Code quality and style
|
||||
- Test coverage
|
||||
- Documentation completeness
|
||||
- Performance implications
|
||||
- Security considerations
|
||||
|
||||
## Areas for Contribution
|
||||
|
||||
### Current Needs
|
||||
|
||||
- [ ] Add retry logic for failed connections
|
||||
- [ ] Implement connection pooling
|
||||
- [ ] Add streaming response support
|
||||
- [ ] Create GUI interface
|
||||
- [ ] Add conversation export/import
|
||||
- [ ] Implement rate limiting
|
||||
- [ ] Add proxy support
|
||||
- [ ] Create Docker container
|
||||
- [ ] Add more language examples
|
||||
- [ ] Improve error messages
|
||||
|
||||
### Future Features
|
||||
|
||||
- Web interface
|
||||
- Mobile app support
|
||||
- Voice input/output
|
||||
- Multi-user support
|
||||
- Analytics dashboard
|
||||
- Plugin system
|
||||
|
||||
## Community
|
||||
|
||||
### Communication Channels
|
||||
|
||||
- GitHub Issues: Bug reports and feature requests
|
||||
- GitHub Discussions: General questions and discussions
|
||||
- Pull Requests: Code contributions
|
||||
|
||||
### Code of Conduct
|
||||
|
||||
- Be respectful and inclusive
|
||||
- Welcome newcomers
|
||||
- Provide constructive feedback
|
||||
- Focus on what is best for the community
|
||||
- Show empathy towards others
|
||||
|
||||
## Questions?
|
||||
|
||||
If you have questions about contributing, feel free to:
|
||||
|
||||
1. Open an issue with the `question` label
|
||||
2. Check existing documentation
|
||||
3. Review closed issues for similar questions
|
||||
|
||||
## License
|
||||
|
||||
By contributing, you agree that your contributions will be licensed under the MIT License.
|
||||
|
||||
---
|
||||
|
||||
Thank you for contributing to Llama API Client! 🚀
|
Reference in New Issue
Block a user