XThomasBU commited on
Commit
9c40653
β€’
1 Parent(s): fe044f9
Files changed (29) hide show
  1. apps/ai_tutor/.chainlit/config.toml +1 -1
  2. apps/ai_tutor/README.md +12 -0
  3. apps/ai_tutor/app.py +2 -2
  4. apps/ai_tutor/{main.py β†’ chainlit_app.py} +6 -6
  5. apps/ai_tutor/public/{avatars β†’ assets/images/avatars}/ai-tutor.png +0 -0
  6. apps/ai_tutor/public/{avatars β†’ assets/images/avatars}/ai_tutor.png +0 -0
  7. apps/ai_tutor/public/{acastusphoton-svgrepo-com.svg β†’ assets/images/starter_icons/acastusphoton-svgrepo-com.svg} +0 -0
  8. apps/ai_tutor/public/{adv-screen-recorder-svgrepo-com.svg β†’ assets/images/starter_icons/adv-screen-recorder-svgrepo-com.svg} +0 -0
  9. apps/ai_tutor/public/{alarmy-svgrepo-com.svg β†’ assets/images/starter_icons/alarmy-svgrepo-com.svg} +0 -0
  10. apps/ai_tutor/public/{calendar-samsung-17-svgrepo-com.svg β†’ assets/images/starter_icons/calendar-samsung-17-svgrepo-com.svg} +0 -0
  11. apps/ai_tutor/public/files/students_encrypted.json +1 -0
  12. apps/ai_tutor/public/{test.css β†’ files/test.css} +18 -14
  13. apps/ai_tutor/public/space.jpg +0 -3
  14. apps/ai_tutor/templates/cooldown.html +1 -1
  15. apps/ai_tutor/templates/dashboard.html +1 -1
  16. apps/ai_tutor/templates/login.html +1 -1
  17. apps/ai_tutor/templates/unauthorized.html +3 -3
  18. apps/chainlit_base/.chainlit/config.toml +1 -1
  19. apps/chainlit_base/chainlit_base.py +5 -5
  20. apps/chainlit_base/public/{avatars/ai_tutor.png β†’ assets/images/avatars/ai-tutor.png} +0 -0
  21. apps/chainlit_base/public/assets/images/avatars/ai_tutor.png +0 -0
  22. apps/chainlit_base/public/{acastusphoton-svgrepo-com.svg β†’ assets/images/starter_icons/acastusphoton-svgrepo-com.svg} +0 -0
  23. apps/chainlit_base/public/{adv-screen-recorder-svgrepo-com.svg β†’ assets/images/starter_icons/adv-screen-recorder-svgrepo-com.svg} +0 -0
  24. apps/chainlit_base/public/{alarmy-svgrepo-com.svg β†’ assets/images/starter_icons/alarmy-svgrepo-com.svg} +0 -0
  25. apps/chainlit_base/public/{calendar-samsung-17-svgrepo-com.svg β†’ assets/images/starter_icons/calendar-samsung-17-svgrepo-com.svg} +0 -0
  26. apps/chainlit_base/public/files/students_encrypted.json +1 -0
  27. apps/chainlit_base/public/{test.css β†’ files/test.css} +8 -5
  28. apps/chainlit_base/public/space.jpg +0 -3
  29. modules/chat/helpers.py +1 -1
apps/ai_tutor/.chainlit/config.toml CHANGED
@@ -69,7 +69,7 @@ github = "https://github.com/DL4DS/dl4ds_tutor"
69
 
70
  # Specify a CSS file that can be used to customize the user interface.
71
  # The CSS file can be served from the public directory or via an external link.
72
- custom_css = "/public/test.css"
73
 
74
  # Specify a Javascript file that can be used to customize the user interface.
75
  # The Javascript file can be served from the public directory.
 
69
 
70
  # Specify a CSS file that can be used to customize the user interface.
71
  # The CSS file can be served from the public directory or via an external link.
72
+ custom_css = "/public/files/test.css"
73
 
74
  # Specify a Javascript file that can be used to customize the user interface.
75
  # The Javascript file can be served from the public directory.
