feat: 增强输入框状态管理,添加禁用状态和恢复输入状态的逻辑
This commit is contained in:
@ -197,6 +197,11 @@ export function getInputAreaStyles(): string {
|
||||
overflow-y: auto;
|
||||
line-height: 1.5;
|
||||
}
|
||||
textarea:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
background: rgba(128, 128, 128, 0.1);
|
||||
}
|
||||
/* 简洁的滚动条样式 */
|
||||
textarea::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
@ -300,11 +305,17 @@ export function getInputAreaScript(): string {
|
||||
sendIconContainer.style.display = 'none';
|
||||
stopIconContainer.style.display = 'block';
|
||||
isConversationActive = true;
|
||||
// 禁用输入框
|
||||
messageInput.disabled = true;
|
||||
messageInput.placeholder = '正在处理中,请稍候...';
|
||||
} else {
|
||||
sendButton.classList.remove('sending');
|
||||
sendIconContainer.style.display = 'block';
|
||||
stopIconContainer.style.display = 'none';
|
||||
isConversationActive = false;
|
||||
// 启用输入框
|
||||
messageInput.disabled = false;
|
||||
messageInput.placeholder = '输入您的问题,按 Enter 发送,Shift + Enter 换行...';
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,6 +335,11 @@ export function getInputAreaScript(): string {
|
||||
const text = messageInput.value.trim();
|
||||
if (!text) return;
|
||||
|
||||
// 如果正在对话中,阻止发送新消息
|
||||
if (isConversationActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查工作区状态
|
||||
if (!hasWorkspace) {
|
||||
// 如果没有工作区,阻止发送并清空输入框
|
||||
|
||||
Reference in New Issue
Block a user