Compare commits

...

29 Commits

Author SHA1 Message Date
943f36e9ec Merge pull request '部署优化' (#116) from feat/build into develop
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/116
2026-06-14 21:25:06 +08:00
083ede8b6d feat: 部署优化 2026-06-14 21:24:11 +08:00
7ea6c0d4f2 Merge pull request '版本升级' (#113) from develop into main
All checks were successful
Deploy / deploy (push) Successful in 1m36s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/113
2026-06-14 20:44:51 +08:00
638a387550 Merge pull request 'fix: 修复 ChatPanel vadError 属性类型不匹配导致构建失败' (#110) from develop into main
All checks were successful
Deploy / deploy (push) Successful in 1m30s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/110
2026-06-14 20:11:19 +08:00
6ce36e3ed8 Merge pull request 'fix: 更换 PostgreSQL 镜像源' (#108) from develop into main
Some checks failed
Deploy / deploy (push) Failing after 1m22s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/108
2026-06-14 20:00:02 +08:00
f22243a2d2 Merge pull request 'fix: 更换 PostgreSQL 镜像源为轩辕镜像,修复阿里云镜像拉取失败' (#105) from develop into main
Some checks failed
Deploy / deploy (push) Failing after 14s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/105
2026-06-14 19:52:04 +08:00
eba0607f94 Merge pull request 'Merge pull request 'fix: 移除未使用的变量和导入,修复 tsc 编译错误'' (#103) from develop into main
Some checks failed
Deploy / deploy (push) Failing after 17s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/103
2026-06-14 19:44:35 +08:00
1f19435951 Merge pull request 'Merge pull request 'feat: 添加 PostgreSQL 服务并挂载数据库迁移脚本'' (#101) from develop into main
Some checks failed
Deploy / deploy (push) Failing after 1m32s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/101
2026-06-14 19:25:37 +08:00
74cd6c7d2d Merge pull request 'chore: 硬编码公网 IP 地址' (#90) from develop into main
All checks were successful
Deploy / deploy (push) Successful in 10s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/90
2026-06-14 15:29:29 +08:00
6b99336941 Merge pull request 'chore: 部署完成回显显示公网 IP' (#88) from develop into main
All checks were successful
Deploy / deploy (push) Successful in 8s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/88
2026-06-14 15:28:09 +08:00
12eec6fc0e Merge pull request 'chore: 前端端口改为 9000' (#86) from develop into main
All checks were successful
Deploy / deploy (push) Successful in 9s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/86
2026-06-14 15:24:50 +08:00
0ba2f9807c Merge pull request 'ci: 添加国内镜像代理和 BuildKit 缓存优化构建速度' (#84) from develop into main
Some checks failed
Deploy / deploy (push) Failing after 5m26s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/84
2026-06-14 15:15:13 +08:00
91fdc007f7 Merge pull request 'ci: 简化 Docker CLI 安装,仅使用 apk' (#82) from develop into main
Some checks failed
Deploy / deploy (push) Has been cancelled
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/82
2026-06-14 15:11:38 +08:00
443f613fbd Merge pull request 'ci: 修复部署脚本找不到 docker 命令的问题' (#80) from develop into main
Some checks failed
Deploy / deploy (push) Failing after 18s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/80
2026-06-14 15:09:52 +08:00
35372438a5 Merge pull request 'ci: 合并 workflow,仅保留 push main 时自动部署' (#78) from develop into main
Some checks failed
Deploy / deploy (push) Failing after 1s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/78
2026-06-14 15:02:54 +08:00
97484735cf Merge pull request 'fix: 修复并优化部署流程' (#75) from develop into main
Some checks failed
Backend CI / ci (push) Successful in 1m50s
Deploy / verify (push) Has been skipped
Deploy / deploy (push) Failing after 1s
Frontend CI / ci (push) Successful in 2m11s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/75
2026-06-14 14:57:20 +08:00
2f05b5fa2b Merge pull request 'Merge pull request 'fix: 修复 deploy 工作流缺少 Node.js 导致 checkout 失败的问题'' (#72) from develop into main
Some checks failed
Backend CI / ci (push) Successful in 1m49s
Deploy / verify (push) Has been skipped
Deploy / deploy (push) Failing after 3s
Frontend CI / ci (push) Successful in 1m22s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/72
2026-06-14 14:37:26 +08:00
213aa67e9f Merge pull request 'develop' (#48) from develop into main
Some checks failed
Backend CI / ci (push) Failing after 2m29s
Frontend CI / ci (push) Successful in 1m9s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/48
2026-06-13 20:58:46 +08:00
5eeb592bf0 Merge pull request 'Merge pull request '添加计时器,麦克风,摄像头开关' (#45) from develop-frontend8 into develop 33分钟前' (#46) from develop into main
Some checks failed
Backend CI / ci (push) Failing after 1m24s
Frontend CI / ci (push) Successful in 38s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/46
2026-06-13 20:43:07 +08:00
46cf35967e Merge pull request 'docs' (#25) from docs into main
All checks were successful
Backend CI / ci (push) Successful in 1m6s
Frontend CI / ci (push) Successful in 3m33s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/25
2026-06-13 13:35:48 +08:00
d5ee6deeb9 Merge pull request 'develop' (#23) from develop into main
Some checks failed
Backend CI / ci (push) Has been cancelled
Frontend CI / ci (push) Has been cancelled
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/23
2026-06-13 11:46:56 +08:00
31dfabd882 Merge pull request 'develop' (#21) from develop into main
All checks were successful
Backend CI / ci (push) Successful in 1m4s
Frontend CI / ci (push) Successful in 27s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/21
2026-06-13 11:42:08 +08:00
bab67a8749 Merge pull request 'develop' (#19) from develop into main
Some checks failed
Backend CI / ci (push) Failing after 2s
Frontend CI / ci (push) Successful in 25s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/19
2026-06-13 11:39:28 +08:00
5d70bc8862 Merge pull request 'develop' (#17) from develop into main
Some checks failed
Frontend CI / ci (push) Failing after 0s
Backend CI / ci (push) Failing after 1s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/17
2026-06-13 11:31:34 +08:00
c0279e94c7 Merge pull request 'develop' (#15) from develop into main
Some checks failed
Backend CI / ci (push) Failing after 2s
Frontend CI / ci (push) Failing after 1s
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/15
Reviewed-by: cfy777 <3087823110@qq.com>
2026-06-13 11:21:08 +08:00
c68657bf30 Merge pull request 'develop' (#13) from develop into main
Some checks failed
Frontend CI / ci (push) Failing after 2s
Backend CI / ci (push) Has been cancelled
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/13
Reviewed-by: cfy777 <3087823110@qq.com>
2026-06-13 10:44:50 +08:00
5e89ab01bd Merge pull request 'develop' (#11) from develop into main
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/11
Reviewed-by: cfy777 <3087823110@qq.com>
2026-06-13 10:36:28 +08:00
60fc3ac5d1 Merge pull request 'develop' (#9) from develop into main
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/9
Reviewed-by: cfy777 <3087823110@qq.com>
2026-06-13 10:27:59 +08:00
0a0eaf7eb9 Merge pull request 'develop' (#7) from develop into main
Reviewed-on: http://8.161.227.145:3000/XEngineers/CamTalk/pulls/7
Reviewed-by: cfy777 <3087823110@qq.com>
2026-06-13 10:08:12 +08:00
6 changed files with 89 additions and 17 deletions

4
frontend/.gitignore vendored
View File

@@ -12,9 +12,11 @@ dist
dist-ssr
*.local
# VAD 静态资源(从 node_modules 自动复制)
# VAD / ONNX Runtime 静态资源(从 node_modules 自动复制)
public/silero_vad_*.onnx
public/vad.worklet.bundle.min.js
public/ort-wasm*.mjs
public/ort-wasm*.wasm
# Editor directories and files
.vscode/*

View File

@@ -0,0 +1,8 @@
{
"hash": "949ba93d",
"configHash": "caf561c6",
"lockfileHash": "76f9e0b5",
"browserHash": "26e6c47e",
"optimized": {},
"chunks": {}
}

View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

View File

@@ -5,6 +5,10 @@ server {
root /usr/share/nginx/html;
index index.html;
# 跨域隔离头SharedArrayBuffer / WASM 线程模式所需)
add_header Cross-Origin-Opener-Policy "same-origin";
add_header Cross-Origin-Embedder-Policy "require-corp";
# 前端静态资源
location / {
try_files $uri $uri/ /index.html;
@@ -33,7 +37,35 @@ server {
proxy_send_timeout 86400s;
}
# 静态资源缓存
# ONNX Runtime WASM 模块(.mjs 必须是 JS MIME 类型)
location ~* \.mjs$ {
types { }
default_type application/javascript;
expires 7d;
add_header Cache-Control "public, immutable";
add_header Cross-Origin-Opener-Policy "same-origin";
add_header Cross-Origin-Embedder-Policy "require-corp";
}
# WebAssembly 二进制文件
location ~* \.wasm$ {
types { }
default_type application/wasm;
expires 7d;
add_header Cache-Control "public, immutable";
add_header Cross-Origin-Opener-Policy "same-origin";
add_header Cross-Origin-Embedder-Policy "require-corp";
}
# ONNX 模型文件
location ~* \.onnx$ {
types { }
default_type application/octet-stream;
expires 7d;
add_header Cache-Control "public, immutable";
}
# 其他静态资源缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 7d;
add_header Cache-Control "public, immutable";
@@ -41,6 +73,6 @@ server {
# Gzip 压缩
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/wasm;
gzip_min_length 256;
}

View File

@@ -50,8 +50,9 @@ export function useVAD(options?: VADOptions) {
getStream: () => Promise.resolve(stream),
startOnLoad: true,
model: "legacy",
// 指向 node_modules 中的 WASM 文件由 Vite 中间件提供)
onnxWASMBasePath: "/node_modules/onnxruntime-web/dist/",
// WASM 和模型文件由 Vite 插件复制到 public/ (即 dist 根目录)
onnxWASMBasePath: "/",
modelURL: "/silero_vad_legacy.onnx",
onSpeechStart: () => {
setIsSpeaking(true);

View File

@@ -7,13 +7,34 @@ const ortDistDir = path.resolve(__dirname, 'node_modules/onnxruntime-web/dist')
const vadDistDir = path.resolve(__dirname, 'node_modules/@ricky0123/vad-web/dist')
const publicDir = path.resolve(__dirname, 'public')
// 需要复制到 public 的静态资源
const staticFiles = [
// 需要复制到 public 的 VAD 模型/工作线程
const vadFiles = [
{ src: vadDistDir, name: 'silero_vad_legacy.onnx' },
{ src: vadDistDir, name: 'silero_vad_v5.onnx' },
{ src: vadDistDir, name: 'vad.worklet.bundle.min.js' },
]
// 需要复制到 public 的 ONNX Runtime WASM 文件(生产环境需要)
const ortFiles = [
{ src: ortDistDir, name: 'ort-wasm-simd-threaded.mjs' },
{ src: ortDistDir, name: 'ort-wasm-simd-threaded.wasm' },
{ src: ortDistDir, name: 'ort-wasm-simd.mjs' },
{ src: ortDistDir, name: 'ort-wasm-simd.wasm' },
{ src: ortDistDir, name: 'ort-wasm.mjs' },
{ src: ortDistDir, name: 'ort-wasm.wasm' },
]
/** 把所需文件复制到 public 目录(不存在则复制) */
function copyAssetsToPublic() {
for (const { src, name } of [...vadFiles, ...ortFiles]) {
const srcFile = path.join(src, name)
const destFile = path.join(publicDir, name)
if (fs.existsSync(srcFile) && !fs.existsSync(destFile)) {
fs.copyFileSync(srcFile, destFile)
}
}
}
export default defineConfig({
server: {
proxy: {
@@ -30,21 +51,15 @@ export default defineConfig({
react(),
{
name: 'serve-vad-assets',
// 1. 启动时将 VAD 模型/工作线程复制到 public
// 1. 启动时将 VAD 模型 + ORT WASM 复制到 public
configResolved() {
for (const { src, name } of staticFiles) {
const dest = path.join(publicDir, name)
if (!fs.existsSync(dest)) {
fs.copyFileSync(path.join(src, name), dest)
}
}
copyAssetsToPublic()
},
// 2. 中间件拦截所有 WASM 相关请求,从原始路径提供文件
// 2. 开发模式中间件拦截 WASM 相关请求,确保 MIME 类型正确
configureServer(server) {
server.middlewares.use((req, res, next) => {
const url = req.url?.split('?')[0] ?? ''
// 匹配任意路径下的 ort-wasm 文件(包括 .vite/deps/ 和根路径)
const wasmMatch = url.match(/\/(ort-wasm-simd-threaded\.(mjs|wasm))$/)
const wasmMatch = url.match(/\/(ort-wasm[\w-]*\.(mjs|wasm))$/)
if (wasmMatch) {
const fileName = wasmMatch[1]
const filePath = path.join(ortDistDir, fileName)
@@ -58,6 +73,17 @@ export default defineConfig({
next()
})
},
// 3. 构建阶段确保所有资源都在 dist 中
writeBundle() {
const distDir = path.resolve(__dirname, 'dist')
for (const { src, name } of [...vadFiles, ...ortFiles]) {
const srcFile = path.join(src, name)
const destFile = path.join(distDir, name)
if (fs.existsSync(srcFile) && !fs.existsSync(destFile)) {
fs.copyFileSync(srcFile, destFile)
}
}
},
},
],
})