apps/ai_tutor/README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WIP
2
+
3
+
4
+ ## Run the encrypt_students script
5
+
6
+ - If you don't want the emails to be public, run this script to encrypt the emails of the students.
7
+ - This will create a new file in the public/files/ directory.
8
+ - Place your file with the students' emails in the private/ directory (do not commit this file to the repository).
9
+
10
+ ```bash
11
+ python encrypt_students.py --students-file private/students.json --encrypted-students-file public/files/students_encrypted.json
12
+ ```
apps/ai_tutor/app.py CHANGED
@@ -53,7 +53,7 @@ session_store = {}
53
  CHAINLIT_PATH = "/chainlit_tutor"
54
 
55
  # only admin is given any additional permissions for now -- no limits on tokens
56
- with open("private/students_encrypted.json", "r") as file:
57
  USER_ROLES = json.load(file)
58
 
59
  # Create a Google OAuth flow
@@ -378,7 +378,7 @@ async def get_tokens_left(request: Request):
378
  return {"tokens_left": 0}
379
 
380
 
381
- mount_chainlit(app=app, target="main.py", path=CHAINLIT_PATH)
382
 
383
  if __name__ == "__main__":
384
  import uvicorn
 
53
  CHAINLIT_PATH = "/chainlit_tutor"
54
 
55
  # only admin is given any additional permissions for now -- no limits on tokens
56
+ with open("public/files/students_encrypted.json", "r") as file:
57
  USER_ROLES = json.load(file)
58
 
59
  # Create a Google OAuth flow
 
378
  return {"tokens_left": 0}
379
 
380
 
381
+ mount_chainlit(app=app, target="chainlit_app.py", path=CHAINLIT_PATH)
382
 
383
  if __name__ == "__main__":
384
  import uvicorn
apps/ai_tutor/{main.py β†’ chainlit_app.py} RENAMED
@@ -266,24 +266,24 @@ class Chatbot:
266
  print(e)
267
  return [
268
  cl.Starter(
269
- label="recording on CNNs?",
270
  message="Where can I find the recording for the lecture on Transformers?",
271
- icon="/public/adv-screen-recorder-svgrepo-com.svg",
272
  ),
273
  cl.Starter(
274
- label="where's the slides?",
275
  message="When are the lectures? I can't find the schedule.",
276
- icon="/public/alarmy-svgrepo-com.svg",
277
  ),
278
  cl.Starter(
279
  label="Due Date?",
280
  message="When is the final project due?",
281
- icon="/public/calendar-samsung-17-svgrepo-com.svg",
282
  ),
283
  cl.Starter(
284
  label="Explain backprop.",
285
  message="I didn't understand the math behind backprop, could you explain it?",
286
- icon="/public/acastusphoton-svgrepo-com.svg",
287
  ),
288
  ]
289
 
 
266
  print(e)
267
  return [
268
  cl.Starter(
269
+ label="recording on Transformers?",
270
  message="Where can I find the recording for the lecture on Transformers?",
271
+ icon="/public/assets/images/starter_icons/adv-screen-recorder-svgrepo-com.svg",
272
  ),
273
  cl.Starter(
274
+ label="where's the schedule?",
275
  message="When are the lectures? I can't find the schedule.",
276
+ icon="/public/assets/images/starter_icons/alarmy-svgrepo-com.svg",
277
  ),
278
  cl.Starter(
279
  label="Due Date?",
280
  message="When is the final project due?",
281
+ icon="/public/assets/images/starter_icons/calendar-samsung-17-svgrepo-com.svg",
282
  ),
283
  cl.Starter(
284
  label="Explain backprop.",
285
  message="I didn't understand the math behind backprop, could you explain it?",
286
+ icon="/public/assets/images/starter_icons/acastusphoton-svgrepo-com.svg",
287
  ),
288
  ]
289
 
