LE Quoc Dat commited on
Commit
8f3e422
·
1 Parent(s): 2ecced5
Files changed (3) hide show
  1. requirements.txt +0 -0
  2. static/js/models.js +13 -13
  3. static/js/prompts.js +43 -43
requirements.txt CHANGED
File without changes
static/js/models.js CHANGED
@@ -1,14 +1,14 @@
1
- const MODEL_API_KEY_MAPPING = {
2
- "gemini/gemini-exp-1206": "GEMINI_API_KEY",
3
- // "gemini/gemini-2.0-flash": "GEMINI_API_KEY",
4
- // "gemini/gemini-2.0-flash-lite-preview-02-05": "GEMINI_API_KEY",
5
- // "gemini/gemini-2.0-pro-exp-02-05": "GEMINI_API_KEY",
6
- // "gemini/gemini-2.0-flash-thinking-exp-01-21": "GEMINI_API_KEY",
7
- "openrouter/google/gemini-exp-1206:free": "OPENROUTER_API_KEY",
8
- "openrouter/anthropic/claude-3-haiku-20240307": "OPENROUTER_API_KEY",
9
- "openrouter/anthropic/claude-3-sonnet-20240229": "OPENROUTER_API_KEY"
10
- };
11
-
12
- const availableModels = Object.keys(MODEL_API_KEY_MAPPING);
13
-
14
  // Removed MODEL_LABELS as they are no longer needed.
 
1
+ const MODEL_API_KEY_MAPPING = {
2
+ "gemini/gemini-exp-1206": "GEMINI_API_KEY",
3
+ // "gemini/gemini-2.0-flash": "GEMINI_API_KEY",
4
+ // "gemini/gemini-2.0-flash-lite-preview-02-05": "GEMINI_API_KEY",
5
+ // "gemini/gemini-2.0-pro-exp-02-05": "GEMINI_API_KEY",
6
+ // "gemini/gemini-2.0-flash-thinking-exp-01-21": "GEMINI_API_KEY",
7
+ "openrouter/google/gemini-exp-1206:free": "OPENROUTER_API_KEY",
8
+ "openrouter/anthropic/claude-3-haiku-20240307": "OPENROUTER_API_KEY",
9
+ "openrouter/anthropic/claude-3-sonnet-20240229": "OPENROUTER_API_KEY"
10
+ };
11
+
12
+ const availableModels = Object.keys(MODEL_API_KEY_MAPPING);
13
+
14
  // Removed MODEL_LABELS as they are no longer needed.
static/js/prompts.js CHANGED
@@ -1,44 +1,44 @@
1
- const FLASHCARD_PROMPT = `Generate flashcards as a JSON array where each object has "question" and "answer" keys. The number of flashcards should be proportional to the text's length and complexity, with a minimum of 1 and a maximum of 10. Each question should test a key concept and the answer should be brief but complete. Use <b> tags to emphasize important words or phrases. Cite short code or examples if needed.
2
-
3
- Example input: "In parallel computing, load balancing refers to the practice of distributing computational work evenly across multiple processing units. This is crucial for maximizing efficiency and minimizing idle time. Dynamic load balancing adjusts the distribution of work during runtime, while static load balancing determines the distribution before execution begins."
4
-
5
- Example output:
6
- [
7
- {
8
- "question": "What is the primary goal of <b>load balancing</b> in parallel computing?",
9
- "answer": "To <b>distribute work evenly</b> across processing units, maximizing efficiency and minimizing idle time."
10
- },
11
- {
12
- "question": "How does <b>dynamic load balancing</b> differ from <b>static load balancing</b>?",
13
- "answer": "Dynamic balancing <b>adjusts work distribution during runtime</b>, while static balancing <b>determines distribution before execution</b>."
14
- }
15
- ]
16
-
17
- Now generate flashcards for this text:`;
18
-
19
- const EXPLAIN_PROMPT = `Explain the following text in simple terms, focusing on the main concepts and their relationships. Use clear and concise language, and break down complex ideas into easily understandable parts. If there are any technical terms, provide brief explanations for them. Return your explanation in a JSON object with an "explanation" key.
20
-
21
- Example output:
22
- {
23
- "explanation": "Load balancing is a technique in parallel computing that ensures work is distributed evenly across different processing units. Think of it like distributing tasks among team members - when done well, everyone has a fair amount of work and the team is more efficient. There are two main approaches: dynamic balancing (adjusting work distribution as needed) and static balancing (planning the distribution ahead of time)."
24
- }
25
-
26
- Now explain this text:`;
27
-
28
- const LANGUAGE_PROMPT = `Return a JSON object with "word", "translation", "question", and "answer" keys for the given word in {targetLanguage}.
29
-
30
- Example input:
31
- Word: "refused"
32
- Phrase: "Hamas refused to join a new round of peace negotiations."
33
-
34
- Example output:
35
- {
36
- "word": "refused",
37
- "translation": "từ chối",
38
- "question": "Hamas <b>refused</b> to join a new round of peace negotiations.",
39
- "answer": "Declined to accept or comply with a request or proposal."
40
- }
41
-
42
- Now explain the word in the phrase below:
43
- Word: "{word}"
44
  Phrase: "{phrase}"`;
 
