比较提交

...

9 次代码提交

作者 SHA1 备注 提交日期
cryptocommuniums-afk
f0bbe4c82f Update changelog release metadata 2026-03-16 12:01:58 +08:00
cryptocommuniums-afk
4fb2d092d7 Add auto archived overlay recordings for live analysis 2026-03-16 11:59:51 +08:00
cryptocommuniums-afk
e3fe9a8e7b Add free full-body 3D live camera avatar examples 2026-03-15 22:32:09 +08:00
cryptocommuniums-afk
fe5e539a47 Add 10 free animal live camera avatars 2026-03-15 22:02:18 +08:00
cryptocommuniums-afk
139dc61b61 Fix live camera gorilla avatar preset 2026-03-15 21:03:06 +08:00
cryptocommuniums-afk
264d49475b Sync changelog with repo version 5c2dcf2 2026-03-15 18:05:45 +08:00
cryptocommuniums-afk
5c2dcf23ba Add leave-state hints for live analysis 2026-03-15 18:05:33 +08:00
cryptocommuniums-afk
3763f5b515 Sync changelog with repo version 1ce94f6 2026-03-15 17:39:34 +08:00
cryptocommuniums-afk
1ce94f6f57 Collapse training generator into right rail 2026-03-15 17:39:20 +08:00
修改 25 个文件,包含 2869 行新增342 行删除

查看文件

@@ -0,0 +1,22 @@
3D full-body avatar preview cutouts in this folder are derived from the Open Source Avatars registry:
https://github.com/ToxSam/open-source-avatars
Registry summary:
- Registry metadata/docs license: CC0
- Individual avatars used here: CC0 from collection "100Avatars R3"
Integrated examples:
- BeachKing
Preview source: https://arweave.net/EGCdxkfTjjmNS4RGiAT_or17mG3717qnZ7R1EnZxLg8
Model source: https://arweave.net/uKhDMselhdUyeJKjelpuVsL8s-a9v_Wqq75TQfCfnos
- Jenny
Preview source: https://arweave.net/4a6_AfH-PHvFMXqja7V42pF9hCn9ceIj5z5NAsK2SSs
Model source: https://arweave.net/kgTirc4OvUWbJhIKC2CB3_pYsYuB62KTj90IdE8s3sk
- Juanita
Preview source: https://arweave.net/5RHeIXD9fezkpuFJS1TRtGkNIVfTKZP7Rkmh9pDmaTs
Model source: https://arweave.net/nyMyZZx5lN2DXsmBgbGQSnt3PuXYN7AAjz9QJrjitLo
- SportTV
Preview source: https://arweave.net/_Qic8KV5P5mo5wJ2N3lbqX0iGVxtVDn4CxCUiM5-Qcg
Model source: https://arweave.net/ISYr7xBXT_s4tLddbhFB3PpUhWg-H_BYs2UZhVLF1hA
Local files are optimized transparent WebP derivatives for faster in-browser overlay rendering.

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 18 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 26 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 20 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 19 KiB

查看文件

@@ -0,0 +1,20 @@
Animal avatar SVG assets in this folder are sourced from Twemoji.
Source:
https://github.com/jdecked/twemoji
Selected assets:
- gorilla.svg
- monkey.svg
- dog.svg
- pig.svg
- cat.svg
- fox.svg
- panda.svg
- lion.svg
- tiger.svg
- rabbit.svg
License:
CC-BY 4.0
https://creativecommons.org/licenses/by/4.0/

查看文件

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#FFCC4D" d="M32.348 13.999s3.445-8.812 1.651-11.998c-.604-1.073-8 1.998-10.723 5.442 0 0-2.586-.86-5.276-.86s-5.276.86-5.276.86C10.001 3.999 2.605.928 2.001 2.001.207 5.187 3.652 13.999 3.652 13.999c-.897 1.722-1.233 4.345-1.555 7.16-.354 3.086.35 5.546.658 6.089.35.617 2.123 2.605 4.484 4.306 3.587 2.583 8.967 3.445 10.761 3.445s7.174-.861 10.761-3.445c2.361-1.701 4.134-3.689 4.484-4.306.308-.543 1.012-3.003.659-6.089-.324-2.814-.659-5.438-1.556-7.16z"/><path fill="#F18F26" d="M2.359 2.971c.2-.599 5.348 2.173 6.518 5.404 0 0-3.808 2.624-4.528 4.624 0 0-2.99-7.028-1.99-10.028z"/><path fill="#FFCC4D" d="M5.98 7.261c0-1.414 5.457 2.733 4.457 3.733s-1.255.72-2.255 1.72S5.98 8.261 5.98 7.261z"/><path fill="#F18F26" d="M33.641 2.971c-.2-.599-5.348 2.173-6.518 5.404 0 0 3.808 2.624 4.528 4.624 0 0 2.99-7.028 1.99-10.028z"/><path fill="#FFCC4D" d="M30.02 7.261c0-1.414-5.457 2.733-4.457 3.733s1.255.72 2.255 1.72 2.202-4.453 2.202-5.453z"/><path fill="#292F33" d="M14.001 20.001c0 1.105-.896 1.999-2 1.999s-2-.894-2-1.999c0-1.104.896-1.999 2-1.999s2 .896 2 1.999zm11.998 0c0 1.105-.896 1.999-2 1.999-1.105 0-2-.894-2-1.999 0-1.104.895-1.999 2-1.999s2 .896 2 1.999z"/><path fill="#FEE7B8" d="M2.201 30.458c-.148 0-.294-.065-.393-.19-.171-.217-.134-.531.083-.702.162-.127 4.02-3.12 10.648-2.605.275.021.481.261.46.536-.021.275-.257.501-.537.46-6.233-.474-9.915 2.366-9.951 2.395-.093.07-.202.106-.31.106zm8.868-4.663c-.049 0-.1-.007-.149-.022-4.79-1.497-8.737-.347-8.777-.336-.265.081-.543-.07-.623-.335-.079-.265.071-.543.335-.622.173-.052 4.286-1.247 9.362.338.264.083.411.363.328.627-.066.213-.263.35-.476.35zm22.73 4.663c.148 0 .294-.065.393-.19.171-.217.134-.531-.083-.702-.162-.127-4.02-3.12-10.648-2.605-.275.021-.481.261-.46.536.022.275.257.501.537.46 6.233-.474 9.915 2.366 9.951 2.395.093.07.202.106.31.106zm-8.868-4.663c.049 0 .1-.007.149-.022 4.79-1.497 8.737-.347 8.777-.336.265.081.543-.07.623-.335.079-.265-.071-.543-.335-.622-.173-.052-4.286-1.247-9.362.338-.264.083-.411.363-.328.627.066.213.263.35.476.35z"/><path fill="#67757F" d="M24.736 30.898c-.097-.258-.384-.392-.643-.294-.552.206-1.076.311-1.559.311-1.152 0-1.561-.306-2.033-.659-.451-.338-.956-.715-1.99-.803v-2.339c0-.276-.224-.5-.5-.5s-.5.224-.5.5v2.373c-.81.115-1.346.439-1.816.743-.568.367-1.059.685-2.083.685-.482 0-1.006-.104-1.558-.311-.258-.095-.547.035-.643.294-.097.259.035.547.293.644.664.247 1.306.373 1.907.373 1.319 0 2.014-.449 2.627-.845.524-.339.98-.631 1.848-.635.992.008 1.358.278 1.815.621.538.403 1.147.859 2.633.859.601 0 1.244-.126 1.908-.373.259-.097.391-.385.294-.644z"/><path fill="#E75A70" d="M19.4 24.807h-2.8c-.64 0-1.163.523-1.163 1.163 0 .639.523 1.163 1.163 1.163h.237v.345c0 .639.523 1.163 1.163 1.163s1.163-.523 1.163-1.163v-.345h.237c.639 0 1.163-.523 1.163-1.163s-.524-1.163-1.163-1.163z"/><path fill="#F18F26" d="M18.022 17.154c-.276 0-.5-.224-.5-.5V8.37c0-.276.224-.5.5-.5s.5.224.5.5v8.284c0 .277-.223.5-.5.5zM21 15.572c-.276 0-.5-.224-.5-.5 0-2.882 1.232-5.21 1.285-5.308.13-.244.435-.334.677-.204.243.13.334.433.204.677-.012.021-1.166 2.213-1.166 4.835 0 .276-.224.5-.5.5zm-6 0c-.276 0-.5-.224-.5-.5 0-2.623-1.155-4.814-1.167-4.835-.13-.244-.038-.546.205-.677.242-.131.545-.039.676.204.053.098 1.285 2.426 1.285 5.308.001.276-.223.5-.499.5z"/></svg>

之后

宽度:  |  高度:  |  大小: 3.3 KiB

查看文件

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#DD2E44" d="M15 27v6s0 3 3 3 3-3 3-3v-6h-6z"/><path fill="#BE1931" d="M15 33l.001.037c1.041-.035 2.016-.274 2.632-1.286.171-.281.563-.281.735 0 .616 1.011 1.591 1.251 2.632 1.286V27h-6v6z"/><path fill="#D99E82" d="M31.954 21.619c0 6.276-5 6.276-5 6.276h-18s-5 0-5-6.276c0-6.724 5-18.619 14-18.619s14 12.895 14 18.619z"/><path fill="#F4C7B5" d="M18 20c-7 0-10 3.527-10 6.395 0 3.037 2.462 5.5 5.5 5.5 1.605 0 3.042-.664 4.049-2.767.185-.386.716-.386.901 0 1.007 2.103 2.445 2.767 4.049 2.767 3.038 0 5.5-2.463 5.5-5.5C28 23.527 25 20 18 20z"/><path fill="#292F33" d="M15 22.895c-1 1 2 4 3 4s4-3 3-4-5-1-6 0zM13 19c-1.1 0-2-.9-2-2v-2c0-1.1.9-2 2-2s2 .9 2 2v2c0 1.1-.9 2-2 2zm10 0c-1.1 0-2-.9-2-2v-2c0-1.1.9-2 2-2s2 .9 2 2v2c0 1.1-.9 2-2 2z"/><path fill="#662113" d="M15 3.608C13.941 2.199 11.681.881 2.828 4.2-1.316 5.754.708 17.804 3.935 18.585c1.106 0 4.426 0 4.426-8.852 0-.22-.002-.423-.005-.625C10.35 6.298 12.5 4.857 15 3.608zm18.172.592C24.319.881 22.059 2.199 21 3.608c2.5 1.25 4.65 2.691 6.644 5.501-.003.201-.005.404-.005.625 0 8.852 3.319 8.852 4.426 8.852 3.227-.782 5.251-12.832 1.107-14.386z"/><circle fill="#D99E82" cx="23.5" cy="25.5" r=".5"/><circle fill="#D99E82" cx="11.5" cy="25.5" r=".5"/><circle fill="#D99E82" cx="25.5" cy="27.5" r=".5"/><circle fill="#D99E82" cx="10.5" cy="27.5" r=".5"/><circle fill="#D99E82" cx="23" cy="28" r="1"/><circle fill="#D99E82" cx="13" cy="28" r="1"/><path fill="#380F09" d="M9.883 7.232c-.259-.673-.634-1.397-1.176-1.939-.391-.391-1.023-.391-1.414 0s-.391 1.023 0 1.414c.57.57 1.066 1.934 1.068 2.346.145-.404.839-1.15 1.522-1.821zm16.217 0c.259-.672.634-1.397 1.176-1.939.391-.391 1.023-.391 1.414 0s.391 1.023 0 1.414c-.57.57-1.066 1.934-1.068 2.346-.145-.404-.839-1.15-1.522-1.821z"/></svg>