apps/ai_tutor/public/{avatars β†’ assets/images/avatars}/ai-tutor.png RENAMED
File without changes
apps/ai_tutor/public/{avatars β†’ assets/images/avatars}/ai_tutor.png RENAMED
File without changes
apps/ai_tutor/public/{acastusphoton-svgrepo-com.svg β†’ assets/images/starter_icons/acastusphoton-svgrepo-com.svg} RENAMED
File without changes
apps/ai_tutor/public/{adv-screen-recorder-svgrepo-com.svg β†’ assets/images/starter_icons/adv-screen-recorder-svgrepo-com.svg} RENAMED
File without changes
apps/ai_tutor/public/{alarmy-svgrepo-com.svg β†’ assets/images/starter_icons/alarmy-svgrepo-com.svg} RENAMED
File without changes
apps/ai_tutor/public/{calendar-samsung-17-svgrepo-com.svg β†’ assets/images/starter_icons/calendar-samsung-17-svgrepo-com.svg} RENAMED
File without changes
apps/ai_tutor/public/files/students_encrypted.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"7f1cacca66ee914ddde2ee20e0f2c96651d60cd8aabd310ef25a9e6d88f42df0": ["instructor", "bu"], "f74d264b6b5b2b4c10ce69e4ec16e869e01cb5eb668ed846aa8f6dae5c96cda0": ["admin", "instructor", "bu"], "53401356a874b1539775c73a8564d5e5f4f840441630c9cf649e16d201454f20": ["instructor", "bu"]}
apps/ai_tutor/public/{test.css β†’ files/test.css} RENAMED
@@ -2,27 +2,31 @@ a[href*='https://github.com/Chainlit/chainlit'] {
2
  visibility: hidden;
3
  }
4
 
5
- /* TODO: Default image is still shown in the starter questions */
6
  /* Hide the default avatar image */
7
- .MuiAvatar-root.MuiAvatar-circular {
8
- background-image: none; /* Remove default image */
9
- }
10
-
11
  /* Target the container of the image and set a custom background image */
12
  .MuiAvatar-root.MuiAvatar-circular.css-m2icte {
13
- background-image: url('/public/avatars/ai-tutor.png'); /* Replace with your custom image URL */
14
  background-size: cover; /* Ensure the image covers the entire container */
15
  background-position: center; /* Center the image */
16
  width: 100px; /* Ensure the dimensions match the original */
17
  height: 100px; /* Ensure the dimensions match the original */
18
  border-radius: 50%; /* Maintain circular shape */
19
  }
 
 
 
 
 
 
 
 
20
 
21
- /* .MuiAvatar-root.MuiAvatar-circular.css-v72an7 {
22
- background-image: url('/public/avatars/ai-tutor.png'); /* Replace with your custom image URL */
23
- /* background-size: cover; /* Ensure the image covers the entire container */
24
- /* background-position: center; /* Center the image */
25
- /* width: 40px; /* Ensure the dimensions match the original */
26
- /* height: 40px; /* Ensure the dimensions match the original */
27
- /* border-radius: 50%; /* Maintain circular shape */
28
- /* } */
 
2
  visibility: hidden;
3
  }
4
 
 
5
  /* Hide the default avatar image */
6
+ .MuiAvatar-root img.MuiAvatar-img {
7
+ display: none;
8
+ }
9
+
10
  /* Target the container of the image and set a custom background image */
11
  .MuiAvatar-root.MuiAvatar-circular.css-m2icte {
12
+ background-image: url('/public/assets/images/avatars/ai-tutor.png'); /* Replace with your custom image URL */
13
  background-size: cover; /* Ensure the image covers the entire container */
14
  background-position: center; /* Center the image */
15
  width: 100px; /* Ensure the dimensions match the original */
16
  height: 100px; /* Ensure the dimensions match the original */
17
  border-radius: 50%; /* Maintain circular shape */
18
  }
19
+ .MuiAvatar-root.MuiAvatar-circular.css-v72an7 {
20
+ background-image: url('/public/assets/images/avatars/ai-tutor.png'); /* Replace with your custom image URL */
21
+ background-size: cover; /* Ensure the image covers the entire container */
22
+ background-position: center; /* Center the image */
23
+ width: 40px; /* Ensure the dimensions match the original */
24
+ height: 40px; /* Ensure the dimensions match the original */
25
+ border-radius: 50%; /* Maintain circular shape */
26
+ }
27
 
