ai agent 列表页点击记录或查看进入ai chat 对话界面时,用新标签打开

This commit is contained in:
jingrow 2026-06-30 15:18:29 +08:00
parent dc9f9d23dc
commit 90fb24e556

View File

@ -29,22 +29,24 @@ onMounted(() => {
) {
const agentName = to.params.id as string
if (agentName && agentName !== 'new' && !agentName.startsWith('new-')) {
// window.open
const newTab = window.open('', '_blank')!
try {
const result = await createChat(
undefined, undefined, undefined, 'Ai Agent', agentName, agentName,
)
if (result.success && result.name) {
// Ai Chat
return {
newTab.location.href = router.resolve({
name: 'PageTypeList',
params: { entity: AI_CHAT_SLUG },
query: { selectChat: result.name, agent: agentName },
}
}).href
}
} catch (e) {
console.error('Failed to create agent chat:', e)
newTab.close()
}
return false //
return false // ai-agent
}
}
})