diff --git a/backend/.env.example b/backend/.env.example
index eac7185..bac1f9d 100644
--- a/backend/.env.example
+++ b/backend/.env.example
@@ -32,4 +32,4 @@ DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/postgres
HOST=0.0.0.0
PORT=8000
# 前端开发地址,允许跨域
-CORS_ORIGINS=http://localhost:3000
+CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
diff --git a/frontend/src/components/pages/AssistantPage.tsx b/frontend/src/components/pages/AssistantPage.tsx
index 53af2b5..8d5ed32 100644
--- a/frontend/src/components/pages/AssistantPage.tsx
+++ b/frontend/src/components/pages/AssistantPage.tsx
@@ -1790,9 +1790,15 @@ function DebugVoicePanel({
vizStyle: VizStyle;
assistantId: string | null;
}) {
- const [micError, setMicError] = useState(false);
- const { status, error, localStream, connect, disconnect, audioRef } =
- useVoicePreview(assistantId, { onMicError: () => setMicError(true) });
+ const {
+ status,
+ error,
+ micWarning,
+ localStream,
+ connect,
+ disconnect,
+ audioRef,
+ } = useVoicePreview(assistantId);
// 连接中或已连通都视作"会话进行中"
const recording = status === "connecting" || status === "connected";
@@ -1827,15 +1833,10 @@ function DebugVoicePanel({
{(() => {
- const onVizError = () => {
- setMicError(true);
- disconnect();
- };
const shared = {
active: Boolean(localStream),
stream: localStream,
className: "relative shrink-0",
- onError: onVizError,
} as const;
if (vizStyle === "aura")
return
;
@@ -1852,17 +1853,19 @@ function DebugVoicePanel({
{status === "connecting"
? "连接中…"
: status === "connected"
- ? "我在聆听"
+ ? micWarning
+ ? "仅收听模式"
+ : "我在聆听"
: "开始一次语音对话"}
- {micError
- ? "无法访问麦克风,请检查浏览器权限后重试。"
- : status === "failed"
+ {status === "failed"
? error ||
"连接失败,请确认后端已启动且助手已保存后重试。"
: !assistantId
? "请先保存助手,再开始语音预览。"
+ : micWarning
+ ? `${micWarning} 可接收助手播报,但无法发送语音。`
: recording
? "直接说话即可。助手会在您停顿后自然回应。"
: "测试语音识别、响应速度与助手的播报效果。"}
@@ -1872,7 +1875,6 @@ function DebugVoicePanel({