Skip to content

Commit ba0b58f

Browse files
committed
Remove thinking from response
1 parent c3d166b commit ba0b58f

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

background.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ messenger.messages.onNewMailReceived.addListener(async (folder, messages) => {
6565
continue
6666
}
6767

68-
console.log(summary)
68+
const processedSummary = await processResponse(summary)
6969

70-
await sendNewEmail(message, summary)
70+
console.log(processedSummary)
71+
72+
await sendNewEmail(message, processedSummary)
7173
}
7274
})
7375

@@ -170,6 +172,16 @@ async function getPrompt(content) {
170172
return await getLlamaPrompt(content)
171173
}
172174

175+
async function processResponse(response) {
176+
const model = await getModel()
177+
178+
if (model.startsWith("qwen")) {
179+
return response.replace(/<think>.*?<\/think>/gs, '').trim()
180+
}
181+
182+
return response
183+
}
184+
173185
async function getPhiPrompt(content) {
174186
return "<|im_start|>system<|im_sep|>" +
175187
"You are an expert in reading and summarizing emails." +

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "Ollama Summarizer",
44
"description": "Generate email summaries with Ollama",
5-
"version": "1.9",
5+
"version": "1.10",
66
"author": "Matthew Casperson",
77
"browser_specific_settings": {
88
"gecko": {

0 commit comments

Comments
 (0)