(pageId: string, preview = false)
| 403 | |
| 404 | // 打开页面(在标签页中) |
| 405 | export async function openPage(pageId: string, preview = false): Promise<void> { |
| 406 | const { page, message, tab } = stores |
| 407 | const existingPage = page.getById(pageId) |
| 408 | if (!existingPage) return |
| 409 | |
| 410 | // 预加载消息 |
| 411 | await message.load(pageId) |
| 412 | |
| 413 | const existingTab = tab.tabs.find((t) => t.dataId === pageId) |
| 414 | |
| 415 | if (existingTab) { |
| 416 | tab.openTab(existingTab, preview) |
| 417 | } else { |
| 418 | tab.openTab( |
| 419 | { |
| 420 | id: uuidv4(), |
| 421 | type: 'chat', |
| 422 | title: existingPage.name, |
| 423 | dataId: pageId |
| 424 | }, |
| 425 | preview |
| 426 | ) |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | // 获取文件夹下的页面 |
| 431 | export function getPagesInFolder(folderId: string | undefined): PageRecord[] { |
no test coverage detected