28
+ .MuiStack-root.css-14k6mw7 img {
29
+ content: url('/public/assets/images/avatars/ai-tutor.png'); /* Replace with the path to your custom image */
30
+ max-height: 45px; /* Ensure the height remains consistent */
31
+ max-width: 45px; /* Ensure the width remains consistent */
32
+ }
 
 
 
apps/ai_tutor/public/space.jpg DELETED

Git LFS Details

  • SHA256: 9ed3f8e7fd9790c394bae59cd0e315742af862ed833e9f42906f36f140abbb07
  • Pointer size: 132 Bytes
  • Size of remote file: 2.68 MB
apps/ai_tutor/templates/cooldown.html CHANGED
@@ -121,7 +121,7 @@
121
  </head>
122
  <body>
123
  <div class="container">
124
- <img src="/public/avatars/ai-tutor.png" alt="AI Tutor Avatar" class="avatar">
125
  <h1>Hello, {{ username }}</h1>
126
  <p>It seems like you need to wait a bit before starting a new session.</p>
127
  <p class="cooldown-message">Time remaining until the cooldown period ends:</p>
 
121
  </head>
122
  <body>
123
  <div class="container">
124
+ <img src="/public/assets/images/avatars/ai-tutor.png" alt="AI Tutor Avatar" class="avatar">
125
  <h1>Hello, {{ username }}</h1>
126
  <p>It seems like you need to wait a bit before starting a new session.</p>
127
  <p class="cooldown-message">Time remaining until the cooldown period ends:</p>
apps/ai_tutor/templates/dashboard.html CHANGED
@@ -123,7 +123,7 @@
123
  </head>
124
  <body>
125
  <div class="container">
126
- <img src="/public/avatars/ai-tutor.png" alt="AI Tutor Avatar" class="avatar">
127
  <h1>Welcome, {{ username }}</h1>
128
  <p>Ready to start your AI tutoring session?</p>
129
  <p class="tokens-left">Tokens Left: {{ tokens_left }}</p>
 
123
  </head>
124
  <body>
125
  <div class="container">
126
+ <img src="/public/assets/images/avatars/ai-tutor.png" alt="AI Tutor Avatar" class="avatar">
127
  <h1>Welcome, {{ username }}</h1>
128
  <p>Ready to start your AI tutoring session?</p>
129
  <p class="tokens-left">Tokens Left: {{ tokens_left }}</p>
apps/ai_tutor/templates/login.html CHANGED
@@ -107,7 +107,7 @@
107
  </head>
108
  <body>
109
  <div class="container">
110
- <img src="/public/avatars/ai-tutor.png" alt="AI Tutor Avatar" class="avatar">
111
  <h1>Terrier Tutor</h1>
112
  <p>Welcome to the DS598 AI Tutor. Please sign in to continue.</p>
113
  <form action="/login/google" method="get">
 
107
  </head>
108
  <body>
109
  <div class="container">
110
+ <img src="/public/assets/images/avatars/ai-tutor.png" alt="AI Tutor Avatar" class="avatar">
111
  <h1>Terrier Tutor</h1>
112
  <p>Welcome to the DS598 AI Tutor. Please sign in to continue.</p>
113
  <form action="/login/google" method="get">
apps/ai_tutor/templates/unauthorized.html CHANGED
@@ -78,11 +78,11 @@
78
  </head>
79
  <body>
80
  <div class="container">
81
- <img src="/public/avatars/ai-tutor.png" alt="AI Tutor Avatar" class="avatar">
82
  <h1>Access Restricted</h1>
83
  <p>
84
- We're currently testing things out for the <strong>DS701</strong> course.
85
- Access is restricted to students of the course. If you're enrolled in <strong>DS701</strong> and seeing this message,
86
  please reach out to us, and we'll help you get access.<br><br>
87
  <em>P.S. Don't forget to use your BU email when logging in!</em>
88
  </p>
 
78
  </head>
