feat: 实现ChatGPT Codex路由器的核心功能
- 添加完整的项目基础结构,包括配置、类型定义和常量 - 实现OAuth认证流程和令牌管理 - 开发请求转换和响应处理逻辑 - 添加SSE流处理和ChatCompletions API转换 - 实现模型映射和提示指令系统 - 包含Docker部署配置和快速启动文档 - 添加自动登录功能和测试脚本
This commit is contained in:
59
docker/.dockerignore
Normal file
59
docker/.dockerignore
Normal file
@@ -0,0 +1,59 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
yarn-debug.log
|
||||
yarn-error.log
|
||||
pnpm-debug.log
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
pnpm-lock.yaml
|
||||
|
||||
# Build output
|
||||
dist/
|
||||
build/
|
||||
*.tsbuildinfo
|
||||
|
||||
# Test
|
||||
test/
|
||||
vitest.config.ts
|
||||
coverage/
|
||||
*.lcov
|
||||
|
||||
# Environment variables
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Logs
|
||||
logs/
|
||||
*.log
|
||||
|
||||
# Data directory
|
||||
data/
|
||||
*.json
|
||||
!package.json
|
||||
!package-lock.json
|
||||
!tsconfig.json
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
.DS_Store
|
||||
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Documentation
|
||||
README.md
|
||||
CHANGELOG.md
|
||||
LICENSE
|
||||
plan.md
|
||||
docs/
|
||||
|
||||
# Keep directory placeholders
|
||||
!.gitkeep
|
||||
!data/.gitkeep
|
||||
!logs/.gitkeep
|
||||
32
docker/Dockerfile
Normal file
32
docker/Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
FROM oven/bun:1.1-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
COPY package.json package-lock.json ./
|
||||
RUN bun install --production
|
||||
|
||||
# Copy source code
|
||||
COPY src/ ./src/
|
||||
COPY public/ ./public/
|
||||
COPY tsconfig.json ./
|
||||
|
||||
# Build the project
|
||||
RUN bun run build
|
||||
|
||||
# Create data and logs directories
|
||||
RUN mkdir -p /app/data /app/logs
|
||||
|
||||
# Expose ports
|
||||
EXPOSE 3000 1455
|
||||
|
||||
# Set environment variables
|
||||
ENV PORT=3000
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD bun run -e "fetch('http://localhost:3000/health').then(r => process.exit(r.ok ? 0 : 1))"
|
||||
|
||||
# Start the server
|
||||
CMD ["bun", "run", "start"]
|
||||
32
docker/docker-compose.yml
Normal file
32
docker/docker-compose.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
chatgpt-codex-router:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile
|
||||
container_name: chatgpt-codex-router
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "1455:1455"
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
- ./logs:/app/logs
|
||||
- ./config.json:/app/.chatgpt-codex-router/config.json:ro
|
||||
environment:
|
||||
- PORT=3000
|
||||
- LOG_LEVEL=info
|
||||
- NODE_ENV=production
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "bun", "run", "-e", "fetch('http://localhost:3000/health').then(r => process.exit(r.ok ? 0 : 1))"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 5s
|
||||
networks:
|
||||
- chatgpt-router-network
|
||||
|
||||
networks:
|
||||
chatgpt-router-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user