mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-10 21:26:01 +02:00
k (#3404)
This commit is contained in:
@@ -35,6 +35,13 @@ export function SetDefaultModelModal({
|
|||||||
const container = containerRef.current;
|
const container = containerRef.current;
|
||||||
const message = messageRef.current;
|
const message = messageRef.current;
|
||||||
|
|
||||||
|
const handleEscape = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === "Escape") {
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
window.addEventListener("keydown", handleEscape);
|
||||||
|
|
||||||
if (container && message) {
|
if (container && message) {
|
||||||
const checkScrollable = () => {
|
const checkScrollable = () => {
|
||||||
if (container.scrollHeight > container.clientHeight) {
|
if (container.scrollHeight > container.clientHeight) {
|
||||||
@@ -45,9 +52,14 @@ export function SetDefaultModelModal({
|
|||||||
};
|
};
|
||||||
checkScrollable();
|
checkScrollable();
|
||||||
window.addEventListener("resize", checkScrollable);
|
window.addEventListener("resize", checkScrollable);
|
||||||
return () => window.removeEventListener("resize", checkScrollable);
|
return () => {
|
||||||
|
window.removeEventListener("resize", checkScrollable);
|
||||||
|
window.removeEventListener("keydown", handleEscape);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}, []);
|
|
||||||
|
return () => window.removeEventListener("keydown", handleEscape);
|
||||||
|
}, [onClose]);
|
||||||
|
|
||||||
const defaultModelDestructured = defaultModel
|
const defaultModelDestructured = defaultModel
|
||||||
? destructureValue(defaultModel)
|
? destructureValue(defaultModel)
|
||||||
|
Reference in New Issue
Block a user