1
+ const FLASHCARD_PROMPT = `Generate flashcards as a JSON array where each object has "question" and "answer" keys. The number of flashcards should be proportional to the text's length and complexity, with a minimum of 1 and a maximum of 10. Each question should test a key concept and the answer should be brief but complete. Use <b> tags to emphasize important words or phrases. Cite short code or examples if needed.
2
+
3
+ Example input: "In parallel computing, load balancing refers to the practice of distributing computational work evenly across multiple processing units. This is crucial for maximizing efficiency and minimizing idle time. Dynamic load balancing adjusts the distribution of work during runtime, while static load balancing determines the distribution before execution begins."
4
+
5
+ Example output:
6
+ [
7
+ {
8
+ "question": "What is the primary goal of <b>load balancing</b> in parallel computing?",
9
+ "answer": "To <b>distribute work evenly</b> across processing units, maximizing efficiency and minimizing idle time."
10
+ },
11
+ {
12
+ "question": "How does <b>dynamic load balancing</b> differ from <b>static load balancing</b>?",
13
+ "answer": "Dynamic balancing <b>adjusts work distribution during runtime</b>, while static balancing <b>determines distribution before execution</b>."
14
+ }
15
+ ]
16
+
17
+ Now generate flashcards for this text:`;
18
+
19
+ const EXPLAIN_PROMPT = `Explain the following text in simple terms, focusing on the main concepts and their relationships. Use clear and concise language, and break down complex ideas into easily understandable parts. If there are any technical terms, provide brief explanations for them. Return your explanation in a JSON object with an "explanation" key.
20
+
21
+ Example output:
22
+ {
23
+ "explanation": "Load balancing is a technique in parallel computing that ensures work is distributed evenly across different processing units. Think of it like distributing tasks among team members - when done well, everyone has a fair amount of work and the team is more efficient. There are two main approaches: dynamic balancing (adjusting work distribution as needed) and static balancing (planning the distribution ahead of time)."
24
+ }
25
+
26
+ Now explain this text:`;
27
+
28
+ const LANGUAGE_PROMPT = `Return a JSON object with "word", "translation", "question", and "answer" keys for the given word in {targetLanguage}.
29
+
30
+ Example input:
31
+ Word: "refused"
32
+ Phrase: "Hamas refused to join a new round of peace negotiations."
33
+
34
+ Example output:
35
+ {
36
+ "word": "refused",
37
+ "translation": "từ chối",
38
+ "question": "Hamas <b>refused</b> to join a new round of peace negotiations.",
39
+ "answer": "Declined to accept or comply with a request or proposal."
40
+ }
41
+
42
+ Now explain the word in the phrase below:
43
+ Word: "{word}"
44
  Phrase: "{phrase}"`;