之后

宽度:  |  高度:  |  大小: 1.8 KiB

查看文件

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#F4900C" d="M13.431 9.802c.658 2.638-8.673 10.489-11.244 4.098C.696 10.197-.606 2.434.874 2.065c1.48-.368 11.9 5.098 12.557 7.737z"/><path fill="#A0041E" d="M11.437 10.355c.96 1.538-1.831 4.561-3.368 5.522-1.538.961-2.899-.552-4.414-4.414-.662-1.689-1.666-6.27-1.103-6.622.562-.351 7.924 3.976 8.885 5.514z"/><path fill="#F4900C" d="M22.557 9.802C21.9 12.441 31.23 20.291 33.802 13.9c1.49-3.703 2.792-11.466 1.312-11.835-1.48-.368-11.899 5.098-12.557 7.737z"/><path fill="#A0041E" d="M24.552 10.355c-.96 1.538 1.831 4.561 3.368 5.522 1.537.961 2.898-.552 4.413-4.414.662-1.688 1.666-6.269 1.104-6.621-.563-.352-7.924 3.975-8.885 5.513z"/><path fill="#F18F26" d="M32.347 26.912c0-.454-.188-1.091-.407-1.687.585.028 1.519.191 2.77.817-.008-.536-.118-.984-.273-1.393.041.02.075.034.116.055-1.103-3.31-3.309-5.517-3.309-5.517h2.206c-2.331-4.663-4.965-8.015-8.075-9.559-1.39-.873-3.688-1.338-7.373-1.339h-.003c-3.695 0-5.996.468-7.385 1.346-3.104 1.547-5.734 4.896-8.061 9.552H4.76s-2.207 2.206-3.311 5.517c.03-.015.055-.025.084-.04-.201.392-.307.847-.282 1.377 1.263-.632 2.217-.792 2.813-.818-.189.513-.343 1.044-.386 1.475-.123.371-.191.812-.135 1.343C6.75 26.584 8.25 26.792 10 27.667 11.213 31.29 14.206 34 18.001 34c3.793 0 6.746-2.794 7.958-6.416 1.458-1.25 3.708-.875 6.416.416.066-.414.036-.773-.036-1.093l.008.005z"/><path fill="#FFD983" d="M31.243 23.601c.006 0 1.108.003 3.309 1.103-1.249-2.839-7.525-4.07-9.931-3.291-1.171 1.954-1.281 5.003-3.383 6.622-1.741 1.431-4.713 1.458-6.479 0-2.345-1.924-2.559-5.813-3.382-6.622-2.407-.781-8.681.454-9.931 3.291 2.201-1.101 3.304-1.103 3.309-1.103 0 .001-1.103 2.208-1.103 3.311l.001-.001v.001c2.398-1.573 5.116-2.271 7.429-.452 1.666 7.921 12.293 7.545 13.833 0 2.314-1.818 5.03-1.122 7.429.452v-.001l.001.001c.002-1.103-1.101-3.311-1.102-3.311z"/><path fill="#272B2B" d="M11 17s0-1.5 1.5-1.5S14 17 14 17v1.5s0 1.5-1.5 1.5-1.5-1.5-1.5-1.5V17zm11 0s0-1.5 1.5-1.5S25 17 25 17v1.5s0 1.5-1.5 1.5-1.5-1.5-1.5-1.5V17zm-7.061 10.808c-1.021.208 2.041 3.968 3.062 3.968 1.02 0 4.082-3.76 3.062-3.968-1.021-.208-5.103-.208-6.124 0z"/></svg>

之后

宽度:  |  高度:  |  大小: 2.1 KiB

查看文件

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#31373D" d="M5 16c0-4-5-3-4 1s3 5 3 5l1-6zm26 0c0-4 5-3 4 1s-3 5-3 5l-1-6z"/><path fill="#31373D" d="M32.65 21.736c0 10.892-4.691 14.087-14.65 14.087-9.958 0-14.651-3.195-14.651-14.087S8.042.323 18 .323c9.959 0 14.65 10.521 14.65 21.413z"/><path fill="#66757F" d="M27.567 23c1.49-4.458 2.088-7.312-.443-7.312H8.876c-2.532 0-1.933 2.854-.444 7.312C3.504 34.201 17.166 34.823 18 34.823S32.303 33.764 27.567 23z"/><path fill="#31373D" d="M15 18.003c0 1.105-.896 2-2 2s-2-.895-2-2c0-1.104.896-1 2-1s2-.105 2 1zm10 0c0 1.105-.896 2-2 2s-2-.895-2-2c0-1.104.896-1 2-1s2-.105 2 1z"/><ellipse fill="#31373D" cx="15.572" cy="23.655" rx="1.428" ry="1"/><path fill="#31373D" d="M21.856 23.655c0 .553-.639 1-1.428 1-.79 0-1.429-.447-1.429-1 0-.553.639-1 1.429-1s1.428.448 1.428 1z"/><path fill="#99AAB5" d="M21.02 21.04c-1.965-.26-3.02.834-3.02.834s-1.055-1.094-3.021-.834c-3.156.417-3.285 3.287-1.939 3.105.766-.104.135-.938 1.713-1.556 1.579-.616 3.247.66 3.247.66s1.667-1.276 3.246-.659.947 1.452 1.714 1.556c1.346.181 1.218-2.689-1.94-3.106z"/><path fill="#31373D" d="M24.835 30.021c-1.209.323-3.204.596-6.835.596s-5.625-.272-6.835-.596c-3.205-.854-1.923-1.735 0-1.477 1.923.259 3.631.415 6.835.415 3.205 0 4.914-.156 6.835-.415 1.923-.258 3.204.623 0 1.477z"/><path fill="#66757F" d="M4.253 16.625c1.403-1.225-1.078-3.766-2.196-2.544-.341.373.921-.188 1.336 1.086.308.942.001 2.208.86 1.458zm27.493 0c-1.402-1.225 1.078-3.766 2.196-2.544.341.373-.921-.188-1.337 1.086-.306.942 0 2.208-.859 1.458z"/></svg>

之后

宽度:  |  高度:  |  大小: 1.5 KiB

查看文件

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#662113" d="M32.325 10.958s2.315.024 3.511 1.177c-.336-4.971-2.104-8.249-5.944-10.13-3.141-1.119-6.066 1.453-6.066 1.453s.862-1.99 2.19-2.746C23.789.236 21.146 0 18 0c-3.136 0-5.785.227-8.006.701 1.341.745 2.215 2.758 2.215 2.758S9.194.803 6 2.053C2.221 3.949.481 7.223.158 12.174c1.183-1.19 3.55-1.215 3.55-1.215S-.105 13.267.282 16.614c.387 2.947 1.394 5.967 2.879 8.722C3.039 22.15 5.917 20 5.917 20s-2.492 5.96-.581 8.738c1.935 2.542 4.313 4.641 6.976 5.916-.955-1.645-.136-3.044-.103-2.945.042.125.459 3.112 2.137 3.743 1.178.356 2.4.548 3.654.548 1.292 0 2.55-.207 3.761-.583 1.614-.691 2.024-3.585 2.064-3.708.032-.098.843 1.287-.09 2.921 2.706-1.309 5.118-3.463 7.064-6.073 1.699-2.846-.683-8.557-.683-8.557s2.85 2.13 2.757 5.288c1.556-2.906 2.585-6.104 2.911-9.2-.035-3.061-3.459-5.13-3.459-5.13z"/><path fill="#FFCC4D" d="M13.859 9.495c.596 2.392.16 4.422-2.231 5.017-2.392.596-6.363.087-6.958-2.304-.596-2.392.469-5.39 1.81-5.724 1.341-.334 6.784.62 7.379 3.011zm9.104 18.432c0 2.74-2.222 4.963-4.963 4.963s-4.963-2.223-4.963-4.963c0-2.741 2.223-4.964 4.963-4.964 2.741 0 4.963 2.222 4.963 4.964z"/><path fill="#DD2E44" d="M21.309 27.927c0 1.827-1.481 3.309-3.309 3.309s-3.309-1.481-3.309-3.309c0-1.827 1.481-3.31 3.309-3.31s3.309 1.483 3.309 3.31z"/><path fill="#E6AAAA" d="M11.052 8.997c.871 1.393.447 3.229-.946 4.1-1.394.871-2.608.797-3.479-.596-.871-1.394-.186-4.131.324-4.45.51-.319 3.23-.448 4.101.946z"/><path fill="#FFCC4D" d="M22.141 9.495c-.596 2.392-.159 4.422 2.232 5.017 2.392.596 6.363.087 6.959-2.304.596-2.392-.47-5.39-1.811-5.724-1.342-.334-6.786.62-7.38 3.011z"/><path fill="#E6AAAA" d="M24.948 8.997c-.871 1.393-.447 3.229.945 4.1 1.394.871 2.608.797 3.479-.596.871-1.394.185-4.131-.324-4.45-.51-.319-3.229-.448-4.1.946z"/><path fill="#FFCC4D" d="M18 7.125h-.002C5.167 7.126 7.125 12.083 8.5 18.667 9.875 25.25 10.384 27 10.384 27h15.228s.51-1.75 1.885-8.333C28.872 12.083 30.829 7.126 18 7.125z"/><path fill="#272B2B" d="M12 16s0-1.5 1.5-1.5S15 16 15 16v1.5s0 1.5-1.5 1.5-1.5-1.5-1.5-1.5V16zm9 0s0-1.5 1.5-1.5S24 16 24 16v1.5s0 1.5-1.5 1.5-1.5-1.5-1.5-1.5V16z"/><path fill="#FFE8B6" d="M20.168 21.521c-1.598 0-1.385.848-2.168 2.113-.783-1.266-.571-2.113-2.168-2.113-6.865 0-6.837.375-6.865 2.828-.058 4.986 2.802 6.132 5.257 6.06 1.597-.048 2.994-.88 3.777-2.131.783 1.251 2.179 2.083 3.776 2.131 2.455.072 5.315-1.073 5.257-6.06-.029-2.453-.001-2.828-6.866-2.828z"/><path fill="#272B2B" d="M14.582 21.411c-1.14.233 2.279 4.431 3.418 4.431s4.559-4.198 3.419-4.431c-1.14-.232-5.698-.232-6.837 0z"/><circle fill="#D99E82" cx="11.5" cy="24.5" r=".5"/><circle fill="#D99E82" cx="10.5" cy="26.5" r=".5"/><circle fill="#D99E82" cx="12.5" cy="27.5" r=".5"/><circle fill="#D99E82" cx="24.5" cy="24.5" r=".5"/><circle fill="#D99E82" cx="25.5" cy="26.5" r=".5"/><circle fill="#D99E82" cx="23.5" cy="27.5" r=".5"/></svg>

之后

宽度:  |  高度:  |  大小: 2.8 KiB

查看文件

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><ellipse transform="rotate(-14.999 5.05 17.456)" fill="#D79E84" cx="5.05" cy="17.455" rx="3.818" ry="5.455"/><ellipse transform="rotate(-75.001 31.05 17.455)" fill="#D79E84" cx="31.05" cy="17.455" rx="5.455" ry="3.818"/><path fill="#BF6952" d="M19.018 36h-2.036C10.264 36 3.75 30.848 3.75 23.636c0-4.121 1.527-6.182 1.527-6.182s-.509-2.061-.509-4.121C4.768 7.152 11.282 2 18 2c6.718 0 13.232 6.182 13.232 11.333 0 2.061-.509 4.121-.509 4.121s1.527 2.061 1.527 6.182C32.25 30.848 25.736 36 19.018 36z"/><path fill="#D79E84" d="M30 16.042C30 12.153 26.825 9 22.909 9c-1.907 0-3.635.752-4.909 1.968C16.726 9.752 14.998 9 13.091 9 9.175 9 6 12.153 6 16.042c0 2.359 1.172 4.441 2.965 5.719-.503 1.238-.783 2.6-.783 4.031C8.182 31.476 12.578 35 18 35s9.818-3.524 9.818-9.208c0-1.431-.28-2.793-.783-4.031C28.828 20.483 30 18.4 30 16.042z"/><ellipse fill="#292F33" cx="13" cy="17" rx="2.25" ry="3.25"/><ellipse fill="#292F33" cx="23" cy="17" rx="2.25" ry="3.25"/><path fill="#642116" d="M18 32.727c2.838 0 5.254-1.505 6.162-3.61.375-.871-.262-1.844-1.21-1.844h-9.904c-.948 0-1.585.974-1.21 1.844.908 2.105 3.324 3.61 6.162 3.61z"/><circle fill="#642116" cx="16.25" cy="23" r="1"/><circle fill="#642116" cx="19.75" cy="23" r="1"/><path fill="#BF6952" d="M22.66.175s-5.455-1.091-7.636 2.182 4.364 1.091 4.364 1.091S20.478.175 22.66.175z"/></svg>

之后

宽度:  |  高度:  |  大小: 1.4 KiB

查看文件

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><circle fill="#272B2B" cx="7" cy="6" r="6"/><circle fill="#272B2B" cx="29" cy="6" r="6"/><circle fill="#66757F" cx="7" cy="6" r="4"/><circle fill="#66757F" cx="29" cy="6" r="4"/><path fill="#EEE" d="M35 22c0 7-6.375 12-17 12S1 29 1 22C1 22 2.308 0 18 0s17 22 17 22z"/><circle fill="#CCD6DD" cx="18" cy="30" r="6"/><circle fill="#DD2E44" cx="18" cy="30" r="4"/><path fill="#272B2B" d="M20.709 12.654C25.163 9.878 32 17 26.952 22.67 23.463 26.591 20 25 20 25s-2.636-10.26.709-12.346zm-5.442.011C10.813 9.888 3.976 17.01 9.023 22.681c3.49 3.92 6.953 2.329 6.953 2.329s2.636-10.26-.709-12.345z"/><path fill="#66757F" d="M11 17s0-2 2-2 2 2 2 2v2s0 2-2 2-2-2-2-2v-2z"/><path fill="#FFF" d="M18 20S7 23.687 7 27s2.687 6 6 6c2.088 0 3.925-1.067 5-2.685C19.074 31.933 20.912 33 23 33c3.313 0 6-2.687 6-6s-11-7-11-7z"/><path fill="#66757F" d="M21 17s0-2 2-2 2 2 2 2v2s0 2-2 2-2-2-2-2v-2z"/><path fill="#272B2B" d="M13.125 25c-1.624 1 3.25 4 4.875 4s6.499-3 4.874-4-8.124-1-9.749 0z"/></svg>

之后

宽度:  |  高度:  |  大小: 1.0 KiB

查看文件

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#F4ABBA" d="M34.193 13.329c.387-.371.733-.795 1.019-1.28 1.686-2.854.27-10.292-.592-10.8-.695-.411-5.529 1.05-8.246 3.132C23.876 2.884 21.031 2 18 2c-3.021 0-5.856.879-8.349 2.367C6.93 2.293 2.119.839 1.424 1.249c-.861.508-2.276 7.947-.592 10.8.278.471.615.884.989 1.249C.666 15.85 0 18.64 0 21.479 0 31.468 8.011 34 18 34s18-2.532 18-12.521c0-2.828-.66-5.606-1.807-8.15z"/><path fill="#EA596E" d="M7.398 5.965c-2.166-1.267-4.402-2.08-4.8-1.845-.57.337-1.083 4.998-.352 8.265 1.273-2.483 3.04-4.682 5.152-6.42zm26.355 6.419c.733-3.267.219-7.928-.351-8.265-.398-.235-2.635.578-4.801 1.845 2.114 1.739 3.88 3.938 5.152 6.42zM28 23.125c0 4.487-3.097 9.375-10 9.375-6.904 0-10-4.888-10-9.375S11.096 17.5 18 17.5c6.903 0 10 1.138 10 5.625z"/><path fill="#662113" d="M15 24.6c0 1.857-.34 2.4-1.5 2.4s-1.5-.543-1.5-2.4c0-1.856.34-2.399 1.5-2.399s1.5.542 1.5 2.399zm9 0c0 1.857-.34 2.4-1.5 2.4s-1.5-.543-1.5-2.4c0-1.856.34-2.399 1.5-2.399s1.5.542 1.5 2.399z"/><circle fill="#292F33" cx="7" cy="17" r="2"/><circle fill="#292F33" cx="29" cy="17" r="2"/></svg>

之后

宽度:  |  高度:  |  大小: 1.1 KiB

查看文件

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#99AAB5" d="M33.799.005c-.467-.178-7.998 3.971-9.969 9.131-1.166 3.052-1.686 6.058-1.652 8.112C20.709 16.459 19.257 16 18 16s-2.709.458-4.178 1.249c.033-2.055-.486-5.061-1.652-8.112C10.2 3.977 2.668-.173 2.201.005c-.455.174 4.268 16.044 7.025 20.838C6.805 23.405 5 26.661 5 29.828c0 3.234 1.635 5.14 4 5.94 2.531.857 5-.94 9-.94s6.469 1.798 9 .94c2.365-.801 4-2.706 4-5.94 0-3.166-1.805-6.423-4.225-8.984C29.53 16.049 34.255.179 33.799.005z"/><path fill="#F4ABBA" d="M12.692 17.922c-.178-1.54-.68-3.55-1.457-5.584-1.534-4.016-5.686-7.245-6.049-7.107-.319.122 2.627 10.14 4.783 14.863.866-.824 1.786-1.563 2.723-2.172zm13.338 2.172c2.156-4.723 5.102-14.741 4.784-14.862-.363-.139-4.516 3.091-6.05 7.107-.777 2.034-1.279 4.043-1.457 5.583.937.609 1.857 1.348 2.723 2.172z"/><path fill="#CCD6DD" d="M25 30c0 2.762-3.06 5-6.834 5-3.773 0-6.833-2.238-6.833-5s3.06-5 6.833-5C21.94 25 25 27.238 25 30z"/><path fill="#FFF" d="M21 30.578c0 2.762-.238 3-3 3-2.761 0-3-.238-3-3 0-1 6-1 6 0z"/><circle fill="#292F33" cx="12.5" cy="24.328" r="1.5"/><circle fill="#292F33" cx="23.5" cy="24.328" r="1.5"/><path fill="#F4ABBA" d="M21 25.828c0 1.657-2 3-3 3s-3-1.343-3-3 6-1.657 6 0z"/></svg>

之后

宽度:  |  高度:  |  大小: 1.2 KiB

