Skip to content

Commit ee1c63a

Browse files
committed
fix(pplx:ext): clean up follow-up action links
1 parent d228523 commit ee1c63a

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

perplexity/extension/changelogs/2.0.1.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
- Fixed theme primary color not being applied
66
- `Slash Command Menu`: Fixed trigger & text insertion
7+
- `Export Thread`: Fixed followup links `(pplx://action/followup)` not being removed
78

89
## Changes
910

10-
- Removed `Raw Text Paste` plugin as Perplexity no longer automatically converts pasted text to a file
11+
- Removed `Raw Text Paste` plugin as Perplexity no longer automatically converts pasted text to a file

perplexity/extension/src/hooks/useCopyPplxThread.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ async function copyMessageWithoutCitations({
140140
messageBlockIndex: number;
141141
fetchFn: FetchFn;
142142
}) {
143-
return copyContent({ messageBlockIndex, fetchFn, withCitations: false });
143+
copyContent({
144+
messageBlockIndex,
145+
fetchFn,
146+
withCitations: false,
147+
});
144148
}
145149

146150
async function copyThreadWithCitations({ fetchFn }: { fetchFn: FetchFn }) {

perplexity/extension/src/utils/thread-export.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,31 @@ export class ThreadExport {
155155
includeCitations: boolean;
156156
messageIndex?: number;
157157
}) {
158+
const removeFollowupLinks = (text: string): string => {
159+
return text.replace(/\[(.*?)\]\(pplx:\/\/action\/followup\)/g, "$1");
160+
};
161+
162+
// Export a single message if messageIndex is provided
158163
if (messageIndex != null && threadJSON[messageIndex] != null) {
159-
return ThreadExport.exportMessage({
164+
const exportedMessage = ThreadExport.exportMessage({
160165
message: threadJSON[messageIndex],
161166
includeCitations,
162167
includeQuery: false,
163168
});
169+
170+
return removeFollowupLinks(exportedMessage);
164171
}
165172

166-
return threadJSON
173+
// Export the entire thread
174+
const exportedThread = threadJSON
167175
.map((message) =>
168176
ThreadExport.exportMessage({
169177
message,
170178
includeCitations,
171179
}),
172180
)
173181
.join(" \n--- \n\n\n");
182+
183+
return removeFollowupLinks(exportedThread);
174184
}
175185
}

0 commit comments

Comments
 (0)