Skip to content

armgit / my-yt

Public Imported from GitHub
0

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

JavaScript

chore: cleanup server

Christian Fei25d453049561
diff --git a/lib/llm/providers/anthropic.js b/lib/llm/providers/anthropic.js
index a0194b9..547cab7 100644
--- a/lib/llm/providers/anthropic.js
+++ b/lib/llm/providers/anthropic.js
@@ -1,20 +1,8 @@
import { Generic } from './generic.js'
const ANTHROPIC_VERSION = '2023-06-01'
-const MAX_TOKENS = 1024
export class Anthropic extends Generic {
- constructor (system, args = {
- model,
- host,
- endpoint,
- apiKey,
- temperature,
- maxTokens
- }) {
- super(system, args)
- }
-
getHeaders () {
return {
'Content-Type': 'application/json',
diff --git a/lib/repository.js b/lib/repository.js
index 49d5550..ca203a5 100644
--- a/lib/repository.js
+++ b/lib/repository.js
@@ -36,7 +36,7 @@ export default class Repository {
if (this.settings.transcodeVideos === undefined) { this.setTranscodeVideosSetting(true) }
if (this.settings.excludedTerms === undefined) {
this.settings.excludedTerms = []
- this.saveSettings
+ this.saveSettings()
}
fs.readdirSync(`${this.basePath}/videos`).forEach(file => {
diff --git a/lib/subtitles-summary.js b/lib/subtitles-summary.js
index c774963..140097b 100644
--- a/lib/subtitles-summary.js
+++ b/lib/subtitles-summary.js
@@ -1,3 +1,4 @@
+/* eslint-disable no-async-promise-executor */
import fs from 'fs'
import { getVideoSubtitles } from './youtube.js'
import * as llm from './llm/index.js'
@@ -10,19 +11,18 @@ export async function summarizeVideo (id, repo, llmSettings = {}, callback = ()
repo.setVideoTranscript(id, cleanedTranscript)
cleanedTranscript = cleanedTranscript.replace('\n', ' ')
fs.writeFileSync(`./data/videos/${id}.en.txt`, cleanedTranscript)
- callback('prompting llm')
+ callback('prompting llm') // eslint-disable-line
const userPrompt = `
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 systemPrompt = `Summarize this video given its subtitles into increasing levels of conciseness.
Begin by summarizing it into a single paragraph, followed by a longer summary that expands on the key points.
Do not describe or mention the video itself. Simply summarize the points it makes. Focus on the overall or underlying takeaway, cause, reason.`
const summary = await llm.summarize(systemPrompt, userPrompt, llmSettings)
- callback('received summary')
+ callback('received summary') // eslint-disable-line
repo.setVideoSummary(id, summary)
resolve({ summary, transcript: cleanedTranscript })
} catch (error) {
diff --git a/lib/update-videos.js b/lib/update-videos.js
index 02f5965..bf8b692 100644
--- a/lib/update-videos.js
+++ b/lib/update-videos.js
@@ -12,7 +12,7 @@ export async function updateAndPersistVideosForChannel (name, repo, callback = (
if (videos) {
videos = videos.map(v => repo.patchVideo(v))
repo.upsertVideos(videos)
- callback({ name, videos })
+ callback({ name, videos }) // eslint-disable-line
}
return videos
}
diff --git a/lib/youtube.js b/lib/youtube.js
index 7ee31c9..3e3ce1b 100644
--- a/lib/youtube.js
+++ b/lib/youtube.js
@@ -1,3 +1,4 @@
+/* eslint-disable no-async-promise-executor */
import spawn from 'nano-spawn'
import fs from 'fs'
import * as ytdlp from './yt-dlp.js'
@@ -39,7 +40,7 @@ export async function downloadVideo (id, repo, callback = () => {}) {
execSync(`mv ${location.replace(format, 'tmp.' + format)} ${location}`)
console.log(`successfully transcoded video ${video.location}`)
- callback(`successfully transcoded video ${video.location}`)
+ callback(`successfully transcoded video ${video.location}`) // eslint-disable-line
}
repo.updateVideo(id, { downloaded: true })
diff --git a/test/llm/index.test.js b/test/llm/index.test.js
index b428a7f..50d9a2d 100644
--- a/test/llm/index.test.js
+++ b/test/llm/index.test.js
@@ -1,4 +1,4 @@
-import { test, beforeEach, afterEach } from 'node:test'
+import { test, beforeEach } from 'node:test'
import assert from 'node:assert'
import { MockAgent, setGlobalDispatcher } from 'undici'