Skip to content
Merged
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
122 changes: 122 additions & 0 deletions .cursor/rules/english_comments.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
description: English Comments Rule
alwaysApply: false
---
# English Comments Rule

## English-Only Comments Requirement

All code comments MUST be written in English. No Chinese, Japanese, Korean, or other non-English languages are allowed in comments.

### ✅ Correct Pattern:
```python
# Initialize the processor with default settings
processor = DataProcessor()

# Cache inspector for 60 seconds
self._inspector_ttl = 60

# Ensure current application configuration is correct
if not self._validate_config():
raise ConfigurationError("Invalid configuration")

# Concurrently fetch all task details asynchronously
tasks = await self._fetch_all_tasks_async()

# Lazy load CLIP model
self._clip_model = None
```

### ❌ Forbidden Pattern:
```python
# 初始化处理器
processor = DataProcessor()

# inspector缓存时间,秒
self._inspector_ttl = 60

# 确保当前应用配置正确
if not self._validate_config():
raise ConfigurationError("Invalid configuration")

# 并发异步获取所有任务详情
tasks = await self._fetch_all_tasks_async()

# 延迟加载CLIP模型
self._clip_model = None
```

## Architecture Rules

1. **English-Only Comments**: All comments must be written in English, regardless of the target audience or deployment region.

2. **Code Documentation**:
- Function docstrings must be in English
- Inline comments must be in English
- TODO comments must be in English
- FIXME comments must be in English

3. **Variable and Function Names**:
- Variable names can be in English or follow existing naming conventions
- Function names should be descriptive in English
- Class names should be in English

4. **String Literals**:
- User-facing strings can be localized
- Error messages can be localized
- Comments and documentation must remain in English

## File Structure Requirements

- All `.py` files: English comments only
- All `.js`/`.ts` files: English comments only
- All `.md` files: English documentation only
- All `.yaml`/`.yml` files: English comments only

## Migration Checklist

When refactoring existing code:
1. ✅ Identify all non-English comments
2. ✅ Translate comments to English while preserving meaning
3. ✅ Update docstrings to English
4. ✅ Ensure inline comments are in English
5. ✅ Verify all TODO/FIXME comments are in English
6. ✅ Update any related documentation

## Validation

Before committing changes:
- No Chinese characters in comments
- No Japanese characters in comments
- No Korean characters in comments
- All comments are in English
- All docstrings are in English
- All TODO/FIXME comments are in English

## Examples of Refactoring

### Before:
```python
# 解析输入URL
def parse_url(url: str) -> str:
"""解析并验证URL格式"""
# 检查URL是否有效
if not url.startswith('http'):
raise ValueError("无效的URL格式")
return url
```

### After:
```python
# Parse input URL
def parse_url(url: str) -> str:
"""Parse and validate URL format"""
# Check if URL is valid
if not url.startswith('http'):
raise ValueError("Invalid URL format")
return url
```
description:
globs:
alwaysApply: false
---
69 changes: 69 additions & 0 deletions .cursor/rules/environment_variable.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
description: Environment Variable Management Rules
alwaysApply: false
---
# Environment Variable Management Rules

## Environment Variable Access Pattern

All environment variable access MUST go through `backend/consts/const.py`. Direct `os.getenv()` or `os.environ.get()` calls are NOT allowed in any other files.

### ✅ Correct Pattern:
```python
# In backend/consts/const.py
APPID = os.getenv("APPID", "")
TOKEN = os.getenv("TOKEN", "")

# In other files
from consts.const import APPID, TOKEN
```

### ❌ Forbidden Pattern:
```python
# Direct environment variable access - NOT ALLOWED
import os
appid = os.getenv("APPID")
token = os.environ.get("TOKEN")
```

## Architecture Rules

1. **Single Source of Truth**: `backend/consts/const.py` is the ONLY place where `os.getenv()` or `os.environ.get()` should be called.

2. **SDK Layer Dependencies**: SDK modules (in `sdk/` directory) should NOT directly access environment variables. Instead:
- Accept configuration parameters through constructors
- Remove `from_env()` methods from config classes
- Pass required values from higher-level modules

3. **Configuration Classes**:
- Remove `@classmethod from_env()` methods
- Use `__init__()` with required parameters
- Keep reasonable defaults for technical configurations

4. **Service Initialization**: Services should read from `const.py` and pass configurations to SDK modules.

## File Structure Requirements

- `backend/consts/const.py`: Centralized environment variable management
- `backend/apps/`: Import from `consts.const` and pass to SDK modules
- `backend/services/`: Import from `consts.const` for service configuration
- `sdk/`: Accept configuration through parameters, no direct env access

## Migration Checklist

When modifying environment variable access:
1. ✅ Add new variables to `backend/consts/const.py`
2. ✅ Update `.env.example` with new variables
3. ✅ Remove `os.getenv()` calls from target files
4. ✅ Import from `consts.const` in backend files
5. ✅ Pass configuration as parameters to SDK modules
6. ✅ Remove `from_env()` methods from config classes
7. ✅ Update service constructors to read from `const.py`

## Validation

Before committing changes:
- No `os.getenv()` calls outside `const.py`
- No `from_env()` methods in config classes
- All environment variables defined in `const.py`
- SDK modules accept configuration through parameters
84 changes: 84 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 构建 VitePress 站点并将其部署到 GitHub Pages 的工作流程
#
name: Deploy VitePress Docs to Pages

on:
# 在针对 `develop` 分支的推送上运行
push:
branches: [develop]
# 只有当doc目录下的文件发生变化时才触发
paths:
- 'doc/**'

# 允许从 Actions 选项卡手动运行此工作流程
workflow_dispatch:

# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
concurrency:
group: pages
cancel-in-progress: false

jobs:
# 构建工作
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./doc
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: ./doc/package-lock.json

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Install dependencies
run: npm ci

- name: Temporarily modify base path for GitHub Pages
run: |
# 创建一个临时的config文件,将base从'/doc/'改为'/nexent/'用于GitHub Pages
sed 's|base: '"'"'/doc/'"'"'|base: '"'"'/nexent/'"'"'|g' docs/.vitepress/config.mts > docs/.vitepress/config.github.mts
mv docs/.vitepress/config.mts docs/.vitepress/config.original.mts
mv docs/.vitepress/config.github.mts docs/.vitepress/config.mts

- name: Build with VitePress
run: npm run docs:build

- name: Restore original config
run: |
mv docs/.vitepress/config.original.mts docs/.vitepress/config.mts

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: doc/docs/.vitepress/dist

# 部署工作
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
19 changes: 16 additions & 3 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
Nexent Team:

Team Manager / Product Manager:
Shuangrui Chen @Phinease

Senior System Engineer:
Simeng Bian @Simeng Bian
Tao Liu @ liutao12138
Tao Liu @liutao12138

Development Group Leader:
Jingyuan Li @ljy65535

Developer:
Yichen Xia @Jasonxia007
Mingchen Wan @WMC001
Yichen Xia @ Jasonxia007
Yu Lin @ linsensen222
Yu Lin @linsensen222
Wenqi Bai @Bavichi
Feiyang Xiang @feixiangkong

Operations Manager:
Chenxue Jia @Davina-jcx
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Thank you for considering contributing to Nexent! From code to docs to sharing your experience, every bit helps make Nexent better for everyone. It also helps us if you share Nexent with others, or simply ⭐️ the repo. Thanks a million! 💛 Let's build something amazing together! 🎉

In terms of licensing, please take a minute to read our short [License and Contributor Agreement](https://github.com/ModelEngine-Group/nexent/blob/main/LICENSE). The community also adheres to the [code of conduct](https://github.com/ModelEngine-Group/nexent/blob/main/CODE_OF_CONDUCT.md).
In terms of licensing, please take a minute to read our short [License and Contributor Agreement](https://modelengine-group.github.io/nexent/en/license). The community also adheres to the [code of conduct](https://modelengine-group.github.io/nexent/en/code-of-conduct).

## 🤔 How You Can Contribute

Expand Down Expand Up @@ -86,7 +86,7 @@ git checkout -b your-branch-name
```

### Step 4 Make Your Changes
🧙‍♂️ Code like a wizard! Follow our [Development Guide](./DEVELOPPER_NOTE.md) for setup instructions and coding standards. Ensure your changes are well-tested and documented.
🧙‍♂️ Code like a wizard! Follow our [Development Guide](https://modelengine-group.github.io/nexent/en/getting-started/development-guide) for setup instructions and coding standards. Ensure your changes are well-tested and documented.

### Step 5 Commit Your Changes
📝 Commit with a clear and concise message following our commit message guidelines:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

感谢您考虑为 Nexent 贡献力量!无论是代码、文档还是经验分享,您的每一份付出都能让 Nexent 变得更好。如果您愿意向他人推荐 Nexent 或在仓库点个 ⭐️,我们也非常感激。万分感谢!💛 让我们一起打造非凡之作!🎉

关于许可证,请花一分钟阅读我们简短的[许可和贡献者协议](https://github.com/ModelEngine-Group/nexent/blob/main/LICENSE)。同时也请遵循[社区行为准则](https://github.com/ModelEngine-Group/nexent/blob/main/CODE_OF_CONDUCT.md)。
关于许可证,请花一分钟阅读我们简短的[许可和贡献者协议](https://modelengine-group.github.io/nexent/zh/license)。同时也请遵循[社区行为准则](https://modelengine-group.github.io/nexent/zh/code-of-conduct)。

## 🤔 如何贡献

Expand Down Expand Up @@ -89,7 +89,7 @@ git checkout -b 您的分支名
```

### 第四步:进行更改
🧙‍♂️ 像魔法师一样编码!遵循我们的 [开发指南](./DEVELOPPER_NOTE_CN.md) 获取设置说明和编码标准。确保您的更改经过充分测试并有文档记录。
🧙‍♂️ 像魔法师一样编码!遵循我们的 [开发指南](https://modelengine-group.github.io/nexent/zh/getting-started/development-guide) 获取设置说明和编码标准。确保您的更改经过充分测试并有文档记录。

### 第五步:提交更改
📝 按照我们的提交消息规范,提交清晰简洁的消息(建议采用英文,让更多人理解你):
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPPER_NOTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,6 @@ docker builder prune -f && docker system prune -f
5. System prompts need thorough testing

### Getting Help 💬
- Check the [FAQ](FAQ.md)
- Check Our [Documentation](https://modelengine-group.github.io/nexent/en/getting-started/overview)
- Join our [Discord community](https://discord.gg/tb5H3S3wyv)
- Submit [GitHub Issues](https://github.com/ModelEngine-Group/nexent/issues)
2 changes: 1 addition & 1 deletion DEVELOPPER_NOTE_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,6 @@ docker builder prune -f && docker system prune -f
5. 系统提示词需充分测试

### 获取帮助 💬
- 查看 [常见问题](FAQ_CN.md)
- 查看 [我们的文档](https://modelengine-group.github.io/nexent/zh/getting-started/overview)
- 加入 [Discord 社区](https://discord.gg/tb5H3S3wyv)
- 提交 [GitHub Issues](https://github.com/ModelEngine-Group/nexent/issues)
Loading