Update
This commit is contained in:
@@ -55,7 +55,8 @@ async function handleGenerate({ text, lang, tone, angle }, tabId) {
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
const comment = data.comment || data.text || JSON.stringify(data);
|
||||
await chrome.tabs.sendMessage(tabId, { action: 'SHOW_RESULT', comment }).catch(() => {});
|
||||
const model = data.model || '';
|
||||
await chrome.tabs.sendMessage(tabId, { action: 'SHOW_RESULT', comment , model}).catch(() => {});
|
||||
} catch (err) {
|
||||
await chrome.tabs.sendMessage(tabId, { action: 'SHOW_ERROR', error: err.message }).catch(() => {});
|
||||
}
|
||||
|
||||
+10
-3
@@ -86,7 +86,7 @@
|
||||
return false;
|
||||
}
|
||||
if (req.action === 'SHOW_RESULT') {
|
||||
showResult(req.comment);
|
||||
showResult(req.comment, req.model);
|
||||
sendResponse({ ok: true });
|
||||
return false;
|
||||
}
|
||||
@@ -451,7 +451,7 @@
|
||||
}
|
||||
|
||||
// ===== SHOW RESULT / ERROR =====
|
||||
function showResult(comment) {
|
||||
function showResult(comment, model= '') {
|
||||
if (!sidebarHost) return;
|
||||
const s = sidebarHost.shadowRoot;
|
||||
const statusEl = s.querySelector('#ai-status');
|
||||
@@ -460,7 +460,14 @@
|
||||
const drawer = s.querySelector('.drawer');
|
||||
const typingOpts = s.querySelector('#ai-typing-opts');
|
||||
|
||||
if (statusEl) { statusEl.style.display = 'block'; statusEl.className = 'status ok'; statusEl.textContent = comment; }
|
||||
console.log({model});
|
||||
if (statusEl) {
|
||||
statusEl.style.display = 'block';
|
||||
statusEl.className = 'status ok';
|
||||
statusEl.textContent = comment;
|
||||
|
||||
copyHint.textContent = model;
|
||||
}
|
||||
if (copyHint) copyHint.style.display = 'block';
|
||||
if (runBtn) runBtn.disabled = false;
|
||||
if (drawer) drawer.classList.add('open');
|
||||
|
||||
Reference in New Issue
Block a user