查看文件

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><circle fill="#FFCC4D" cx="7" cy="6" r="6"/><circle fill="#FFCC4D" cx="18" cy="30" r="6"/><circle fill="#DD2E44" cx="18" cy="30" r="4"/><circle fill="#FFCC4D" cx="29" cy="6" r="6"/><circle fill="#E6AAAA" cx="7" cy="6" r="4"/><circle fill="#E6AAAA" cx="29" cy="6" r="4"/><path fill="#FFCC4D" d="M34 22c0 7-4.923 7-4.923 7H6.923S2 29 2 22C2 22 3.231 0 18 0c14.77 0 16 22 16 22z"/><path fill="#272B2B" d="M11 17s0-2 2-2 2 2 2 2v2s0 2-2 2-2-2-2-2v-2zm10 0s0-2 2-2 2 2 2 2v2s0 2-2 2-2-2-2-2v-2z"/><path fill="#FFF" d="M23.678 23c-2.402 0-4.501.953-5.678 2.378C16.823 23.953 14.723 23 12.321 23 2 23 2.043 23.421 2 26.182c-.087 5.61 6.63 6.9 10.321 6.818 2.401-.053 4.502-.989 5.679-2.397 1.177 1.408 3.276 2.345 5.678 2.397 3.691.082 10.409-1.208 10.321-6.818-.043-2.761 0-3.182-10.321-3.182z"/><path fill="#272B2B" d="M33.66 25.242c.204.279.333.588.339.939.03 1.905-.745 3.303-1.915 4.327L26.999 31l6.661-5.758zM15 25c-1 1 2 4 3 4s4-3 3-4-5-1-6 0zM10 3c2.667 2 8 4 8 4s5.333-2 8-4l-8 1-8-1zm8-1s1.652-.62 3.576-1.514C20.48.178 19.295 0 18 0s-2.481.178-3.576.486C16.348 1.38 18 2 18 2zm-7 7c3 2 7 4 7 4s4-2 7-4l-7 1-7-1zm20.645 2.285L27 15l6.006.75c-.334-1.401-.777-2.928-1.361-4.465zm1.911 7.159L28 24h5.835c.102-.595.165-1.251.165-2 0 0-.081-1.43-.444-3.556zm-31.112 0C2.082 20.57 2 22 2 22c0 .748.063 1.405.165 2H8l-5.556-5.556zm-.105 6.798c-.204.279-.333.588-.339.94-.03 1.905.745 3.303 1.916 4.327L9 31l-6.661-5.758zM9 15l-4.644-3.715c-.584 1.537-1.028 3.064-1.361 4.466L9 15z"/></svg>

之后

宽度:  |  高度:  |  大小: 1.5 KiB

查看文件

