明树Git Lab

Commit f421ec49 authored by yangyajing's avatar yangyajing

增加发送按钮

parent 5d7b9c51
...@@ -50,17 +50,27 @@ body, html{ ...@@ -50,17 +50,27 @@ body, html{
} }
.container .input-wrap{ .container .input-wrap{
margin-top: 0.625rem; margin-top: 0.625rem;
display: flex;
align-items: center;
} }
.container .input-wrap input{ .container .input-wrap input{
width: 100%; flex: 1;
width: 0;
border: 1px solid #aaa; border: 1px solid #aaa;
height: 1.875rem; height: 2.5rem;
line-height: 1.875rem; line-height: 2.5rem;
border-radius: 0.25rem; border-radius: 0.5rem;
padding: 0 0.75rem; padding: 0 0.75rem;
box-sizing: border-box; box-sizing: border-box;
outline: none; outline: none;
} }
.container .input-wrap .send-button{
padding: 5px 15px;
background-color: #1FC67E;
color: #fff;
border-radius: 6px;
margin-left: 15px;
}
.mask-container{ .mask-container{
position: fixed; position: fixed;
width: 100%; width: 100%;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
</div> </div>
<div class="input-wrap"> <div class="input-wrap">
<input type="text" id="question-input" placeholder="给deepseek发送消息"> <input type="text" id="question-input" placeholder="给deepseek发送消息">
<div class="send-button">发送</div>
</div> </div>
</div> </div>
<div class="mask-container"> <div class="mask-container">
......
...@@ -78,10 +78,8 @@ $(function () { ...@@ -78,10 +78,8 @@ $(function () {
}) })
} }
// 提交问答 // 提交问答
$("#question-input").keypress(function(event) { $(".send-button").on("click", function() {
if (event.key === "Enter" || event.keyCode === 13) { question = $("#question-input").val();
event.preventDefault();
question = $(this).val();
if (question) { if (question) {
async function handleAsk () { async function handleAsk () {
try { try {
...@@ -160,7 +158,7 @@ $(function () { ...@@ -160,7 +158,7 @@ $(function () {
</div>`; </div>`;
$('.conversation-wrap')[0].insertBefore(div, $('.conversation-loading')[0]); $('.conversation-wrap')[0].insertBefore(div, $('.conversation-loading')[0]);
$('.conversation-loading').show(); $('.conversation-loading').show();
$(this).attr("disabled", true); $("#question-input").attr("disabled", true);
handleAsk(); handleAsk();
// $.ajax({ // $.ajax({
// url: "https://dashscope.aliyuncs.com/api/v1/apps/6de1065c75074ee1a11238ab90c1aa34/completion", // url: "https://dashscope.aliyuncs.com/api/v1/apps/6de1065c75074ee1a11238ab90c1aa34/completion",
...@@ -200,7 +198,6 @@ $(function () { ...@@ -200,7 +198,6 @@ $(function () {
// } // }
// }) // })
} }
}
}); });
// 保存当前问答 // 保存当前问答
function saveConversation () { function saveConversation () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment