diff --git a/frontend/src/components/pages/AssistantPage.tsx b/frontend/src/components/pages/AssistantPage.tsx
index 494863a..8f6f4ac 100644
--- a/frontend/src/components/pages/AssistantPage.tsx
+++ b/frontend/src/components/pages/AssistantPage.tsx
@@ -1302,6 +1302,7 @@ export function AssistantPage(props: AssistantPageProps) {
@@ -1403,7 +1404,7 @@ export function AssistantPage(props: AssistantPageProps) {
-
+
);
@@ -1517,7 +1518,7 @@ export function AssistantPage(props: AssistantPageProps) {
-
+
);
@@ -1642,7 +1643,7 @@ export function AssistantPage(props: AssistantPageProps) {
-
+
);
@@ -1859,7 +1860,11 @@ export function AssistantPage(props: AssistantPageProps) {
-
+
);
@@ -1934,11 +1939,13 @@ function SegmentedIconButton({
function DebugDrawer({
assistantId,
asSheet = false,
+ hasUnsavedChanges = false,
onNodeActive,
vision = false,
}: {
assistantId: string | null;
asSheet?: boolean;
+ hasUnsavedChanges?: boolean;
onNodeActive?: (nodeId: string | null) => void;
vision?: boolean;
}) {
@@ -2050,6 +2057,7 @@ function DebugDrawer({
assistantId={assistantId}
preview={preview}
camera={camera}
+ hasUnsavedChanges={hasUnsavedChanges}
vision={vision}
/>
@@ -2180,6 +2188,7 @@ function DebugVoicePanel({
assistantId,
preview,
camera,
+ hasUnsavedChanges,
vision,
}: {
view: DebugView;
@@ -2188,6 +2197,7 @@ function DebugVoicePanel({
assistantId: string | null;
preview: VoicePreview;
camera: CameraPreview;
+ hasUnsavedChanges: boolean;
vision: boolean;
}) {
const {
@@ -2210,6 +2220,12 @@ function DebugVoicePanel({
const showIdleHub =
idleOrFailed &&
(view === "video" || (messages.length === 0 && inChatView));
+ const startBlockedMessage = !assistantId
+ ? "请先保存助手,再开始对话。"
+ : hasUnsavedChanges
+ ? "请先保存当前改动,再开始对话。"
+ : "";
+ const startDisabled = status === "connecting" || Boolean(startBlockedMessage);
function handleSendText() {
if (sendText(textDraft)) {
@@ -2218,12 +2234,13 @@ function DebugVoicePanel({
}
const startConversation = useCallback(async () => {
+ if (!assistantId || hasUnsavedChanges) return;
const videoStream = vision ? await camera.start() : null;
await connect({
visionEnabled: vision,
videoStream,
});
- }, [camera, connect, vision]);
+ }, [assistantId, camera, connect, hasUnsavedChanges, vision]);
return (
@@ -2234,7 +2251,7 @@ function DebugVoicePanel({
) : (
@@ -2245,7 +2262,7 @@ function DebugVoicePanel({
) : (
@@ -2307,6 +2324,8 @@ function DebugVoicePanel({
"连接失败,请确认后端已启动且助手已保存后重试。"
: !assistantId
? "请先保存助手,再开始语音预览。"
+ : hasUnsavedChanges
+ ? "请先保存当前改动,再开始语音预览。"
: micWarning
? `${micWarning} 可接收助手播报,但无法发送语音。`
: recording
@@ -2316,7 +2335,7 @@ function DebugVoicePanel({
)}
{!showIdleHub && (
-