@@ -8,6 +8,58 @@ export type ChangeLogEntry = {
};
export const CHANGE_LOG_ENTRIES: ChangeLogEntry[] = [
{
version: "2026.03.16-live-analysis-overlay-archive",
releaseDate: "2026-03-16",
repoVersion: "4fb2d09",
summary: "实时分析新增 60 秒自动归档录像,录制内容会保留骨架、关键点和虚拟形象叠层,并同步进入视频库。",
features: [
"实时分析开始后会自动录制合成画布,每 60 秒自动切段归档",
"归档录像会保留原视频、骨架线、关键点和当前虚拟形象覆盖效果",
"归档片段会自动写入视频库,标签显示为“实时分析”",
"删除视频库中的实时分析录像时,不会删除已写入的实时分析数据和训练记录",
"线上 smoke 已确认 `https://te.hao.work/` 已切换到本次新构建,`/live-camera`、`/videos`、`/changelog` 页面均可正常访问",
],
tests: [
"pnpm check",
"pnpm test",
"pnpm build",
"pnpm test:e2e",
"Playwright smoke: 真实站点登录 H1,完成 /live-camera 引导、开始/结束分析,并确认 /videos 可见实时分析条目",
],
},
{
version: "2026.03.15-live-analysis-leave-hint",
releaseDate: "2026-03-15",
repoVersion: "5c2dcf2",
summary: "实时分析结束后增加离开提示,明确何时必须停留、何时可以安全关闭或切页。",
features: [
"分析进行中显示“不要关闭或切走页面”提示",
"结束分析后保存阶段显示“请暂时停留当前页面”提示",
"保存成功后明确提示“现在可以关闭浏览器或切换到其他页面”",
"分析中和保存中挂接 beforeunload 提醒,减少误关页面导致的数据丢失",
],
tests: [
"pnpm check",
"pnpm build",
],
},
{
version: "2026.03.15-training-generator-collapse",
releaseDate: "2026-03-15",
repoVersion: "1ce94f6",
summary: "训练计划生成面板在桌面端默认折叠到右侧,按需展开查看和重新生成。",
features: [
"训练页右侧生成器在桌面端默认折叠为窄栏",
"点击右侧折叠栏可展开“重新生成计划”完整面板",
"移动端继续直接展示完整生成器,避免隐藏关键操作",
"未生成计划时点击“前往生成训练计划”会自动展开并滚动到生成面板",
],
tests: [
"pnpm check",
"pnpm build",
],
},
{
version: "2026.03.15-progress-time-actions",
releaseDate: "2026-03-15",

查看文件

@@ -0,0 +1,129 @@
import { describe, expect, it } from "vitest";
import {
ACTION_WINDOW_FRAMES,
AVATAR_PRESETS,
createStableActionState,
getAvatarAnchors,
getAvatarPreset,
resolveAvatarKeyFromPrompt,
stabilizeActionStream,
type FrameActionSample,
} from "./liveCamera";
function feedSamples(samples: Array<Omit<FrameActionSample, "timestamp">>, intervalMs = 33) {
const history: FrameActionSample[] = [];
const state = createStableActionState();
let lastResult = null as ReturnType<typeof stabilizeActionStream> | null;
samples.forEach((sample, index) => {
lastResult = stabilizeActionStream(
{
...sample,
timestamp: index * intervalMs,
},
history,
state,
);
});
return { history, state, lastResult };
}
describe("live camera action stabilizer", () => {
it("locks a dominant action after a full temporal window", () => {
const samples = Array.from({ length: ACTION_WINDOW_FRAMES * 2 }, () => ({
action: "forehand" as const,
confidence: 0.84,
}));
const { lastResult } = feedSamples(samples);
expect(lastResult?.stableAction).toBe("forehand");
expect(lastResult?.windowAction).toBe("forehand");
expect(lastResult?.pending).toBe(false);
expect(lastResult?.windowShare).toBeGreaterThan(0.9);
});
it("ignores brief action spikes and keeps the stable action", () => {
const stableFrames = Array.from({ length: ACTION_WINDOW_FRAMES * 2 }, () => ({
action: "forehand" as const,
confidence: 0.82,
}));
const noisyFrames = Array.from({ length: 5 }, () => ({
action: "backhand" as const,
confidence: 0.88,
}));
const { lastResult } = feedSamples([...stableFrames, ...noisyFrames]);
expect(lastResult?.stableAction).toBe("forehand");
expect(lastResult?.pending).toBe(false);
});
it("switches only after the next action persists long enough", () => {
const forehandFrames = Array.from({ length: ACTION_WINDOW_FRAMES * 2 }, () => ({
action: "forehand" as const,
confidence: 0.8,
}));
const backhandFrames = Array.from({ length: ACTION_WINDOW_FRAMES * 2 }, () => ({
action: "backhand" as const,
confidence: 0.85,
}));
const { lastResult, state } = feedSamples([...forehandFrames, ...backhandFrames]);
expect(lastResult?.stableAction).toBe("backhand");
expect(state.switchCount).toBeGreaterThanOrEqual(2);
});
it("requires a longer delay before falling back to unknown", () => {
const forehandFrames = Array.from({ length: ACTION_WINDOW_FRAMES * 2 }, () => ({
action: "forehand" as const,
confidence: 0.83,
}));
const unknownFrames = Array.from({ length: 10 }, () => ({
action: "unknown" as const,
confidence: 0.4,
}));
const { lastResult } = feedSamples([...forehandFrames, ...unknownFrames]);
expect(lastResult?.stableAction).toBe("forehand");
});
});
describe("live camera avatar helpers", () => {
it("maps prompt keywords into avatar presets", () => {
expect(resolveAvatarKeyFromPrompt("切换成猩猩形象", "gorilla")).toBe("gorilla");
expect(resolveAvatarKeyFromPrompt("dog mascot", "gorilla")).toBe("dog");
expect(resolveAvatarKeyFromPrompt("狐狸风格", "gorilla")).toBe("fox");
expect(resolveAvatarKeyFromPrompt("兔子教练", "gorilla")).toBe("rabbit");
expect(resolveAvatarKeyFromPrompt("BeachKing 3D 替身", "gorilla")).toBe("beachKing");
expect(resolveAvatarKeyFromPrompt("Juanita avatar", "gorilla")).toBe("juanita3d");
expect(resolveAvatarKeyFromPrompt("", "pig")).toBe("pig");
});
it("exposes full-body 3d avatar examples with CC0 metadata", () => {
const presets = AVATAR_PRESETS.filter((preset) => preset.category === "full-body-3d");
expect(presets).toHaveLength(4);
expect(presets.every((preset) => preset.license === "CC0")).toBe(true);
expect(getAvatarPreset("sportTv")?.modelUrl).toContain("arweave.net");
});
it("builds avatar anchors from pose landmarks", () => {
const landmarks = Array.from({ length: 33 }, () => ({ x: 0.5, y: 0.5, visibility: 0.95 }));
landmarks[0] = { x: 0.5, y: 0.16, visibility: 0.99 };
landmarks[11] = { x: 0.4, y: 0.3, visibility: 0.99 };
landmarks[12] = { x: 0.6, y: 0.3, visibility: 0.99 };
landmarks[15] = { x: 0.28, y: 0.44, visibility: 0.99 };
landmarks[16] = { x: 0.72, y: 0.44, visibility: 0.99 };
landmarks[23] = { x: 0.44, y: 0.58, visibility: 0.99 };
landmarks[24] = { x: 0.56, y: 0.58, visibility: 0.99 };
landmarks[27] = { x: 0.43, y: 0.92, visibility: 0.99 };
landmarks[28] = { x: 0.57, y: 0.92, visibility: 0.99 };
const anchors = getAvatarAnchors(landmarks, 1280, 720);
expect(anchors).not.toBeNull();
expect(anchors?.headRadius).toBeGreaterThan(30);
expect(anchors?.bodyHeight).toBeGreaterThan(120);
expect(anchors?.rightHandX).toBeGreaterThan(anchors?.leftHandX || 0);
});
});

744
client/src/lib/liveCamera.ts 普通文件
查看文件

@@ -0,0 +1,744 @@
export type LiveActionType = "forehand" | "backhand" | "serve" | "volley" | "overhead" | "slice" | "lob" | "unknown";
export type PosePoint = {
x: number;
y: number;
visibility?: number;
};
export type AvatarKey =
| "gorilla"
| "monkey"
| "dog"
| "pig"
| "cat"
| "fox"
| "panda"
| "lion"
| "tiger"
| "rabbit"
| "beachKing"
| "jenny3d"
| "juanita3d"
| "sportTv";
export type AvatarCategory = "animal" | "full-body-3d";
export type AvatarPreset = {
key: AvatarKey;
label: string;
category: AvatarCategory;
keywords: string[];
description?: string;
collection?: string;
license?: string;
sourceUrl?: string;
modelUrl?: string;
};
export type AvatarRenderState = {
enabled: boolean;
avatarKey: AvatarKey;
customLabel?: string;
};
export type FrameActionSample = {
action: LiveActionType;
confidence: number;
timestamp: number;
};
export type StableActionState = {
current: LiveActionType;
currentSince: number | null;
candidate: LiveActionType | null;
candidateSince: number | null;
candidateWindows: number;
switchCount: number;
};
export type StabilizedActionMeta = {
stableAction: LiveActionType;
stableConfidence: number;
windowAction: LiveActionType;
windowConfidence: number;
windowShare: number;
windowFrames: number;
windowProgress: number;
pending: boolean;
pendingAction: LiveActionType | null;
stableMs: number;
candidateMs: number;
rawVolatility: number;
switchCount: number;
};
type ActionStat = {
count: number;
totalConfidence: number;
share: number;
averageConfidence: number;
strength: number;
};
type AvatarAnchors = {
headX: number;
headY: number;
headRadius: number;
bodyX: number;
bodyY: number;
bodyWidth: number;
bodyHeight: number;
shoulderY: number;
footY: number;
leftHandX: number;
leftHandY: number;
rightHandX: number;
rightHandY: number;
};
type AvatarVisualSpec = {
src: string;
bodyFill: string;
limbStroke: string;
glow: string;
renderMode: "badge" | "full-figure";
figureScale?: number;
figureOffsetY?: number;
};
const ACTIONS: LiveActionType[] = ["forehand", "backhand", "serve", "volley", "overhead", "slice", "lob", "unknown"];
export const ACTION_WINDOW_FRAMES = 24;
const ACTION_WINDOW_MIN_SHARE = 0.6;
const ACTION_WINDOW_MIN_CONFIDENCE = 0.58;
const ACTION_SWITCH_MIN_MS = 700;
const ACTION_UNKNOWN_MIN_MS = 900;
const ACTION_LOCK_IN_WINDOWS = 2;
const ACTION_SWITCH_DELTA = 0.12;
export const AVATAR_PRESETS: AvatarPreset[] = [
{ key: "gorilla", label: "猩猩", category: "animal", keywords: ["gorilla", "ape", "猩猩", "猩", "大猩猩"], description: "轻量动物替身,移动端负担最低。" },
{ key: "monkey", label: "猴子", category: "animal", keywords: ["monkey", "ape", "猴", "猴子"], description: "轻量动物替身,适合快速练习。" },
{ key: "dog", label: "狗", category: "animal", keywords: ["dog", "puppy", "犬", "狗", "小狗"], description: "轻量动物替身,覆盖速度快。" },
{ key: "pig", label: "猪", category: "animal", keywords: ["pig", "猪", "小猪"], description: "轻量动物替身,适合低端设备。" },
{ key: "cat", label: "猫", category: "animal", keywords: ["cat", "kitty", "猫", "小猫"], description: "轻量动物替身,适合低码率录制。" },
{ key: "fox", label: "狐狸", category: "animal", keywords: ["fox", "狐狸"], description: "轻量动物替身,动作切换反馈清晰。" },
{ key: "panda", label: "熊猫", category: "animal", keywords: ["panda", "熊猫"], description: "轻量动物替身,适合直播预览。" },
{ key: "lion", label: "狮子", category: "animal", keywords: ["lion", "狮子"], description: "轻量动物替身,轮廓感更强。" },
{ key: "tiger", label: "老虎", category: "animal", keywords: ["tiger", "虎", "老虎"], description: "轻量动物替身,适合训练 PK。" },
{ key: "rabbit", label: "兔子", category: "animal", keywords: ["rabbit", "bunny", "兔", "兔子"], description: "轻量动物替身,适合日常训练。" },
{
key: "beachKing",
label: "BeachKing",
category: "full-body-3d",
keywords: ["beachking", "beach king", "海滩王", "3d beach", "beach avatar"],
description: "CC0 全身 3D 示例,适合覆盖竖屏全身站姿。",
collection: "100Avatars R3",
license: "CC0",
sourceUrl: "https://github.com/ToxSam/open-source-avatars",
modelUrl: "https://arweave.net/uKhDMselhdUyeJKjelpuVsL8s-a9v_Wqq75TQfCfnos",
},
{
key: "jenny3d",
label: "Jenny",
category: "full-body-3d",
keywords: ["jenny", "frog coach", "青蛙教练", "3d jenny", "jenny avatar"],
description: "CC0 全身 3D 示例,适合想要更完整人物轮廓时使用。",
collection: "100Avatars R3",
license: "CC0",
sourceUrl: "https://github.com/ToxSam/open-source-avatars",
modelUrl: "https://arweave.net/kgTirc4OvUWbJhIKC2CB3_pYsYuB62KTj90IdE8s3sk",
},
{
key: "juanita3d",
label: "Juanita",
category: "full-body-3d",
keywords: ["juanita", "粉发学员", "pink avatar", "3d juanita", "juanita avatar"],
description: "CC0 全身 3D 示例,适合教学演示和移动端预览。",
collection: "100Avatars R3",
license: "CC0",
sourceUrl: "https://github.com/ToxSam/open-source-avatars",
modelUrl: "https://arweave.net/nyMyZZx5lN2DXsmBgbGQSnt3PuXYN7AAjz9QJrjitLo",
},
{
key: "sportTv",
label: "SportTV",
category: "full-body-3d",
keywords: ["sporttv", "sport tv", "屏幕街头", "tv avatar", "hoodie avatar"],
description: "CC0 全身 3D 示例,适合训练空间较宽的画面。",
collection: "100Avatars R3",
license: "CC0",
sourceUrl: "https://github.com/ToxSam/open-source-avatars",
modelUrl: "https://arweave.net/ISYr7xBXT_s4tLddbhFB3PpUhWg-H_BYs2UZhVLF1hA",
},
];
const AVATAR_VISUALS: Record<AvatarKey, AvatarVisualSpec> = {
gorilla: {
src: "/avatars/twemoji/gorilla.svg",
bodyFill: "rgba(39,39,42,0.95)",
limbStroke: "rgba(63,63,70,0.92)",
glow: "rgba(161,161,170,0.32)",
renderMode: "badge",
},
monkey: {
src: "/avatars/twemoji/monkey.svg",
bodyFill: "rgba(120,53,15,0.95)",
limbStroke: "rgba(146,64,14,0.9)",
glow: "rgba(180,83,9,0.3)",
renderMode: "badge",
},
dog: {
src: "/avatars/twemoji/dog.svg",
bodyFill: "rgba(180,83,9,0.93)",
limbStroke: "rgba(180,83,9,0.88)",
glow: "rgba(217,119,6,0.26)",
renderMode: "badge",
},
pig: {
src: "/avatars/twemoji/pig.svg",
bodyFill: "rgba(244,114,182,0.92)",
limbStroke: "rgba(244,114,182,0.86)",
glow: "rgba(244,114,182,0.28)",
renderMode: "badge",
},
cat: {
src: "/avatars/twemoji/cat.svg",
bodyFill: "rgba(245,158,11,0.92)",
limbStroke: "rgba(217,119,6,0.88)",
glow: "rgba(251,191,36,0.28)",
renderMode: "badge",
},
fox: {
src: "/avatars/twemoji/fox.svg",
bodyFill: "rgba(234,88,12,0.93)",
limbStroke: "rgba(194,65,12,0.9)",
glow: "rgba(251,146,60,0.3)",
renderMode: "badge",
},
panda: {
src: "/avatars/twemoji/panda.svg",
bodyFill: "rgba(82,82,91,0.92)",
limbStroke: "rgba(39,39,42,0.9)",
glow: "rgba(228,228,231,0.28)",
renderMode: "badge",
},
lion: {
src: "/avatars/twemoji/lion.svg",
bodyFill: "rgba(202,138,4,0.92)",
limbStroke: "rgba(161,98,7,0.9)",
glow: "rgba(250,204,21,0.28)",
renderMode: "badge",
},
tiger: {
src: "/avatars/twemoji/tiger.svg",
bodyFill: "rgba(249,115,22,0.94)",
limbStroke: "rgba(194,65,12,0.9)",
glow: "rgba(251,146,60,0.3)",
renderMode: "badge",
},
rabbit: {
src: "/avatars/twemoji/rabbit.svg",
bodyFill: "rgba(236,72,153,0.9)",
limbStroke: "rgba(219,39,119,0.86)",
glow: "rgba(244,114,182,0.28)",
renderMode: "badge",
},
beachKing: {
src: "/avatars/opensource3d/beach-king.webp",
bodyFill: "rgba(15,23,42,0.16)",
limbStroke: "rgba(125,211,252,0.28)",
glow: "rgba(56,189,248,0.16)",
renderMode: "full-figure",
figureScale: 1.12,
figureOffsetY: 0.02,
},
jenny3d: {
src: "/avatars/opensource3d/jenny.webp",
bodyFill: "rgba(34,197,94,0.16)",
limbStroke: "rgba(16,185,129,0.24)",
glow: "rgba(34,197,94,0.18)",
renderMode: "full-figure",
figureScale: 1.08,
figureOffsetY: 0,
},
juanita3d: {
src: "/avatars/opensource3d/juanita.webp",
bodyFill: "rgba(244,114,182,0.14)",
limbStroke: "rgba(236,72,153,0.26)",
glow: "rgba(244,114,182,0.18)",
renderMode: "full-figure",
figureScale: 1.06,
figureOffsetY: 0,
},
sportTv: {
src: "/avatars/opensource3d/sport-tv.webp",
bodyFill: "rgba(59,130,246,0.14)",
limbStroke: "rgba(96,165,250,0.24)",
glow: "rgba(96,165,250,0.18)",
renderMode: "full-figure",
figureScale: 1.1,
figureOffsetY: 0.02,
},
};
const avatarImageCache = new Map<AvatarKey, HTMLImageElement | null>();
export function getAvatarPreset(key: AvatarKey) {
return AVATAR_PRESETS.find((preset) => preset.key === key) ?? AVATAR_PRESETS[0];
}
function clamp(value: number, min: number, max: number) {
return Math.max(min, Math.min(max, value));
}
function getActionStat(samples: FrameActionSample[], action: LiveActionType): ActionStat {
const matches = samples.filter((sample) => sample.action === action);
const count = matches.length;
const totalConfidence = matches.reduce((sum, sample) => sum + sample.confidence, 0);
const share = samples.length > 0 ? count / samples.length : 0;
const averageConfidence = count > 0 ? totalConfidence / count : 0;
return {
count,
totalConfidence,
share,
averageConfidence,
strength: share * 0.7 + averageConfidence * 0.3,
};
}
function getWindowAction(samples: FrameActionSample[]) {
const stats = new Map<LiveActionType, ActionStat>();
ACTIONS.forEach((action) => {
stats.set(action, getActionStat(samples, action));
});
const ranked = ACTIONS
.map((action) => ({ action, stats: stats.get(action)! }))
.sort((a, b) => {
if (b.stats.strength !== a.stats.strength) {
return b.stats.strength - a.stats.strength;
}
return b.stats.totalConfidence - a.stats.totalConfidence;
});
const winner = ranked[0] ?? { action: "unknown" as LiveActionType, stats: stats.get("unknown")! };
const qualifies =
winner.stats.share >= ACTION_WINDOW_MIN_SHARE &&
winner.stats.averageConfidence >= ACTION_WINDOW_MIN_CONFIDENCE;
return {
action: qualifies ? winner.action : "unknown",
stats,
winnerStats: winner.stats,
};
}
function getRawVolatility(samples: FrameActionSample[]) {
if (samples.length <= 1) return 0;
let switches = 0;
for (let index = 1; index < samples.length; index += 1) {
if (samples[index]?.action !== samples[index - 1]?.action) {
switches += 1;
}
}
return switches / (samples.length - 1);
}
export function createStableActionState(initial: LiveActionType = "unknown"): StableActionState {
return {
current: initial,
currentSince: null,
candidate: null,
candidateSince: null,
candidateWindows: 0,
switchCount: 0,
};
}
export function createEmptyStabilizedActionMeta(): StabilizedActionMeta {
return {
stableAction: "unknown",
stableConfidence: 0,
windowAction: "unknown",
windowConfidence: 0,
windowShare: 0,
windowFrames: 0,
windowProgress: 0,
pending: false,
pendingAction: null,
stableMs: 0,
candidateMs: 0,
rawVolatility: 0,
switchCount: 0,
};
}
export function stabilizeActionStream(
sample: FrameActionSample,
history: FrameActionSample[],
state: StableActionState,
) {
history.push(sample);
if (history.length > ACTION_WINDOW_FRAMES) {
history.splice(0, history.length - ACTION_WINDOW_FRAMES);
}
const { action: windowAction, stats } = getWindowAction(history);
const windowStats = stats.get(windowAction) ?? getActionStat(history, "unknown");
const currentStats = stats.get(state.current) ?? getActionStat(history, state.current);
const pendingMinMs = windowAction === "unknown" ? ACTION_UNKNOWN_MIN_MS : ACTION_SWITCH_MIN_MS;
const windowProgress = clamp(history.length / ACTION_WINDOW_FRAMES, 0, 1);
if (state.currentSince == null) {
state.currentSince = sample.timestamp;
}
if (windowAction === state.current) {
state.candidate = null;
state.candidateSince = null;
state.candidateWindows = 0;
} else if (windowProgress >= 0.7) {
if (state.candidate !== windowAction) {
state.candidate = windowAction;
state.candidateSince = sample.timestamp;
state.candidateWindows = 1;
} else {
state.candidateWindows += 1;
}
const candidateStats = stats.get(windowAction) ?? getActionStat(history, windowAction);
const currentStrength = state.current === "unknown" ? currentStats.strength * 0.55 : currentStats.strength;
const candidateDuration = state.candidateSince == null ? 0 : sample.timestamp - state.candidateSince;
const canSwitch =
state.candidateWindows >= ACTION_LOCK_IN_WINDOWS &&
candidateDuration >= pendingMinMs &&
candidateStats.strength >= currentStrength + ACTION_SWITCH_DELTA;
if (canSwitch) {
state.current = windowAction;
state.currentSince = sample.timestamp;
state.candidate = null;
state.candidateSince = null;
state.candidateWindows = 0;
state.switchCount += 1;
}
}
const stableStats = stats.get(state.current) ?? getActionStat(history, state.current);
const stableConfidence = state.current === "unknown"
? Math.max(sample.confidence * 0.45, stableStats.averageConfidence)
: Math.max(stableStats.averageConfidence, windowStats.averageConfidence * 0.88);
return {
stableAction: state.current,
stableConfidence: clamp(stableConfidence, 0, 1),
windowAction,
windowConfidence: clamp(windowStats.averageConfidence, 0, 1),
windowShare: clamp(windowStats.share, 0, 1),
windowFrames: history.length,
windowProgress,
pending: Boolean(state.candidate),
pendingAction: state.candidate,
stableMs: state.currentSince == null ? 0 : sample.timestamp - state.currentSince,
candidateMs: state.candidateSince == null ? 0 : sample.timestamp - state.candidateSince,
rawVolatility: getRawVolatility(history),
switchCount: state.switchCount,
} satisfies StabilizedActionMeta;
}
export function resolveAvatarKeyFromPrompt(prompt: string, fallback: AvatarKey): AvatarKey {
const normalized = prompt.trim().toLowerCase();
if (!normalized) return fallback;
const matched = AVATAR_PRESETS.find((preset) => preset.keywords.some((keyword) => normalized.includes(keyword)));
return matched?.key ?? fallback;
}
function averagePoint(a: PosePoint | undefined, b: PosePoint | undefined, defaultX: number, defaultY: number) {
return {
x: ((a?.x ?? defaultX) + (b?.x ?? defaultX)) / 2,
y: ((a?.y ?? defaultY) + (b?.y ?? defaultY)) / 2,
};
}
export function getAvatarAnchors(landmarks: PosePoint[], width: number, height: number): AvatarAnchors | null {
const nose = landmarks[0];
const leftShoulder = landmarks[11];
const rightShoulder = landmarks[12];
const leftHip = landmarks[23];
const rightHip = landmarks[24];
const leftWrist = landmarks[15];
const rightWrist = landmarks[16];
const leftAnkle = landmarks[27];
const rightAnkle = landmarks[28];
const leftEar = landmarks[7];
const rightEar = landmarks[8];
if (!nose || !leftShoulder || !rightShoulder || !leftHip || !rightHip) {
return null;
}
const shoulderCenter = averagePoint(leftShoulder, rightShoulder, 0.5, 0.32);
const hipCenter = averagePoint(leftHip, rightHip, 0.5, 0.62);
const ankleCenter = averagePoint(leftAnkle, rightAnkle, hipCenter.x, 0.92);
const shoulderSpan = Math.abs(rightShoulder.x - leftShoulder.x) * width;
const torsoHeight = Math.max((hipCenter.y - shoulderCenter.y) * height, shoulderSpan * 0.8);
const headRadius = Math.max(
shoulderSpan * 0.28,
Math.abs((leftEar?.x ?? nose.x - 0.04) - (rightEar?.x ?? nose.x + 0.04)) * width * 0.45,
34,
);
const bodyWidth = Math.max(shoulderSpan * 1.05, headRadius * 1.8);
const bodyHeight = Math.max(torsoHeight * 1.1, headRadius * 2.2);
return {
headX: nose.x * width,
headY: Math.min(nose.y * height, shoulderCenter.y * height - headRadius * 0.2),
headRadius,
bodyX: shoulderCenter.x * width,
bodyY: shoulderCenter.y * height + bodyHeight * 0.48,
bodyWidth,
bodyHeight,
shoulderY: shoulderCenter.y * height,
footY: Math.max(ankleCenter.y * height, hipCenter.y * height + bodyHeight * 1.35),
leftHandX: (leftWrist?.x ?? leftShoulder.x - 0.08) * width,
leftHandY: (leftWrist?.y ?? shoulderCenter.y + 0.1) * height,
rightHandX: (rightWrist?.x ?? rightShoulder.x + 0.08) * width,
rightHandY: (rightWrist?.y ?? shoulderCenter.y + 0.1) * height,
};
}
function drawRoundedBody(ctx: CanvasRenderingContext2D, anchors: AvatarAnchors, fill: string) {
const radius = Math.min(anchors.bodyWidth, anchors.bodyHeight) * 0.18;
const left = anchors.bodyX - anchors.bodyWidth / 2;
const top = anchors.bodyY - anchors.bodyHeight / 2;
const right = left + anchors.bodyWidth;
const bottom = top + anchors.bodyHeight;
ctx.beginPath();
ctx.moveTo(left + radius, top);
ctx.lineTo(right - radius, top);
ctx.quadraticCurveTo(right, top, right, top + radius);
ctx.lineTo(right, bottom - radius);
ctx.quadraticCurveTo(right, bottom, right - radius, bottom);
ctx.lineTo(left + radius, bottom);
ctx.quadraticCurveTo(left, bottom, left, bottom - radius);
ctx.lineTo(left, top + radius);
ctx.quadraticCurveTo(left, top, left + radius, top);
ctx.closePath();
ctx.fillStyle = fill;
ctx.fill();
}
function drawLimbs(ctx: CanvasRenderingContext2D, anchors: AvatarAnchors, stroke: string) {
ctx.strokeStyle = stroke;
ctx.lineWidth = Math.max(anchors.headRadius * 0.22, 10);
ctx.lineCap = "round";
ctx.beginPath();
ctx.moveTo(anchors.bodyX - anchors.bodyWidth * 0.24, anchors.shoulderY + anchors.headRadius * 0.65);
ctx.lineTo(anchors.leftHandX, anchors.leftHandY);
ctx.moveTo(anchors.bodyX + anchors.bodyWidth * 0.24, anchors.shoulderY + anchors.headRadius * 0.65);
ctx.lineTo(anchors.rightHandX, anchors.rightHandY);
ctx.moveTo(anchors.bodyX - anchors.bodyWidth * 0.14, anchors.bodyY + anchors.bodyHeight * 0.42);
ctx.lineTo(anchors.bodyX - anchors.bodyWidth * 0.18, anchors.footY);
ctx.moveTo(anchors.bodyX + anchors.bodyWidth * 0.14, anchors.bodyY + anchors.bodyHeight * 0.42);
ctx.lineTo(anchors.bodyX + anchors.bodyWidth * 0.18, anchors.footY);
ctx.stroke();
}
function getAvatarImage(key: AvatarKey) {
if (typeof Image === "undefined") {
return null;
}
const cached = avatarImageCache.get(key);
if (cached) {
return cached.complete && cached.naturalWidth > 0 ? cached : null;
}
const image = new Image();
image.decoding = "async";
image.src = AVATAR_VISUALS[key].src;
avatarImageCache.set(key, image);
return null;
}
function drawAvatarBadge(
ctx: CanvasRenderingContext2D,
anchors: AvatarAnchors,
avatarKey: AvatarKey,
sprite: HTMLImageElement | null,
) {
const visual = AVATAR_VISUALS[avatarKey];
const headSize = anchors.headRadius * 2.5;
const torsoBadge = Math.max(anchors.headRadius * 0.95, 40);
drawRoundedBody(ctx, anchors, visual.bodyFill);
drawLimbs(ctx, anchors, visual.limbStroke);
ctx.save();
ctx.fillStyle = visual.glow;
ctx.beginPath();
ctx.arc(anchors.headX, anchors.headY, anchors.headRadius * 1.16, 0, Math.PI * 2);
ctx.fill();
ctx.restore();
if (sprite) {
ctx.drawImage(
sprite,
anchors.headX - headSize / 2,
anchors.headY - headSize / 2,
headSize,
headSize,
);
ctx.save();
ctx.globalAlpha = 0.94;
ctx.drawImage(
sprite,
anchors.bodyX - torsoBadge / 2,
anchors.bodyY - torsoBadge / 2,
torsoBadge,
torsoBadge,
);
ctx.restore();
return;
}
ctx.fillStyle = "rgba(255,255,255,0.92)";
ctx.beginPath();
ctx.arc(anchors.headX, anchors.headY, anchors.headRadius * 0.88, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = "rgba(17,24,39,0.82)";
ctx.beginPath();
ctx.arc(anchors.headX - anchors.headRadius * 0.22, anchors.headY - anchors.headRadius * 0.08, anchors.headRadius * 0.08, 0, Math.PI * 2);
ctx.arc(anchors.headX + anchors.headRadius * 0.22, anchors.headY - anchors.headRadius * 0.08, anchors.headRadius * 0.08, 0, Math.PI * 2);
ctx.fill();
}
function drawFullFigureAvatar(
ctx: CanvasRenderingContext2D,
anchors: AvatarAnchors,
avatarKey: AvatarKey,
sprite: HTMLImageElement | null,
) {
const visual = AVATAR_VISUALS[avatarKey];
const topY = anchors.headY - anchors.headRadius * 1.55 + anchors.bodyHeight * (visual.figureOffsetY ?? 0);
const baseHeight = Math.max(anchors.footY - topY, anchors.bodyHeight * 2.35);
const figureHeight = baseHeight * (visual.figureScale ?? 1);
const aspectRatio = sprite?.naturalWidth && sprite?.naturalHeight
? sprite.naturalWidth / sprite.naturalHeight
: 0.72;
const figureWidth = figureHeight * aspectRatio;
const figureLeft = anchors.bodyX - figureWidth / 2;
ctx.save();
ctx.fillStyle = visual.glow;
ctx.beginPath();
ctx.ellipse(
anchors.bodyX,
anchors.footY - anchors.headRadius * 0.1,
Math.max(anchors.bodyWidth * 0.42, 34),
Math.max(anchors.headRadius * 0.22, 10),
0,
0,
Math.PI * 2,
);
ctx.fill();
ctx.restore();
if (sprite) {
ctx.save();
ctx.shadowColor = "rgba(15,23,42,0.28)";
ctx.shadowBlur = 16;
ctx.shadowOffsetY = 10;
ctx.drawImage(sprite, figureLeft, topY, figureWidth, figureHeight);
ctx.restore();
return;
}
drawRoundedBody(ctx, anchors, visual.bodyFill);
drawLimbs(ctx, anchors, visual.limbStroke);
}
export function renderLiveCameraOverlayToContext(
ctx: CanvasRenderingContext2D | null,
width: number,
height: number,
landmarks: PosePoint[] | undefined,
avatarState?: AvatarRenderState,
options?: { clear?: boolean },
) {
if (!ctx) return;
if (options?.clear !== false) {
ctx.clearRect(0, 0, width, height);
}
if (!landmarks) return;
if (avatarState?.enabled) {
const anchors = getAvatarAnchors(landmarks, width, height);
if (anchors) {
const sprite = getAvatarImage(avatarState.avatarKey);
const visual = AVATAR_VISUALS[avatarState.avatarKey];
ctx.save();
ctx.globalAlpha = 0.95;
if (visual.renderMode === "full-figure") {
drawFullFigureAvatar(ctx, anchors, avatarState.avatarKey, sprite);
} else {
drawAvatarBadge(ctx, anchors, avatarState.avatarKey, sprite);
}
ctx.restore();
if (visual.renderMode !== "full-figure") {
ctx.save();
ctx.strokeStyle = "rgba(255,255,255,0.16)";
ctx.lineWidth = 2;
ctx.setLineDash([8, 10]);
ctx.beginPath();
ctx.moveTo(anchors.bodyX, anchors.shoulderY - anchors.headRadius * 1.25);
ctx.lineTo(anchors.bodyX, anchors.footY);
ctx.stroke();
ctx.restore();
}
return;
}
}
const poseConnections: Array<[number, number]> = [
[11, 12], [11, 13], [13, 15], [12, 14], [14, 16],
[11, 23], [12, 24], [23, 24], [23, 25], [24, 26],
[25, 27], [26, 28], [15, 17], [16, 18], [15, 19],
[16, 20], [17, 19], [18, 20],
];
ctx.strokeStyle = "rgba(25, 211, 155, 0.9)";
ctx.lineWidth = 3;
poseConnections.forEach(([from, to]) => {
const start = landmarks[from];
const end = landmarks[to];
if (!start || !end || (start.visibility ?? 1) < 0.25 || (end.visibility ?? 1) < 0.25) return;
ctx.beginPath();
ctx.moveTo(start.x * width, start.y * height);
ctx.lineTo(end.x * width, end.y * height);
ctx.stroke();
});
landmarks.forEach((point, index) => {
if ((point.visibility ?? 1) < 0.25) return;
ctx.fillStyle = index >= 11 && index <= 16 ? "rgba(253, 224, 71, 0.95)" : "rgba(255,255,255,0.88)";
ctx.beginPath();
ctx.arc(point.x * width, point.y * height, index >= 11 && index <= 16 ? 5 : 4, 0, Math.PI * 2);
ctx.fill();
});
}
export function drawLiveCameraOverlay(
canvas: HTMLCanvasElement | null,
landmarks: PosePoint[] | undefined,
avatarState?: AvatarRenderState,
) {
const ctx = canvas?.getContext("2d");
if (!canvas || !ctx) return;
renderLiveCameraOverlayToContext(ctx, canvas.width, canvas.height, landmarks, avatarState, { clear: true });
}

文件差异内容过多而无法显示 加载差异

文件差异内容过多而无法显示 加载差异

查看文件

@@ -1,5 +1,74 @@
# Tennis Training Hub - 变更日志
## 2026.03.16-live-analysis-overlay-archive (2026-03-16)
### 功能更新
- `/live-camera` 新增 10 个免费动物虚拟形象,可将主体实时替换为猩猩、猴子、狗、猪、猫、狐狸、熊猫、狮子、老虎、兔子
- `/live-camera` 再新增 4 个免费的全身 3D Avatar 示例,可直接覆盖人物轮廓,并提供对应的 CC0 模型源链接
- `/live-camera` 新增实时分析自动录像,按 60 秒自动切段归档;归档视频写入视频库并标记为“实时分析”
- 实时分析录像改为录制“视频画面 + 骨架线 + 关键点 + 虚拟形象覆盖”的合成画布,回放中可直接看到分析叠层
- 实时分析记录与视频库解耦,用户删除视频库中的“实时分析”录像后,不会删除已保存的分析数据和训练记录
- 增加形象别名输入,当前可按输入内容自动映射到内置形象
- 实时分析动作稳定器从短窗口切换为 24 帧时间窗口,降低 1-2 秒内频繁跳动作的问题
- 动作切换新增确认阶段与延迟入库逻辑,连续动作区间改为只按稳定动作聚合
- 画面内新增稳定动作、原始候选、窗口占比、切换确认状态等实时状态提示
- 实时分析会话保存新增稳定窗口、动作切换次数、原始波动率、虚拟形象状态等指标
- 动物头像素材切换为本地集成的免费 Twemoji SVG,避免外链依赖
- 新增 Open Source Avatars 的本地优化透明 WebP 全身素材,减少全身替身叠加时的页面流量和首帧加载时间
### 测试
- `pnpm check`
- `pnpm test`
- `pnpm build`
- `pnpm test:e2e`
- Playwright 线上 smoke
- `https://te.hao.work/live-camera` 真实登录 `H1` 后可完成引导、启用摄像头、开始分析、结束分析
- `https://te.hao.work/videos` 可见“实时分析”录像条目
- `https://te.hao.work/changelog` 已展示 `2026.03.16-live-analysis-overlay-archive` 条目与对应摘要
- 最终线上资源 revision`assets/index-BWEXNszf.js``assets/index-BL6GQzUF.css`
### 仓库版本
- `4fb2d09`
## 2026.03.15-live-analysis-leave-hint (2026-03-15)
### 功能更新
- 实时分析进行中显示“不要关闭浏览器或切走页面”提示
- 点击“结束分析”后,保存阶段显示“请暂时停留当前页面”提示
- 保存完成后明确提示“现在可以关闭浏览器或切换到其他页面”
- 分析中和保存中增加离开页面提醒,减少误关导致的数据丢失
### 测试
- `pnpm check`
- `pnpm build`
### 仓库版本
- `5c2dcf2`
## 2026.03.15-training-generator-collapse (2026-03-15)
### 功能更新
- 训练页右侧“重新生成计划”面板在桌面端默认折叠到右侧
- 点击右侧折叠栏后展开完整生成器,可调整周期并重新生成计划
- 移动端继续保持完整面板直接可见
- 未生成计划时点击“前往生成训练计划”会先自动展开,再滚动到面板位置
### 测试
- `pnpm check`
- `pnpm build`
### 仓库版本
- `1ce94f6`
## 2026.03.15-progress-time-actions (2026-03-15)
### 功能更新

查看文件

@@ -187,6 +187,7 @@ export const appRouter = router({
title: z.string(),
format: z.string(),
fileSize: z.number(),
duration: z.number().optional(),
exerciseType: z.string().optional(),
fileBase64: z.string(),
}))
@@ -204,8 +205,9 @@ export const appRouter = router({
url: publicUrl,
format: input.format,
fileSize: input.fileSize,
duration: input.duration ?? null,
exerciseType: input.exerciseType || null,
analysisStatus: "pending",
analysisStatus: input.exerciseType === "live_analysis" ? "completed" : "pending",
});
return { videoId, url: publicUrl };

查看文件

@@ -22,9 +22,10 @@ test("training page shows plan generation flow", async ({ page }) => {
await page.goto("/training");
await expect(page.getByTestId("training-title")).toBeVisible();
await expect(page.getByTestId("training-generate-button")).toBeVisible();
await page.getByTestId("training-generate-button").click();
await expect(page.getByText("TestPlayer 的训练计划")).toBeVisible();
const generateButton = page.getByRole("button", { name: "生成训练计划" }).last();
await expect(generateButton).toBeVisible();
await generateButton.click();
await expect(page).toHaveURL(/\/training$/);
});
test("videos page renders video library items", async ({ page }) => {
@@ -67,6 +68,28 @@ test("live camera starts analysis and produces scores", async ({ page }) => {
await expect(page.getByTestId("live-camera-score-overall")).toBeVisible();
});
test("live camera archives overlay videos into the library after analysis stops", async ({ page }) => {
await installAppMocks(page, { authenticated: true, videos: [] });
await page.goto("/live-camera");
await page.getByRole("button", { name: "下一步" }).click();
await page.getByRole("button", { name: "下一步" }).click();
await page.getByRole("button", { name: "下一步" }).click();
await page.getByRole("button", { name: /启用摄像头/ }).click();
await expect(page.getByTestId("live-camera-analyze-button")).toBeVisible();
await page.getByTestId("live-camera-analyze-button").click();
await expect(page.getByTestId("live-camera-score-overall")).toBeVisible();
await page.getByRole("button", { name: "结束分析" }).click();
await expect(page.getByText("分析结果已保存")).toBeVisible({ timeout: 8_000 });
await page.goto("/videos");
await expect(page.getByTestId("video-card")).toHaveCount(1);
await expect(page.getByText("实时分析录像").first()).toBeVisible();
await expect(page.getByText("实时分析").first()).toBeVisible();
});
test("recorder flow archives a session and exposes it in videos", async ({ page }) => {
await installAppMocks(page, { authenticated: true, videos: [] });

查看文件

@@ -10,6 +10,19 @@ type MockUser = {
skillLevel: string;
trainingGoals: string | null;
ntrpRating: number;
manualNtrpRating: number | null;
manualNtrpCapturedAt: string | null;
heightCm: number | null;
weightKg: number | null;
sprintSpeedScore: number | null;
explosivePowerScore: number | null;
agilityScore: number | null;
enduranceScore: number | null;
flexibilityScore: number | null;
coreStabilityScore: number | null;
shoulderMobilityScore: number | null;
hipMobilityScore: number | null;
assessmentNotes: string | null;
totalSessions: number;
totalMinutes: number;
totalShots: number;
@@ -103,6 +116,19 @@ function buildUser(name = "TestPlayer"): MockUser {
skillLevel: "beginner",
trainingGoals: null,
ntrpRating: 2.8,
manualNtrpRating: 2.5,
manualNtrpCapturedAt: nowIso(),
heightCm: 178,
weightKg: 68,
sprintSpeedScore: 4,
explosivePowerScore: 4,
agilityScore: 4,
enduranceScore: 3,
flexibilityScore: 3,
coreStabilityScore: 4,
shoulderMobilityScore: 3,
hipMobilityScore: 4,
assessmentNotes: "每周可练 3 次,右肩偶尔偏紧。",
totalSessions: 12,
totalMinutes: 320,
totalShots: 280,
@@ -115,6 +141,7 @@ function buildUser(name = "TestPlayer"): MockUser {
}
function buildStats(user: MockUser) {
const hasSystemNtrp = user.ntrpRating != null;
return {
ntrpRating: user.ntrpRating,
totalSessions: user.totalSessions,
@@ -186,9 +213,45 @@ function buildStats(user: MockUser) {
matchReadiness: 70,
},
},
trainingProfileStatus: {
hasSystemNtrp,
isComplete: true,
missingFields: [],
effectiveNtrp: user.ntrpRating,
ntrpSource: hasSystemNtrp ? "system" : "manual",
assessmentSnapshot: {
heightCm: user.heightCm,
weightKg: user.weightKg,
sprintSpeedScore: user.sprintSpeedScore,
explosivePowerScore: user.explosivePowerScore,
agilityScore: user.agilityScore,
enduranceScore: user.enduranceScore,
flexibilityScore: user.flexibilityScore,
coreStabilityScore: user.coreStabilityScore,
shoulderMobilityScore: user.shoulderMobilityScore,
hipMobilityScore: user.hipMobilityScore,
assessmentNotes: user.assessmentNotes,
},
},
};
}
async function readTrpcInput(route: Route, operationIndex: number) {
const url = new URL(route.request().url());
const rawSearchInput = url.searchParams.get("input");
if (rawSearchInput) {
const parsed = JSON.parse(rawSearchInput);
return parsed?.json ?? parsed?.[operationIndex]?.json ?? null;
}
const postData = route.request().postData();
if (!postData) return null;
const parsed = JSON.parse(postData);
return parsed?.json ?? parsed?.[operationIndex]?.json ?? parsed?.[String(operationIndex)]?.json ?? null;
}
function buildMediaSession(user: MockUser, title: string): MockMediaSession {
return {
id: "session-e2e",
@@ -254,7 +317,7 @@ async function fulfillJson(route: Route, body: unknown) {
async function handleTrpc(route: Route, state: MockAppState) {
const url = new URL(route.request().url());
const operations = url.pathname.replace("/api/trpc/", "").split(",");
const results = operations.map((operation) => {
const results = await Promise.all(operations.map(async (operation, operationIndex) => {
switch (operation) {
case "auth.me":
if (state.authenticated && state.authMeNullResponsesAfterLogin > 0) {
@@ -267,16 +330,34 @@ async function handleTrpc(route: Route, state: MockAppState) {
return trpcResult({ user: state.user, isNew: false });
case "profile.stats":
return trpcResult(buildStats(state.user));
case "profile.update": {
const input = await readTrpcInput(route, operationIndex);
state.user = {
...state.user,
...input,
updatedAt: nowIso(),
manualNtrpCapturedAt:
input?.manualNtrpRating !== undefined
? input.manualNtrpRating == null
? null
: nowIso()
: state.user.manualNtrpCapturedAt,
};
return trpcResult({ success: true });
}
case "plan.active":
return trpcResult(state.activePlan);
case "plan.list":
return trpcResult(state.activePlan ? [state.activePlan] : []);
case "plan.generate":
case "plan.generate": {
const input = await readTrpcInput(route, operationIndex);
const durationDays = Number(input?.durationDays ?? 7);
const skillLevel = input?.skillLevel ?? state.user.skillLevel;
state.activePlan = {
id: 200,
title: `${state.user.name} 的训练计划`,
skillLevel: "beginner",
durationDays: 7,
skillLevel,
durationDays,
version: 1,
adjustmentNotes: null,
exercises: [
@@ -305,7 +386,7 @@ async function handleTrpc(route: Route, state: MockAppState) {
return trpcResult({
taskId: createTask(state, {
type: "training_plan_generate",
title: "7天训练计划生成",
title: `${durationDays}天训练计划生成`,
result: {
kind: "training_plan_generate",
planId: state.activePlan.id,
@@ -313,6 +394,7 @@ async function handleTrpc(route: Route, state: MockAppState) {
},
}).id,
});
}
case "plan.adjust":
return trpcResult({
taskId: createTask(state, {
@@ -326,6 +408,22 @@ async function handleTrpc(route: Route, state: MockAppState) {
});
case "video.list":
return trpcResult(state.videos);
case "video.upload": {
const input = await readTrpcInput(route, operationIndex);
const video = {
id: state.nextVideoId++,
title: input?.title || `实时分析录像 ${state.nextVideoId}`,
url: `/uploads/${state.nextVideoId}.${input?.format || "webm"}`,
format: input?.format || "webm",
fileSize: input?.fileSize || 1024 * 1024,
duration: input?.duration || 60,
exerciseType: input?.exerciseType || "live_analysis",
analysisStatus: "completed",
createdAt: nowIso(),
};
state.videos = [video, ...state.videos];
return trpcResult({ videoId: video.id, url: video.url });
}
case "analysis.list":
return trpcResult(state.analyses);
case "analysis.liveSessionList":
@@ -465,7 +563,7 @@ async function handleTrpc(route: Route, state: MockAppState) {
default:
return trpcResult(null);
}
});
}));
await fulfillJson(route, results);
}
@@ -655,6 +753,11 @@ export async function installAppMocks(
value: async () => undefined,
});
Object.defineProperty(HTMLCanvasElement.prototype, "captureStream", {
configurable: true,
value: () => new MediaStream(),
});
class FakeMediaRecorder extends EventTarget {
state = "inactive";
mimeType = "video/webm";