Skip to content

Commit 1368cc6

Browse files
committed
Standardize the file content wrapper and filename files.txt when uploading context to Perplexity and Qwen
1 parent 0cf4d19 commit 1368cc6

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎packages/browser/src/content-scripts/send-prompt-content-script/chatbots/perplexity.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ export const perplexity: Chatbot = {
4646
})
4747
return
4848
}
49-
const blob = new Blob([context], { type: 'text/plain' })
50-
const file = new File([blob], 'context.txt', { type: 'text/plain' })
49+
const blob = new Blob([`<files>\n${context}\n</files>`], {
50+
type: 'text/plain'
51+
})
52+
const file = new File([blob], 'files.txt', { type: 'text/plain' })
5153
const data_transfer = new DataTransfer()
5254
data_transfer.items.add(file)
5355
file_input.files = data_transfer.files

‎packages/browser/src/content-scripts/send-prompt-content-script/chatbots/qwen.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@ export const qwen: Chatbot = {
165165
})
166166
return
167167
}
168-
const blob = new Blob([context], { type: 'text/plain' })
169-
const file = new File([blob], 'context.txt', { type: 'text/plain' })
168+
const blob = new Blob([`<files>\n${context}\n</files>`], {
169+
type: 'text/plain'
170+
})
171+
const file = new File([blob], 'files.txt', { type: 'text/plain' })
170172
const data_transfer = new DataTransfer()
171173
data_transfer.items.add(file)
172174
file_input.files = data_transfer.files

0 commit comments

Comments
 (0)