Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3fcda5d
feat: add Perplexity support
KanameMadoka520 Apr 16, 2026
c0e716c
chore: drop userscript-only Perplexity config
KanameMadoka520 Apr 16, 2026
2ee27fd
fix: address Perplexity review feedback
KanameMadoka520 Apr 17, 2026
198b82a
docs: clarify usage monitor mount hook comment
KanameMadoka520 Apr 17, 2026
59df35c
fix: improve perplexity adapter parity
KanameMadoka520 Apr 17, 2026
14db0f8
fix: refine perplexity outline behavior
KanameMadoka520 Apr 17, 2026
b2e9037
fix: guard notifications api in background
KanameMadoka520 Apr 17, 2026
8328a01
fix: improve perplexity outline extraction
KanameMadoka520 Apr 17, 2026
ad8f654
refactor: drop perplexity pseudo heading detection
KanameMadoka520 Apr 17, 2026
81cb1ae
feat: derive perplexity outline from markdown headings
KanameMadoka520 Apr 17, 2026
0372f28
fix: parse markdown code blocks in perplexity outline
KanameMadoka520 Apr 17, 2026
f026ffb
fix: use main container for perplexity outline
KanameMadoka520 Apr 17, 2026
c20c3a9
feat: add perplexity native theme tint
KanameMadoka520 Apr 17, 2026
9cfa722
revert: remove perplexity host tint
KanameMadoka520 Apr 17, 2026
6203bb7
fix: harden perplexity model locking and sync flows
KanameMadoka520 Apr 23, 2026
f400d7c
fix: sync perplexity inbox actions with native threads
KanameMadoka520 Apr 24, 2026
73850ad
fix: refresh perplexity inbox after native sidebar changes
KanameMadoka520 Apr 24, 2026
71d37d7
chore: merge upstream main
KanameMadoka520 Apr 24, 2026
c2e970c
fix: include perplexity in userscript matches
KanameMadoka520 Apr 24, 2026
c5c73ee
fix: center perplexity zen mode layout
KanameMadoka520 Apr 24, 2026
dc018a3
fix: silence perplexity thread preload failures
KanameMadoka520 Apr 24, 2026
05de0e9
fix: support perplexity userscript model toggle
KanameMadoka520 Apr 25, 2026
51ef432
fix: sync perplexity native sidebar deletes
KanameMadoka520 Apr 25, 2026
ef714d6
fix: center perplexity zen composer
KanameMadoka520 Apr 25, 2026
3053fa5
fix: full-bleed perplexity zen composer rail
KanameMadoka520 Apr 25, 2026
dea0dba
fix: calibrate perplexity zen centering
KanameMadoka520 Apr 25, 2026
158d5b6
fix: center perplexity zen home layout
KanameMadoka520 Apr 25, 2026
7ca9c77
fix: address perplexity review findings
KanameMadoka520 Apr 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/developer/outline-performance-plan.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 大纲系统性能优化与 Bug 修复计划

> 创建日期:2026-04-20
> 创建日期:2026-04-20
> 分析范围:`src/core/outline-manager.ts`、`src/adapters/gemini.ts`、`src/components/OutlineTab.tsx`

---
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@
"https://ima.qq.com/*",
"https://chat.deepseek.com/*",
"https://www.kimi.com/*",
"https://www.perplexity.ai/*",
"https://perplexity.ai/*",
"https://chatglm.cn/*",
"https://chat.qwen.ai/*",
"https://www.qianwen.com/*",
Expand Down
95 changes: 93 additions & 2 deletions src/adapters/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
url?: string
}

export interface ConversationRenameTarget {
id: string
title?: string
url?: string
}

export interface SiteDeleteConversationResult {
id: string
success: boolean
Expand Down Expand Up @@ -86,7 +92,10 @@
selector: string
shadow: boolean
extractInfo: (el: Element) => ConversationInfo | null
extractRemovedInfo?: (el: Element) => ConversationInfo | null
getTitleElement: (el: Element) => Element | null
enablePolling?: boolean
pollIntervalMs?: number
}

