Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

Merge commit '6cf793bd868ba5ecbe64722936d4be8fab5a01df' into fix/composer-keyboard-admission

dajiaohuang2f1517cf7cb1
diff --cc web/components/chat/home/ChatComposer.tsx
index 671e32674,459320a92..3c246ffc8
--- a/web/components/chat/home/ChatComposer.tsx
+++ b/web/components/chat/home/ChatComposer.tsx
@@@ -654,28 -700,35 +700,44 @@@ export default memo(function ChatCompos
const doSend = useCallback(
(content: string) => {
+ // Keyboard and button submissions share the same admission checks.
+ // A refused submission must leave the draft in the input.
+ if (isStreaming && !awaitingUserReply) return false;
+ if (capabilityNeedsConfig && !capabilityConfigConfirmed) {
+ onRequestConfigConfirm();
+ return false;
+ }
onSend(content);
- void saveWorkspaceDraft({ text: "", attachments: [] }).catch(() => {});
+ if (!restoreFailedRef.current) {
+ void saveWorkspaceDraft({ text: "", attachments: [] }).catch(() => {});
+ }
setHasContent(false);
inputHandleRef.current?.clear();
// Sending can move focus to the button or rerender the empty-state
// composer into the conversation layout. Restore it after that update
// so the user can keep typing, including after switching back to the tab.
focusTextarea();
+ return true;
},
- [focusTextarea, onSend],
+ [awaitingUserReply, capabilityConfigConfirmed, capabilityNeedsConfig,
+ focusTextarea, isStreaming, onRequestConfigConfirm, onSend],
);
+ const { board: taskBoard } = useTaskBoard();
+ const linkedTaskIds = taskSessionId
+ ? sessionTaskLinks(taskBoard, taskSessionId, workspaceId ?? "")?.task_ids ?? []
+ : draftTaskIds;
+ const taskPanelPending = useRef(false);
+ useEffect(() => {
+ // Let users finish selecting tasks before the viewer changes the layout.
+ if (taskPanelPending.current && !spaceMenuOpen && !personaSelectorOpen) {
+ taskPanelPending.current = false;
+ onTasksLinked?.();
+ }
+ }, [spaceMenuOpen, personaSelectorOpen, onTasksLinked]);
+
const hasReferences =
+ !!linkedTaskIds.length ||
!!attachments.length ||
!!selectedBookReferences.length ||
!!selectedReadingReferences.length ||