feat(ext): improve tabs sum

This commit is contained in:
Simon
2026-01-28 15:38:42 +08:00
parent 94ae80ff6a
commit 9d37a452e4
2 changed files with 5 additions and 3 deletions

View File

@@ -65,7 +65,7 @@ export class RemotePageController {
}
const sum = await this.tabsController.summarizeTabs()
browserState.header = sum + '\n' + (browserState.header || '')
browserState.header = sum + '\n\n' + (browserState.header || '')
return browserState
}

View File

@@ -185,10 +185,12 @@ export class TabsController {
}
async summarizeTabs(): Promise<string> {
const summaries = [`| Tab ID | URL | Title |`, `|--------|-----|-------|`]
const summaries = [`| Tab ID | URL | Title | Current |`, `|-----|-----|-----|-----|`]
for (const tab of this.tabs) {
const { title, url } = await this.getTabInfo(tab.id)
summaries.push(`| ${tab.id} | ${url} | ${title} |`)
summaries.push(
`| ${tab.id} | ${url} | ${title} | ${this.currentTabId === tab.id ? '✅' : ''} |`
)
}
return summaries.join('\n')
}