export interface AnchorData {
Expand Down Expand Up @@ -204,6 +213,17 @@
if (!normalized) return ""

const lines = normalized.split("\n")

// Some sites wrap code blocks as:
// text\nflowchart TD ...
// Strip a leading plain-text language marker before Mermaid detection.
if (lines.length > 1) {
const firstLine = lines[0].trim().toLowerCase()
if (/^(text|plain(?:\s|-)?text|text\/plain|markdown|text\/markdown|md|txt)$/.test(firstLine)) {
return normalizeAssistantMermaidSource(lines.slice(1).join("\n"))
}
}

const firstMeaningfulLineIndex = getFirstMeaningfulMermaidLineIndex(lines)
if (firstMeaningfulLineIndex === -1) {
return normalized
Expand Down Expand Up @@ -383,6 +403,14 @@
return []
}

/**
* Whether getConversationList currently includes a complete enough remote snapshot
* to safely prune local conversations that disappeared from the site.
*/
hasAuthoritativeConversationList(): boolean {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新增 adapter capability 本身可以接受,但这里的能力要非常克制。hasAuthoritativeConversationList() 这个名字和语义会让公共 manager 相信“缺失即删除”,而 Perplexity 当前线程列表并不能保证完整。

建议不要把 prune/delete 判断做成通用能力,至少默认公共逻辑不应据此删除本地数据;如果 Perplexity 需要处理 native sidebar 删除,应限制在 Perplexity adapter 自己的同步逻辑里,不能扩散到所有会话管理路径。

return false
}

/** 获取当前页面会话的基础元数据 */
getCurrentConversationInfo(): ConversationInfo | null {
const id = this.getSessionId()
Expand Down Expand Up @@ -446,6 +474,17 @@
return results
}

async renameConversationOnSite(
_target: ConversationRenameTarget,
_newTitle: string,
): Promise<{ success: boolean; method: "api" | "ui" | "none"; reason?: string }> {
return {
success: false,
method: "none",
reason: "not_supported",
}
}

async loadAllConversations(): Promise<void> {
const container = this.getSidebarScrollContainer()
if (!container) return
Expand Down Expand Up @@ -500,6 +539,44 @@
return selectorBtn?.textContent || selectorBtn?.innerText || ""
}

/**
* Whether the site's model selector menu is currently open.
* Adapters can override this so the shared model locker avoids
* interfering with a manually opened model menu.
*/
isModelSelectorOpen(): boolean {
return false
}

/**
* Some sites need a persistent model-lock monitor rather than a short
* relock window after route changes.
*/
usesPersistentModelLockMonitor(): boolean {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些模型锁定相关 hook 暴露了一个更复杂的持续监控模型,但我不希望为 Perplexity 引入这种通用机制。当前需求更像“默认模型初始化”,不是强制锁定。

公共基类里可以保留一个简单的站点能力扩展点,但不应该把 persistent monitor、mutation debounce、UI ready 等一整套复杂机制变成通用抽象。这样会增加维护成本,也会让其它站点以后更容易误用。

return false
}

getModelLockMonitorInterval(): number {
return 1000
}

getModelLockMonitorRoot(): Node | null {
return typeof document !== "undefined" ? document.body : null
}

getModelLockMutationDebounce(): number {
return 120
}

/**
* Whether the site's model-lock UI is currently available.
* Sites with temporary mode/tool menus instead of a model selector can
* return false so the shared locker waits for the selector to come back.
*/
isModelLockUiReady(): boolean {
return true
}

/** 获取网络监控配置 */
getNetworkMonitorConfig(): NetworkMonitorConfig | null {
return null
Expand Down Expand Up @@ -548,6 +625,10 @@
return null
}

onZenModeChanged(_enabled: boolean): void {
// Optional hook for site-specific layout calibration.
}

/** 返回净化模式配置(隐藏免责声明、广告、下载按钮等冗余元素) */
getCleanModeConfig(): ZenModeConfig | null {
return null
Expand Down Expand Up @@ -579,8 +660,18 @@
}

/**
* 精准查找提交按钮
* 当站点存在多个相邻 icon button,且仅靠通用选择器/距离判断容易误判时使用
* Provide a custom anchor for mounting the usage monitor.
* Override when the default placement near the editor would break layout.
*/
getUsageCounterMountAnchor(
_editor: HTMLElement,
_submitButton: HTMLElement | null,
): HTMLElement | null {
return null
}

/**
* Precisely locate the submit button when generic selectors are ambiguous.
*/
findSubmitButton(_editor: HTMLElement | null): HTMLElement | null {
return null
Expand Down Expand Up @@ -1066,7 +1157,7 @@
behavior: "instant",
block: "start",
__bypassLock: true,
} as any)

Check warning on line 1160 in src/adapters/base.ts

View workflow job for this annotation

GitHub Actions / Audit Code Quality

Unexpected any. Specify a different type
}

/** 是否支持滚动锁定功能 */
Expand Down
2 changes: 2 additions & 0 deletions src/adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { GeminiEnterpriseAdapter } from "./gemini-enterprise"
import { GrokAdapter } from "./grok"
import { ImaAdapter } from "./ima"
import { KimiAdapter } from "./kimi"
import { PerplexityAdapter } from "./perplexity"
import { QianwenAdapter } from "./qianwen"
import { QwenAiAdapter } from "./qwen-studio"
import { YuanbaoAdapter } from "./yuanbao"
Expand All @@ -32,6 +33,7 @@ const adapters: SiteAdapter[] = [
new DeepSeekAdapter(),
new DoubaoAdapter(),
new ImaAdapter(),
new PerplexityAdapter(),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里把 PerplexityAdapter 和其它 adapter 一样 eager import 并实例化,会让 4000+ 行 Perplexity 适配代码进入所有站点的 content/userscript 主包。这个 PR 的包体积已经有明显增长,而Greasy Fork 对油猴脚本本身有字符数限制,之前加“高级模型用量监控”已达上限,强行拆除了一部分代码出去。对我来说,新增单站点支持不能让所有用户都支付这部分体积和运行时成本。

建议先拆成最小可合并版本,或者把站点适配改成按 hostname 懒加载/按需动态导入;至少不能在没有体积控制方案的情况下直接把这么大的 adapter 放进公共入口。

new ChatGLMAdapter(),
new KimiAdapter(),
new QwenAiAdapter(),
Expand Down
Loading
Loading