Fix typo in variable name

This commit is contained in:
Cohee 2024-10-15 23:14:59 +03:00
parent bb7e7b645d
commit 65d3c2729a

View File

@ -261,7 +261,7 @@ async function summarizeWebLLM(element) {
return false; return false;
} }
const messages = [{ role:'system', content: settings.summary_prompt }, { role:'user', content: element.text }]; const messages = [{ role: 'system', content: settings.summary_prompt }, { role: 'user', content: element.text }];
element.text = await generateWebLlmChatPrompt(messages); element.text = await generateWebLlmChatPrompt(messages);
return true; return true;
@ -275,29 +275,29 @@ async function summarizeWebLLM(element) {
*/ */
async function summarize(hashedMessages, endpoint = 'main') { async function summarize(hashedMessages, endpoint = 'main') {
for (const element of hashedMessages) { for (const element of hashedMessages) {
const cachedSummary = cachedSummaries.get(element.hash) const cachedSummary = cachedSummaries.get(element.hash);
if (!cachedSummary) { if (!cachedSummary) {
let sucess = true; let success = true;
switch (endpoint) { switch (endpoint) {
case 'main': case 'main':
sucess = await summarizeMain(element); success = await summarizeMain(element);
break; break;
case 'extras': case 'extras':
sucess = await summarizeExtra(element); success = await summarizeExtra(element);
break; break;
case 'webllm': case 'webllm':
sucess = await summarizeWebLLM(element); success = await summarizeWebLLM(element);
break; break;
default: default:
console.error('Unsupported endpoint', endpoint); console.error('Unsupported endpoint', endpoint);
sucess = false; success = false;
break; break;
} }
if (sucess) { if (success) {
cachedSummaries.set(element.hash, element.text); cachedSummaries.set(element.hash, element.text);
} else { } else {
break; break;
} }
} else { } else {
element.text = cachedSummary; element.text = cachedSummary;
} }