Skip to content

feat(webclipper): add manual conversation titles#411

Closed
hellodword wants to merge 1 commit intochiimagnus:mainfrom
hellodword:manual-title
Closed

feat(webclipper): add manual conversation titles#411
hellodword wants to merge 1 commit intochiimagnus:mainfrom
hellodword:manual-title

Conversation

@hellodword
Copy link
Copy Markdown

No description provided.

@chiimagnus
Copy link
Copy Markdown
Owner

chiimagnus commented Apr 19, 2026

谢谢佬友提交的pr!我刚刚测试了一下,功能做得还是很棒的!

不过好像没有考虑到兼容性,我发现在其他场景下,如果用户在插件中手动修改title之后,又在ChatGPT正常对话时手动修改了网页中的title,就会导致插件中额外保存一份对话数据哈。

另外,这个修改title的按钮,没有考虑到窄屏、popup面板的显示。

@chiimagnus
Copy link
Copy Markdown
Owner

#412
你试试这个能不能解决你的问题?我不太愿意加入编辑标题的功能,如果强行加入,那也需要放在设置面板中,并且默认关闭。

@hellodword
Copy link
Copy Markdown
Author

hellodword commented Apr 20, 2026

#412 你试试这个能不能解决你的问题?

重复的标题会覆盖写入

image

试了一下,我觉得应该可以根据 document.querySelectorAll('[data-turn-id]') 获取唯一标识,第一个元素就对应对话的第一条消息

const messageId =
(el.getAttribute && (el.getAttribute('data-message-id') || el.getAttribute('data-turn-id') || el.id)) || '';

@chiimagnus
Copy link
Copy Markdown
Owner

你提供的这个截图,应该是自动同步的问题,因为这个对话定位存在一些瑕疵。

所以会看到多条重复的用户输入的消息。要解决这个问题,只需要手动保存即可。

@hellodword
Copy link
Copy Markdown
Author

image image

是两个不同的临时对话,loc是一致的

@hellodword
Copy link
Copy Markdown
Author

hellodword commented Apr 20, 2026

因为目前临时对话的 conversationKey 在第一句话一样的情况下应该是不变的

function makeFallbackConversationKey(messages: any): any {
const firstUser = Array.isArray(messages)
? messages.find((m: any) => m && m.role === 'user' && m.contentText)
: null;
const seed = `${env.location.hostname}|${env.location.pathname}|${firstUser ? firstUser.contentText : ''}`;
const hash = env.normalize && env.normalize.fnv1a32 ? env.normalize.fnv1a32(seed) : String(Date.now());
return `fallback_${hash}`;
}

另外我提议将 findConversationIdFromUrl 也改为这种方案,在使用过程中遇到过非临时对话的URL保持在 https://chatgpt.com 导致一个对话保存两次,不过我没法复现。。。根据 URL 可能还是不如对话元素的 attribute 稳定,因为如果抓不到这些元素那其实也不能算合法对话

@hellodword hellodword marked this pull request as draft April 20, 2026 12:57
@chiimagnus
Copy link
Copy Markdown
Owner

#414 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants