A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
refactor: set endpoint in provider, not during summarization
Christian Feib0186928f7e3
diff --git a/lib/llm/index.js b/lib/llm/index.jsindex f4bb085..c84c1fa 100644--- a/lib/llm/index.js+++ b/lib/llm/index.js@@ -14,7 +14,7 @@ export async function summarize(llm = new Generic(system, llmSettings)}- return await llm.summarize(prompt, llmSettings)+ return llm.summarize(prompt)} catch (e) {console.error('Error summarizing video', e.message)}diff --git a/lib/llm/providers/anthropic.js b/lib/llm/providers/anthropic.jsindex d98d501..bfacbe7 100644--- a/lib/llm/providers/anthropic.js+++ b/lib/llm/providers/anthropic.js@@ -6,6 +6,7 @@ export class Anthropic {constructor(system, {model,host,+ endpoint,apiKey,temperature,max_tokens = MAX_TOKENS,@@ -19,15 +20,16 @@ export class Anthropic {}, auth)this.settings = {- temperature,model,host,+ endpoint,apiKey,+ temperature,max_tokens}}- async summarize(prompt, { endpoint }) {+ async summarize(prompt) {if (prompt.length > MAX_PROMPT_LEN) prompt = prompt.substring(0, MAX_PROMPT_LEN)const body = JSON.stringify({@@ -41,7 +43,7 @@ export class Anthropic {})try {- const response = await fetch(this.settings.host + endpoint, {+ const response = await fetch(this.settings.host + this.settings.endpoint, {method: 'POST',headers: this.headers,bodydiff --git a/lib/llm/providers/generic.js b/lib/llm/providers/generic.jsindex b0518e5..85c975e 100644--- a/lib/llm/providers/generic.js+++ b/lib/llm/providers/generic.js@@ -4,6 +4,7 @@ export class Generic {constructor(system, {model,host,+ endpoint,apiKey,max_tokens,}) {@@ -16,12 +17,13 @@ export class Generic {this.settings = {model,host,+ endpoint,apiKey,max_tokens}}- async summarize(prompt, { endpoint }) {+ async summarize(prompt) {if (prompt.length > MAX_PROMPT_LEN) prompt = prompt.substring(0, MAX_PROMPT_LEN)const body = JSON.stringify({@@ -33,7 +35,7 @@ export class Generic {})try {- const response = await fetch(this.settings.host + endpoint, {+ const response = await fetch(this.settings.host + this.settings.endpoint, {method: 'POST',headers: this.headers,body