Spaces:
Sleeping
Sleeping
ㅅㅎㅇ commited on
Commit ·
51796c8
1
Parent(s): 18b03df
Fix: Prevent stop button from appearing during chat processing - Enhance CSS selectors with more specific targeting - Add JavaScript to dynamically hide stop buttons - Use MutationObserver to detect DOM changes - Follow Gradio ChatInterface documentation pattern
Browse files- CodeWeaver/ui/app.py +67 -4
CodeWeaver/ui/app.py
CHANGED
|
@@ -74,26 +74,88 @@ textarea[data-testid="textbox"][placeholder*="세션 ID"] {
|
|
| 74 |
width: 100% !important;
|
| 75 |
max-width: 100% !important;
|
| 76 |
}
|
| 77 |
-
/* 멈춤 버튼 숨기기 및 클릭 비활성화 */
|
| 78 |
button[aria-label*="Stop"],
|
| 79 |
button[aria-label*="stop"],
|
| 80 |
button[data-testid*="stop"],
|
| 81 |
button[title*="Stop"],
|
| 82 |
button[title*="멈춤"],
|
| 83 |
button[aria-label="Stop"],
|
| 84 |
-
button[aria-label="Stop generation"]
|
|
|
|
|
|
|
|
|
|
| 85 |
display: none !important;
|
| 86 |
pointer-events: none !important;
|
| 87 |
visibility: hidden !important;
|
| 88 |
opacity: 0 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
}
|
| 90 |
/* ChatInterface의 멈춤 버튼 숨기기 (더 일반적인 선택자) */
|
| 91 |
.gradio-chatinterface button[aria-label*="Stop"],
|
| 92 |
-
.gradio-chatinterface button[data-testid*="stop"]
|
|
|
|
|
|
|
|
|
|
| 93 |
display: none !important;
|
| 94 |
pointer-events: none !important;
|
| 95 |
visibility: hidden !important;
|
| 96 |
opacity: 0 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
}
|
| 98 |
"""
|
| 99 |
|
|
@@ -146,7 +208,8 @@ def create_demo() -> gr.Blocks:
|
|
| 146 |
|
| 147 |
with gr.Blocks(
|
| 148 |
title="CodeWeaver - AI 개발 도우미",
|
| 149 |
-
css=CSS # Gradio Blocks 문서: CSS를 Blocks 생성자에 전달
|
|
|
|
| 150 |
) as demo:
|
| 151 |
|
| 152 |
gr.Markdown("""
|
|
|
|
| 74 |
width: 100% !important;
|
| 75 |
max-width: 100% !important;
|
| 76 |
}
|
| 77 |
+
/* 멈춤 버튼 숨기기 및 클릭 비활성화 - 모든 가능한 선택자 포함 */
|
| 78 |
button[aria-label*="Stop"],
|
| 79 |
button[aria-label*="stop"],
|
| 80 |
button[data-testid*="stop"],
|
| 81 |
button[title*="Stop"],
|
| 82 |
button[title*="멈춤"],
|
| 83 |
button[aria-label="Stop"],
|
| 84 |
+
button[aria-label="Stop generation"],
|
| 85 |
+
button[aria-label="Stop Generation"],
|
| 86 |
+
button:has-text("Stop"),
|
| 87 |
+
button:has-text("멈춤") {
|
| 88 |
display: none !important;
|
| 89 |
pointer-events: none !important;
|
| 90 |
visibility: hidden !important;
|
| 91 |
opacity: 0 !important;
|
| 92 |
+
width: 0 !important;
|
| 93 |
+
height: 0 !important;
|
| 94 |
+
padding: 0 !important;
|
| 95 |
+
margin: 0 !important;
|
| 96 |
+
overflow: hidden !important;
|
| 97 |
}
|
| 98 |
/* ChatInterface의 멈춤 버튼 숨기기 (더 일반적인 선택자) */
|
| 99 |
.gradio-chatinterface button[aria-label*="Stop"],
|
| 100 |
+
.gradio-chatinterface button[data-testid*="stop"],
|
| 101 |
+
.gradio-chatinterface button[aria-label*="stop"],
|
| 102 |
+
.gradio-chatinterface button[title*="Stop"],
|
| 103 |
+
.gradio-chatinterface button[title*="멈춤"] {
|
| 104 |
display: none !important;
|
| 105 |
pointer-events: none !important;
|
| 106 |
visibility: hidden !important;
|
| 107 |
opacity: 0 !important;
|
| 108 |
+
width: 0 !important;
|
| 109 |
+
height: 0 !important;
|
| 110 |
+
padding: 0 !important;
|
| 111 |
+
margin: 0 !important;
|
| 112 |
+
overflow: hidden !important;
|
| 113 |
+
}
|
| 114 |
+
/* 전송 버튼이 멈춤 버튼으로 변경되는 것을 방지 */
|
| 115 |
+
button[data-testid="submit-button"]:has-text("Stop"),
|
| 116 |
+
button[data-testid="submit-button"]:has-text("멈춤"),
|
| 117 |
+
button[data-testid="submit-button"][aria-label*="Stop"] {
|
| 118 |
+
display: none !important;
|
| 119 |
+
pointer-events: none !important;
|
| 120 |
+
visibility: hidden !important;
|
| 121 |
+
opacity: 0 !important;
|
| 122 |
+
}
|
| 123 |
+
"""
|
| 124 |
+
|
| 125 |
+
# JavaScript: 멈춤 버튼을 동적으로 숨기기
|
| 126 |
+
JS = """
|
| 127 |
+
() => {
|
| 128 |
+
const hideStopButtons = () => {
|
| 129 |
+
// 모든 멈춤 버튼 찾기
|
| 130 |
+
const stopButtons = document.querySelectorAll(
|
| 131 |
+
'button[aria-label*="Stop"], ' +
|
| 132 |
+
'button[aria-label*="stop"], ' +
|
| 133 |
+
'button[data-testid*="stop"], ' +
|
| 134 |
+
'button[title*="Stop"], ' +
|
| 135 |
+
'button[title*="멈춤"]'
|
| 136 |
+
);
|
| 137 |
+
stopButtons.forEach(btn => {
|
| 138 |
+
btn.style.display = 'none';
|
| 139 |
+
btn.style.visibility = 'hidden';
|
| 140 |
+
btn.style.opacity = '0';
|
| 141 |
+
btn.style.pointerEvents = 'none';
|
| 142 |
+
});
|
| 143 |
+
};
|
| 144 |
+
|
| 145 |
+
// 초기 실행
|
| 146 |
+
hideStopButtons();
|
| 147 |
+
|
| 148 |
+
// MutationObserver로 DOM 변경 감지
|
| 149 |
+
const observer = new MutationObserver(hideStopButtons);
|
| 150 |
+
observer.observe(document.body, {
|
| 151 |
+
childList: true,
|
| 152 |
+
subtree: true,
|
| 153 |
+
attributes: true,
|
| 154 |
+
attributeFilter: ['aria-label', 'data-testid', 'title']
|
| 155 |
+
});
|
| 156 |
+
|
| 157 |
+
// 주기적으로 확인 (추가 안전장치)
|
| 158 |
+
setInterval(hideStopButtons, 100);
|
| 159 |
}
|
| 160 |
"""
|
| 161 |
|
|
|
|
| 208 |
|
| 209 |
with gr.Blocks(
|
| 210 |
title="CodeWeaver - AI 개발 도우미",
|
| 211 |
+
css=CSS, # Gradio Blocks 문서: CSS를 Blocks 생성자에 전달
|
| 212 |
+
js=JS # JavaScript로 멈춤 버튼 동적 숨기기
|
| 213 |
) as demo:
|
| 214 |
|
| 215 |
gr.Markdown("""
|