A browser extension that lets you summarize any webpage and ask questions using AI.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add thinking mode toggle for Ollama models

+73 -14
+19
options/options.css
··· 52 52 margin-bottom: 6px; 53 53 } 54 54 55 + /* Checkbox label styling */ 56 + label:has(input[type="checkbox"]) { 57 + display: flex; 58 + align-items: center; 59 + gap: 8px; 60 + cursor: pointer; 61 + text-transform: none; 62 + font-weight: 500; 63 + font-size: 13.5px; 64 + color: #1a1a1a; 65 + } 66 + 67 + input[type="checkbox"] { 68 + width: 16px; 69 + height: 16px; 70 + cursor: pointer; 71 + accent-color: #1a1a1a; 72 + } 73 + 55 74 input[type="text"], 56 75 input[type="url"], 57 76 input[type="password"],
+12
options/options.html
··· 72 72 </p> 73 73 </div> 74 74 75 + <div class="form-group" id="thinking-mode-group"> 76 + <label for="disable-thinking"> 77 + <input type="checkbox" id="disable-thinking" /> 78 + Disable thinking mode 79 + </label> 80 + <p class="help"> 81 + Disable the model's thinking process for faster responses. 82 + Only applies to thinking-capable models (DeepSeek R1, Qwen 3, etc.). 83 + <strong>Only works with Ollama native API.</strong> 84 + </p> 85 + </div> 86 + 75 87 <div class="form-group"> 76 88 <label>Keyboard Shortcut</label> 77 89 <div class="shortcut-display">
+15 -1
options/options.js
··· 5 5 const apiBaseUrlInput = document.getElementById("api-base-url"); 6 6 const modelInput = document.getElementById("model"); 7 7 const apiKeyInput = document.getElementById("api-key"); 8 + const disableThinkingInput = document.getElementById("disable-thinking"); 9 + const thinkingModeGroup = document.getElementById("thinking-mode-group"); 8 10 const statusDiv = document.getElementById("status"); 9 11 const testBtn = document.getElementById("test-connection"); 10 12 const resetBtn = document.getElementById("reset-defaults"); ··· 14 16 apiBaseUrl: "http://localhost:11434", 15 17 model: "gpt-oss:20b-cloud", 16 18 apiKey: "", 19 + disableThinking: false, 17 20 }; 18 21 19 22 // Load settings on page load 20 23 document.addEventListener("DOMContentLoaded", loadSettings); 21 24 22 - // Update URL placeholder when mode changes 25 + // Update URL placeholder and thinking mode visibility when mode changes 23 26 apiModeInput.addEventListener("change", () => { 24 27 if (apiModeInput.value === "ollama") { 25 28 apiBaseUrlInput.placeholder = "http://localhost:11434"; 29 + thinkingModeGroup.style.display = "block"; 26 30 } else { 27 31 apiBaseUrlInput.placeholder = "http://localhost:11434/v1"; 32 + thinkingModeGroup.style.display = "none"; 28 33 } 29 34 }); 30 35 ··· 37 42 apiBaseUrl: apiBaseUrlInput.value.trim() || defaultSettings.apiBaseUrl, 38 43 model: modelInput.value.trim() || defaultSettings.model, 39 44 apiKey: apiKeyInput.value.trim(), 45 + disableThinking: disableThinkingInput.checked, 40 46 }; 41 47 42 48 try { ··· 54 60 apiBaseUrl: apiBaseUrlInput.value.trim() || defaultSettings.apiBaseUrl, 55 61 model: modelInput.value.trim() || defaultSettings.model, 56 62 apiKey: apiKeyInput.value.trim(), 63 + disableThinking: disableThinkingInput.checked, 57 64 }; 58 65 59 66 showStatus("🔄 Testing connection...", "loading"); ··· 71 78 { role: "user", content: 'Say "Connection successful!"' }, 72 79 ], 73 80 apiMode: settings.apiMode, 81 + disableThinking: settings.disableThinking, 74 82 }, 75 83 }); 76 84 ··· 112 120 apiBaseUrlInput.value = defaultSettings.apiBaseUrl; 113 121 modelInput.value = defaultSettings.model; 114 122 apiKeyInput.value = defaultSettings.apiKey; 123 + disableThinkingInput.checked = defaultSettings.disableThinking; 124 + // Show/hide thinking mode group based on API mode 125 + thinkingModeGroup.style.display = defaultSettings.apiMode === "ollama" ? "block" : "none"; 115 126 showStatus("Settings reset to defaults. Click Save to apply.", "success"); 116 127 }); 117 128 ··· 148 159 apiBaseUrlInput.value = settings.apiBaseUrl; 149 160 modelInput.value = settings.model; 150 161 apiKeyInput.value = settings.apiKey; 162 + disableThinkingInput.checked = settings.disableThinking; 163 + // Show/hide thinking mode group based on API mode 164 + thinkingModeGroup.style.display = settings.apiMode === "ollama" ? "block" : "none"; 151 165 } catch (error) { 152 166 showStatus("Error loading settings: " + error.message, "error"); 153 167 }
+4
popup/popup.js
··· 507 507 apiBaseUrl: "http://localhost:11434", 508 508 model: "gpt-oss:20b-cloud", 509 509 apiKey: "", 510 + disableThinking: false, 510 511 }); 511 512 512 513 // Increased context limit for LLM (was 6000, now 12000) ··· 532 533 apiKey: settings.apiKey, 533 534 messages: apiMessages, 534 535 apiMode: settings.apiMode, 536 + disableThinking: settings.disableThinking, 535 537 }, 536 538 }); 537 539 ··· 610 612 apiBaseUrl: "http://localhost:11434", 611 613 model: "gpt-oss:20b-cloud", 612 614 apiKey: "", 615 + disableThinking: false, 613 616 }); 614 617 615 618 // Increased context limit for LLM (was 8000, now 15000) ··· 637 640 apiKey: settings.apiKey, 638 641 messages: apiMessages, 639 642 apiMode: settings.apiMode, 643 + disableThinking: settings.disableThinking, 640 644 }, 641 645 }); 642 646
+23 -13
scripts/background.js
··· 20 20 apiBaseUrl: "http://localhost:11434", 21 21 model: "gpt-oss:20b-cloud", 22 22 apiKey: "", 23 + disableThinking: false, 23 24 }); 24 25 } 25 26 }); ··· 137 138 } 138 139 139 140 async function handleChatRequest(data) { 140 - const { apiBaseUrl, model, apiKey, messages, apiMode } = data; 141 + const { apiBaseUrl, model, apiKey, messages, apiMode, disableThinking } = data; 141 142 142 143 let useNativeOllama = apiMode === "ollama"; 143 144 144 145 if (useNativeOllama) { 145 - return await callOllamaNative(apiBaseUrl, model, messages); 146 + return await callOllamaNative(apiBaseUrl, model, messages, disableThinking); 146 147 } else { 147 148 return await callOpenAICompatible(apiBaseUrl, model, apiKey, messages); 148 149 } 149 150 } 150 151 151 - async function callOllamaNative(baseUrl, model, messages) { 152 + async function callOllamaNative(baseUrl, model, messages, disableThinking) { 152 153 // Merge all system messages into one so none are dropped 153 154 const systemMsgs = messages.filter((m) => m.role === "system"); 154 155 const systemContent = systemMsgs.map((m) => m.content).join("\n\n"); ··· 171 172 172 173 const url = baseUrl.replace(/\/$/, "") + "/api/generate"; 173 174 175 + // Build request body 176 + const requestBody = { 177 + model: model, 178 + prompt: prompt, 179 + system: systemContent, 180 + stream: false, 181 + options: { 182 + temperature: 0.7, 183 + num_predict: 2048, 184 + }, 185 + }; 186 + 187 + // Only include think: false when user explicitly disables thinking 188 + // (thinking is enabled by default in Ollama, and not all models support it) 189 + if (disableThinking === true) { 190 + requestBody.think = false; 191 + } 192 + 174 193 const response = await fetch(url, { 175 194 method: "POST", 176 195 headers: { 177 196 "Content-Type": "application/json", 178 197 }, 179 - body: JSON.stringify({ 180 - model: model, 181 - prompt: prompt, 182 - system: systemContent, 183 - stream: false, 184 - options: { 185 - temperature: 0.7, 186 - num_predict: 2048, 187 - }, 188 - }), 198 + body: JSON.stringify(requestBody), 189 199 }); 190 200 191 201 if (!response.ok) {