Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

refactor: extract llm folder

Christian Feid0d4905a4973
diff --git a/lib/llm.js b/lib/llm/index.js
similarity index 70%
rename from lib/llm.js
rename to lib/llm/index.js
index 688a6c9..7e2d623 100644
--- a/lib/llm.js
+++ b/lib/llm/index.js
@@ -1,7 +1,7 @@
-import { Anthropic } from "./drivers/anthropic.js"
-import { Openai } from "./drivers/openai.js"
+import { Anthropic } from "../drivers/anthropic.js"
+import { Openai } from "../drivers/openai.js"
-export async function fetchCompletionLMSTUDIO(
+export async function summarize(
system,
prompt,
llmSettings,
diff --git a/lib/subtitles-summary.js b/lib/subtitles-summary.js
index 2372359..39c2c72 100644
--- a/lib/subtitles-summary.js
+++ b/lib/subtitles-summary.js
@@ -1,6 +1,6 @@
import fs from "fs"
import { getVideoSubtitles } from "./youtube.js"
-import { fetchCompletionLMSTUDIO } from "./llm.js"
+import * as llm from "./llm/index.js"
export async function summarizeVideo(id, repo, llmSettings = {}, callback = () => {}) {
return new Promise(async (resolve, reject) => {
@@ -18,7 +18,7 @@ Extract the key points from the following video transcript:
${cleanedTranscript}`.trim()
const systemPrompt = "You're a helpful assistant that sumarizes a video transcript in max 10 sentences, extracting the key points"
- const summary = await fetchCompletionLMSTUDIO(systemPrompt, userPrompt, llmSettings)
+ const summary = await llm.summarize(systemPrompt, userPrompt, llmSettings)
callback('received summary')
repo.setVideoSummary(id, summary)
resolve({summary, transcript: cleanedTranscript})