Initial commit: AI Video Assistant fullstack platform.

Add pipecat-based backend with WebRTC/WS voice routes, Next.js frontend, and Docker Compose orchestration.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Xin Wang
2026-06-08 13:51:28 +08:00
commit 42cab2a6ef
86 changed files with 19471 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
"""API Key 打码 / 写时哨兵(抄 dograh masking.py + merge.py 思路)。
- mask:返回前端时把真 key 变成 sk-****1234,真 key 永不出后端
- is_masked:判断前端回传的是不是打码占位符
- resolve_incoming_key:前端回传若是占位符 → 保留旧值;否则用新值
"""
MASK_VISIBLE_TAIL = 4
def mask(api_key: str) -> str:
if not api_key:
return ""
if len(api_key) <= MASK_VISIBLE_TAIL:
return "****"
return f"{api_key[:2]}****{api_key[-MASK_VISIBLE_TAIL:]}"
def is_masked(value: str) -> bool:
return "****" in (value or "")
def resolve_incoming_key(incoming: str | None, stored: str) -> str:
"""写入时决定最终 key:占位符/空 → 保留旧;否则用新。"""
if incoming is None or incoming == "" or is_masked(incoming):
return stored
return incoming