diff --git a/web/src/components/AgentChatComponent.vue b/web/src/components/AgentChatComponent.vue
index 947892a5..1c4b3396 100644
--- a/web/src/components/AgentChatComponent.vue
+++ b/web/src/components/AgentChatComponent.vue
@@ -381,6 +381,14 @@ const hasAgentStateContent = computed(() => {
return todoCount > 0 || fileCount > 0
})
+// 监听 hasAgentStateContent 从 false → true 时,自动展开面板
+watch(hasAgentStateContent, (newVal, oldVal) => {
+ if (newVal && !oldVal) {
+ // 从无状态变为有状态时,自动展开面板
+ isAgentPanelOpen.value = true
+ }
+})
+
const mentionConfig = computed(() => {
const rawFiles = currentAgentState.value?.files || {}
const files = []
@@ -1273,20 +1281,25 @@ const sendMessage = async ({
// 检查第一个对话是否为空
const isFirstChatEmpty = () => {
if (threads.value.length === 0) return false
- const firstThread = threads.value[0]
- const firstThreadMessages = threadMessages.value[firstThread.id] || []
- return firstThreadMessages.length === 0
+ const chatToReuse = getFirstNonPinnedChat(threads.value)
+ const messages = threadMessages.value[chatToReuse.id]
+ // 只有当消息已加载且为空时才返回 true
+ return messages !== undefined && messages.length === 0
}
// 获取第一个非置顶的对话
const getFirstNonPinnedChat = (chatList) => {
+ if (!chatList || chatList.length === 0) return null
return chatList.find((chat) => !chat.is_pinned) || chatList[0]
}
// 如果第一个对话为空,直接切换到第一个非置顶对话
const switchToFirstChatIfEmpty = async () => {
if (threads.value.length > 0 && isFirstChatEmpty()) {
- await selectChat(getFirstNonPinnedChat(threads.value).id)
+ const chatToReuse = getFirstNonPinnedChat(threads.value)
+ if (chatState.currentThreadId !== chatToReuse.id) {
+ await selectChat(chatToReuse.id)
+ }
return true
}
return false
diff --git a/web/src/components/AgentInputArea.vue b/web/src/components/AgentInputArea.vue
index 1f2ab9b3..c564c590 100644
--- a/web/src/components/AgentInputArea.vue
+++ b/web/src/components/AgentInputArea.vue
@@ -210,9 +210,6 @@ defineExpose({
font-weight: 500;
}
- &:active {
- transform: scale(0.95);
- }
&.disabled {
opacity: 0.5;
diff --git a/web/src/components/AgentPanel.vue b/web/src/components/AgentPanel.vue
index 68b77903..786c6e02 100644
--- a/web/src/components/AgentPanel.vue
+++ b/web/src/components/AgentPanel.vue
@@ -137,7 +137,7 @@
+
+