-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
57 lines (50 loc) · 1.43 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
async function getEnvironmentVariables() {
const response = await fetch(chrome.runtime.getURL(".env"));
const text = await response.text();
const env = Object.fromEntries(
text.split("\r\n").map((line) => line.split("="))
);
return {
CHATGPT_KEY: env.CHATGPT_KEY,
};
}
function getMainConfig() {
return {
DEBUG: true,
};
}
async function getChatGptConfigObject() {
return {
CHATGPT_MODE: 1, // 1 - CHATGPT_CHAT_URL, 2 - CHATGPT_PROMPT_URL
CHATGPT_MODEL: "gpt-3.5-turbo", // 1 - "gpt-3.5-turbo", 2 - "text-davinci-003"
CHATGPT_TEMPERATURE: 0.75,
PREVIOUS_CONTEXT_LIMIT: 1,
ANSWER_LIMIT: 400,
CHATGPT_CHAT_API: {
URL: "https://api.openai.com/v1/chat/completions",
METHOD: "POST",
},
CHATGPT_PROMPT_API: {
URL: "https://api.openai.com/v1/completions",
METHOD: "POST",
},
TIMESTAMP_EXTRACT_REGEX: /\[(\d+)\]/g,
TIMESTAMPARRAY_EXTRACT_REGEX: /\[(\d+(?:,\s*\d+)*)\]/g,
TIMESTAMPRANGE_EXTRACT_REGEX: /\[(\d+)-(\d+)\]/g,
...(await getEnvironmentVariables()),
};
}
function getYouTubeConfigObject() {
return {
DETAILED_CAPTION_TIMESTAMPS: false,
// 1 token ~= 3 chars in English
TOKEN_MAX: 3900,
TOKEN_RETRY_DESCREASE_VALUE: 300,
YOUTUBE_API: {
URL: "https://www.youtube.com/watch?v=",
METHOD: "GET",
},
CAPTION_EXTRACT_REGEX: /"captionTracks":\[\{"baseUrl":"(.*?)"/,
VIDEOID_EXTRACT_REGEX: /[?&]v=([^&]+)/,
};
}