Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -64,7 +64,7 @@ with gr.Blocks() as demo:
|
|
64 |
scale=4,
|
65 |
label="메시지 입력",
|
66 |
lines=3,
|
67 |
-
placeholder="메시지를 입력하세요. 엔터 키로
|
68 |
)
|
69 |
send = gr.Button("전송", scale=1)
|
70 |
|
@@ -84,6 +84,20 @@ with gr.Blocks() as demo:
|
|
84 |
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.90, step=0.05, label="Top-p (핵 샘플링)")
|
85 |
model = gr.Radio(list(models.keys()), value=list(models.keys())[0], label="언어 모델 선택", info="사용할 언어 모델을 선택하세요")
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
# 이벤트 핸들러 설정
|
88 |
msg.submit(respond, inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, model], outputs=[msg, chatbot])
|
89 |
send.click(respond, inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, model], outputs=[msg, chatbot])
|
|
|
64 |
scale=4,
|
65 |
label="메시지 입력",
|
66 |
lines=3,
|
67 |
+
placeholder="메시지를 입력하세요. 엔터 키로 줄바꿈, Shift+Enter로 전송"
|
68 |
)
|
69 |
send = gr.Button("전송", scale=1)
|
70 |
|
|
|
84 |
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.90, step=0.05, label="Top-p (핵 샘플링)")
|
85 |
model = gr.Radio(list(models.keys()), value=list(models.keys())[0], label="언어 모델 선택", info="사용할 언어 모델을 선택하세요")
|
86 |
|
87 |
+
# JavaScript를 사용하여 키 입력 동작 커스터마이즈
|
88 |
+
msg.js = """
|
89 |
+
function(e) {
|
90 |
+
if (e.key === 'Enter' && !e.shiftKey) {
|
91 |
+
e.preventDefault();
|
92 |
+
return;
|
93 |
+
}
|
94 |
+
if (e.key === 'Enter' && e.shiftKey) {
|
95 |
+
e.preventDefault();
|
96 |
+
document.getElementById('component-3').click();
|
97 |
+
}
|
98 |
+
}
|
99 |
+
"""
|
100 |
+
|
101 |
# 이벤트 핸들러 설정
|
102 |
msg.submit(respond, inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, model], outputs=[msg, chatbot])
|
103 |
send.click(respond, inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, model], outputs=[msg, chatbot])
|