From 2c6489b9a6ecc5241f25e2ee729b043055568f0c Mon Sep 17 00:00:00 2001 From: cfy666 <3087823110@qq.com> Date: Sat, 13 Jun 2026 14:38:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E5=B8=A7=E6=A3=80=E6=B5=8B=E4=B8=8E=E6=88=90=E6=9C=AC=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - EdgeProcessor:sampleFrame 降采样 160x120 + compareFrames 像素差异对比 - 重复画面跳过:similarity > 0.9 时不发送 query - 混合采样策略:静默 5s / 用户说话 1s(docs/08-成本控制.md) - 请求统计:queryCount + totalTokens 实时显示 - App 状态栏显示成本统计 Co-Authored-By: Claude --- frontend/src/App.css | 10 +++ frontend/src/App.tsx | 8 +++ .../src/components/EdgeProcessor/index.tsx | 66 +++++++++++++++---- frontend/src/hooks/useVisionSession.ts | 44 ++++++++++++- frontend/src/lib/sampling.ts | 43 ++++++++++++ 5 files changed, 157 insertions(+), 14 deletions(-) create mode 100644 frontend/src/lib/sampling.ts diff --git a/frontend/src/App.css b/frontend/src/App.css index bdbe21e..431c149 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -237,6 +237,16 @@ body { border-top: 1px solid var(--color-border); } +/* ---- Stats Bar ---- */ + +.stats-bar { + text-align: center; + padding: 4px 0; + font-size: 0.75rem; + color: var(--color-text-muted); + border-top: 1px solid var(--color-border); +} + /* ---- Buttons ---- */ .btn { diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 0fcb64d..dcb8a6f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -26,6 +26,7 @@ function App() { stream, config, updateConfig, + stats, startSession, stopSession, interrupt, @@ -106,6 +107,13 @@ function App() { + {isConnected && (stats.queryCount > 0 || stats.totalTokens > 0) && ( +
+ {stats.queryCount > 0 && {stats.queryCount} 次请求} + {stats.totalTokens > 0 && · {stats.totalTokens} tokens} +
+ )} +