79
  <body>
80
  <div class="container">
81
+ <img src="/public/assets/images/avatars/ai-tutor.png" alt="AI Tutor Avatar" class="avatar">
82
  <h1>Access Restricted</h1>
83
  <p>
84
+ We're currently testing things out for the <strong>DS598</strong> course.
85
+ Access is restricted to students of the course. If you're enrolled in <strong>DS598</strong> and seeing this message,
86
  please reach out to us, and we'll help you get access.<br><br>
87
  <em>P.S. Don't forget to use your BU email when logging in!</em>
88
  </p>
apps/chainlit_base/.chainlit/config.toml CHANGED
@@ -69,7 +69,7 @@ cot = "full"
69
 
70
  # Specify a CSS file that can be used to customize the user interface.
71
  # The CSS file can be served from the public directory or via an external link.
72
- # custom_css = "/public/test.css"
73
 
74
  # Specify a Javascript file that can be used to customize the user interface.
75
  # The Javascript file can be served from the public directory.
 
69
 
70
  # Specify a CSS file that can be used to customize the user interface.
71
  # The CSS file can be served from the public directory or via an external link.
72
+ custom_css = "/public/files/test.css"
73
 
74
  # Specify a Javascript file that can be used to customize the user interface.
75
  # The Javascript file can be served from the public directory.
apps/chainlit_base/chainlit_base.py CHANGED
@@ -203,24 +203,24 @@ class Chatbot:
203
 
204
  return [
205
  cl.Starter(
206
- label="recording on CNNs?",
207
  message="Where can I find the recording for the lecture on Transformers?",
208
- icon="/public/adv-screen-recorder-svgrepo-com.svg",
209
  ),
210
  cl.Starter(
211
  label="where's the slides?",
212
  message="When are the lectures? I can't find the schedule.",
213
- icon="/public/alarmy-svgrepo-com.svg",
214
  ),
215
  cl.Starter(
216
  label="Due Date?",
217
  message="When is the final project due?",
218
- icon="/public/calendar-samsung-17-svgrepo-com.svg",
219
  ),
220
  cl.Starter(
221
  label="Explain backprop.",
222
  message="I didn't understand the math behind backprop, could you explain it?",
223
- icon="/public/acastusphoton-svgrepo-com.svg",
224
  ),
225
  ]
226
 
 
203
 
204
  return [
205
  cl.Starter(
206
+ label="recording on Transformers?",
207
  message="Where can I find the recording for the lecture on Transformers?",
208
+ icon="/public/assets/images/starter_icons/adv-screen-recorder-svgrepo-com.svg",
209
  ),
210
  cl.Starter(
211
  label="where's the slides?",
212
  message="When are the lectures? I can't find the schedule.",
213
+ icon="/public/assets/images/starter_icons/alarmy-svgrepo-com.svg",
214
  ),
215
  cl.Starter(
216
  label="Due Date?",
217
  message="When is the final project due?",
218
+ icon="/public/assets/images/starter_icons/calendar-samsung-17-svgrepo-com.svg",
219
  ),
220
  cl.Starter(
221
  label="Explain backprop.",
222
  message="I didn't understand the math behind backprop, could you explain it?",
223
+ icon="/public/assets/images/starter_icons/acastusphoton-svgrepo-com.svg",
224
  ),
225
  ]
226
 
