Skip to content

Commit f8a693f

Browse files
author
shijiashuai
committed
feat: 重构项目架构,完善数字人核心功能
- 后端: 新增 session/speech API, ASR/TTS 服务, 异常处理中间件 - 前端: 核心模块重组(audio/avatar/dialogue/vision), 新增 hooks - 配置: 完善 CI/CD, 代码规范, 环境变量管理 - 测试: 添加 API 和对话服务测试
1 parent 4a447f8 commit f8a693f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2955
-3080
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[Makefile]
15+
indent_style = tab

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Backend dialogue service URL
2+
VITE_API_BASE_URL=http://localhost:8000

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,72 @@ on:
55
branches:
66
- main
77
- master
8+
paths:
9+
- '.github/workflows/ci.yml'
10+
- '.github/workflows/pages.yml'
11+
- 'src/**'
12+
- 'public/**'
13+
- 'server/**'
14+
- 'index.html'
15+
- 'package.json'
16+
- 'package-lock.json'
17+
- 'vite.config.ts'
18+
- 'tsconfig*.json'
819
pull_request:
20+
paths:
21+
- '.github/workflows/ci.yml'
22+
- '.github/workflows/pages.yml'
23+
- 'src/**'
24+
- 'public/**'
25+
- 'server/**'
26+
- 'index.html'
27+
- 'package.json'
28+
- 'package-lock.json'
29+
- 'vite.config.ts'
30+
- 'tsconfig*.json'
31+
32+
permissions:
33+
contents: read
34+
pull-requests: read
35+
36+
concurrency:
37+
group: ci-${{ github.workflow }}-${{ github.ref }}
38+
cancel-in-progress: true
939

1040
jobs:
41+
changes:
42+
runs-on: ubuntu-latest
43+
outputs:
44+
frontend: ${{ steps.filter.outputs.frontend }}
45+
backend: ${{ steps.filter.outputs.backend }}
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
52+
- name: Detect changed areas
53+
id: filter
54+
uses: dorny/paths-filter@v3
55+
with:
56+
filters: |
57+
frontend:
58+
- '.github/workflows/ci.yml'
59+
- '.github/workflows/pages.yml'
60+
- 'src/**'
61+
- 'public/**'
62+
- 'index.html'
63+
- 'package.json'
64+
- 'package-lock.json'
65+
- 'vite.config.ts'
66+
- 'tsconfig*.json'
67+
backend:
68+
- '.github/workflows/ci.yml'
69+
- 'server/**'
70+
1171
frontend:
72+
needs: changes
73+
if: needs.changes.outputs.frontend == 'true'
1274
runs-on: ubuntu-latest
1375
steps:
1476
- name: Checkout
@@ -26,13 +88,21 @@ jobs:
2688
- name: Lint
2789
run: npm run lint
2890

91+
- name: Format check
92+
run: npm run format:check
93+
94+
- name: Type check
95+
run: npm run typecheck
96+
2997
- name: Test
3098
run: npm run test:run
3199

32100
- name: Build
33101
run: npm run build
34102

35103
backend:
104+
needs: changes
105+
if: needs.changes.outputs.backend == 'true'
36106
runs-on: ubuntu-latest
37107
steps:
38108
- name: Checkout

.github/workflows/pages.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Deploy Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- '.github/workflows/pages.yml'
9+
- 'src/**'
10+
- 'public/**'
11+
- 'index.html'
12+
- 'package.json'
13+
- 'package-lock.json'
14+
- 'vite.config.ts'
15+
- 'tsconfig*.json'
16+
workflow_dispatch:
17+
18+
permissions:
19+
contents: read
20+
pages: write
21+
id-token: write
22+
23+
concurrency:
24+
group: pages
25+
cancel-in-progress: true
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
env:
31+
VITE_API_BASE_URL: ${{ vars.VITE_API_BASE_URL }}
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Setup Node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: "18"
40+
cache: npm
41+
42+
- name: Install dependencies
43+
run: npm ci
44+
45+
- name: Verify API base URL
46+
run: |
47+
if [ -z "$VITE_API_BASE_URL" ]; then
48+
echo "Repository variable VITE_API_BASE_URL is required for GitHub Pages deployments."
49+
exit 1
50+
fi
51+
52+
- name: Setup Pages
53+
uses: actions/configure-pages@v5
54+
55+
- name: Build site
56+
run: npm run build:pages
57+
58+
- name: Upload artifact
59+
uses: actions/upload-pages-artifact@v3
60+
with:
61+
path: ./dist
62+
63+
deploy:
64+
environment:
65+
name: github-pages
66+
url: ${{ steps.deployment.outputs.page_url }}
67+
runs-on: ubuntu-latest
68+
needs: build
69+
steps:
70+
- name: Deploy to GitHub Pages
71+
id: deployment
72+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,35 @@ dist-ssr
2323
*.sln
2424
*.sw?
2525

26+
# Python
2627
__pycache__/
27-
*.pyc
28+
*.py[cod]
29+
*$py.class
30+
*.so
31+
.Python
32+
.venv/
33+
env/
34+
venv/
35+
ENV/
36+
env.bak/
37+
venv.bak/
38+
.pytest_cache/
39+
.mypy_cache/
40+
.dmypy.json
41+
dmypy.json
42+
*.egg-info/
43+
dist/
44+
build/
45+
46+
# Environment variables
47+
.env
48+
.env.local
49+
.env.*.local
50+
51+
# IDE
52+
*.swp
53+
*.swo
54+
*~
55+
56+
# OS
57+
Thumbs.db

.lintstagedrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
3+
"*.{json,md,css}": ["prettier --write"]
4+
}

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dist
2+
dist-*
3+
coverage
4+
node_modules
5+
package-lock.json
6+
*.min.js
7+
*.min.css

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"bracketSpacing": true,
8+
"arrowParens": "always",
9+
"endOfLine": "lf"
10+
}

0 commit comments

Comments
 (0)