feat(agent): 优化状态工作台自动弹出规则

This commit is contained in:
Wenjie Zhang 2026-04-01 04:04:48 +08:00
parent 70c61aa53e
commit 061067aa89
2 changed files with 23 additions and 3 deletions

View File

@ -262,6 +262,7 @@ import { useAgentRunStream } from '@/composables/useAgentRunStream'
import { useAgentStreamHandler } from '@/composables/useAgentStreamHandler'
import { useStreamSmoother } from '@/composables/useStreamSmoother'
import { useAgentMentionConfig } from '@/composables/useAgentMentionConfig'
import { shouldAutoOpenAgentPanel } from '@/utils/agentPanelAutoOpen'
import AgentArtifactsCard from '@/components/AgentArtifactsCard.vue'
import AgentPanel from '@/components/AgentPanel.vue'
import UserInfoComponent from '@/components/UserInfoComponent.vue'
@ -440,9 +441,7 @@ const currentTodos = computed(() => {
})
const hasAgentStateContent = computed(() => {
if (currentThreadFiles.value.length === 0) return false
const fileCount = currentThreadFiles.value.filter((item) => item?.is_dir !== true).length
return fileCount > 0
return shouldAutoOpenAgentPanel(currentThreadFiles.value)
})
// hasAgentStateContent false true

View File

@ -0,0 +1,21 @@
const USER_DATA_UPLOADS_PREFIX = '/home/gem/user-data/uploads/'
const USER_DATA_OUTPUTS_PREFIX = '/home/gem/user-data/outputs/'
const isTrackedPanelFilePath = (path) => {
const normalizedPath = String(path || '')
return (
normalizedPath.startsWith(USER_DATA_UPLOADS_PREFIX) ||
normalizedPath.startsWith(USER_DATA_OUTPUTS_PREFIX)
)
}
export const shouldAutoOpenAgentPanel = (threadFiles) => {
if (!Array.isArray(threadFiles) || threadFiles.length === 0) return false
return threadFiles.some((item) => item?.is_dir !== true && isTrackedPanelFilePath(item?.path))
}
export {
USER_DATA_OUTPUTS_PREFIX,
USER_DATA_UPLOADS_PREFIX
}