apps/chainlit_base/public/{avatars/ai_tutor.png β†’ assets/images/avatars/ai-tutor.png} RENAMED
File without changes
apps/chainlit_base/public/assets/images/avatars/ai_tutor.png ADDED
apps/chainlit_base/public/{acastusphoton-svgrepo-com.svg β†’ assets/images/starter_icons/acastusphoton-svgrepo-com.svg} RENAMED
File without changes
apps/chainlit_base/public/{adv-screen-recorder-svgrepo-com.svg β†’ assets/images/starter_icons/adv-screen-recorder-svgrepo-com.svg} RENAMED
File without changes
apps/chainlit_base/public/{alarmy-svgrepo-com.svg β†’ assets/images/starter_icons/alarmy-svgrepo-com.svg} RENAMED
File without changes
apps/chainlit_base/public/{calendar-samsung-17-svgrepo-com.svg β†’ assets/images/starter_icons/calendar-samsung-17-svgrepo-com.svg} RENAMED
File without changes
apps/chainlit_base/public/files/students_encrypted.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"7f1cacca66ee914ddde2ee20e0f2c96651d60cd8aabd310ef25a9e6d88f42df0": ["instructor", "bu"], "f74d264b6b5b2b4c10ce69e4ec16e869e01cb5eb668ed846aa8f6dae5c96cda0": ["admin", "instructor", "bu"], "53401356a874b1539775c73a8564d5e5f4f840441630c9cf649e16d201454f20": ["instructor", "bu"]}
apps/chainlit_base/public/{test.css β†’ files/test.css} RENAMED
@@ -2,20 +2,23 @@ a[href*='https://github.com/Chainlit/chainlit'] {
2
  visibility: hidden;
3
  }
4
 
5
-
 
 
 
 
 
6
  /* Target the container of the image and set a custom background image */
7
  .MuiAvatar-root.MuiAvatar-circular.css-m2icte {
8
- background-image: url('/public/avatars/ai-tutor.png'); /* Replace with your custom image URL */
9
  background-size: cover; /* Ensure the image covers the entire container */
10
  background-position: center; /* Center the image */
11
  width: 100px; /* Ensure the dimensions match the original */
12
  height: 100px; /* Ensure the dimensions match the original */
13
  border-radius: 50%; /* Maintain circular shape */
14
  }
15
-
16
-
17
  .MuiAvatar-root.MuiAvatar-circular.css-v72an7 {
18
- background-image: url('/public/avatars/ai-tutor.png'); /* Replace with your custom image URL */
19
  background-size: cover; /* Ensure the image covers the entire container */
20
  background-position: center; /* Center the image */
21
  width: 40px; /* Ensure the dimensions match the original */
 
2
  visibility: hidden;
3
  }
4
 
5
+ /* TODO: Default image is still shown in the starter questions */
6
+ /* Hide the default avatar image */
7
+ .MuiAvatar-root img.MuiAvatar-img {
8
+ display: none;
9
+ }
10
+
11
  /* Target the container of the image and set a custom background image */
12
  .MuiAvatar-root.MuiAvatar-circular.css-m2icte {
13
+ background-image: url('/public/assets/images/avatars/ai-tutor.png'); /* Replace with your custom image URL */
14
  background-size: cover; /* Ensure the image covers the entire container */
15
  background-position: center; /* Center the image */
16
  width: 100px; /* Ensure the dimensions match the original */
17
  height: 100px; /* Ensure the dimensions match the original */
18
  border-radius: 50%; /* Maintain circular shape */
19
  }
 
 
20
  .MuiAvatar-root.MuiAvatar-circular.css-v72an7 {
21
+ background-image: url('/public/assets/images/avatars/ai-tutor.png'); /* Replace with your custom image URL */
22
  background-size: cover; /* Ensure the image covers the entire container */
23
  background-position: center; /* Center the image */
24
  width: 40px; /* Ensure the dimensions match the original */
apps/chainlit_base/public/space.jpg DELETED

Git LFS Details

  • SHA256: 9ed3f8e7fd9790c394bae59cd0e315742af862ed833e9f42906f36f140abbb07
  • Pointer size: 132 Bytes
  • Size of remote file: 2.68 MB
modules/chat/helpers.py CHANGED
@@ -38,7 +38,7 @@ def get_sources(res, answer, stream=True, view_sources=False):
38
  full_answer = "" # Not to include the answer again if streaming
39
 
40
  if not stream: # First, display the answer if not streaming
41
- full_answer = "**Answer:**\n"
42
  full_answer += answer
43
 
44
  if view_sources:
 
38
  full_answer = "" # Not to include the answer again if streaming
39
 
40
  if not stream: # First, display the answer if not streaming
41
+ # full_answer = "**Answer:**\n"
42
  full_answer += answer
43
 
44
  if view_sources: