Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -752,7 +752,6 @@ def respond(user_msg, history, mode, language_mode, quiz_count_mode, show_source
|
|
| 752 |
try:
|
| 753 |
history = history + [{"role": "user", "content": text}]
|
| 754 |
|
| 755 |
-
# General greeting / normal conversation
|
| 756 |
if is_general_chat(text):
|
| 757 |
reply = general_chat_reply(text, language_mode)
|
| 758 |
|
|
@@ -781,7 +780,6 @@ def respond(user_msg, history, mode, language_mode, quiz_count_mode, show_source
|
|
| 781 |
|
| 782 |
return "", history, render_chat(history), quiz_state, render_dashboard()
|
| 783 |
|
| 784 |
-
# Quiz evaluation mode
|
| 785 |
if quiz_state.get("active", False):
|
| 786 |
evaluation = oai_json(
|
| 787 |
build_quiz_eval_prompt(
|
|
@@ -846,11 +844,9 @@ def respond(user_msg, history, mode, language_mode, quiz_count_mode, show_source
|
|
| 846 |
|
| 847 |
return "", history, render_chat(history), quiz_state, render_dashboard()
|
| 848 |
|
| 849 |
-
# Retrieval
|
| 850 |
records = search_hybrid(text, shortlist_k=30, final_k=5)
|
| 851 |
context = build_context(records)
|
| 852 |
|
| 853 |
-
# Quiz generation
|
| 854 |
if mode == "Quiz Me":
|
| 855 |
n_questions = choose_quiz_count(text, quiz_count_mode)
|
| 856 |
|
|
@@ -903,7 +899,6 @@ def respond(user_msg, history, mode, language_mode, quiz_count_mode, show_source
|
|
| 903 |
|
| 904 |
return "", history, render_chat(history), quiz_state, render_dashboard()
|
| 905 |
|
| 906 |
-
# Normal answer
|
| 907 |
answer = oai_text(
|
| 908 |
build_tutor_prompt(
|
| 909 |
mode,
|
|
@@ -997,43 +992,45 @@ footer{
|
|
| 997 |
margin: 18px auto;
|
| 998 |
}
|
| 999 |
|
| 1000 |
-
/* SETTINGS BOX - UVa
|
| 1001 |
.bc-settings{
|
| 1002 |
-
background:
|
| 1003 |
-
border-radius:
|
| 1004 |
-
padding:
|
| 1005 |
-
box-shadow:
|
| 1006 |
-
margin-bottom:
|
| 1007 |
-
border-top:
|
|
|
|
| 1008 |
}
|
| 1009 |
|
| 1010 |
.bc-settings label{
|
| 1011 |
-
color:
|
| 1012 |
-
font-weight:
|
| 1013 |
-
}
|
| 1014 |
-
|
| 1015 |
-
.bc-settings .wrap{
|
| 1016 |
-
color: #ffffff !important;
|
| 1017 |
}
|
| 1018 |
|
| 1019 |
.bc-settings input,
|
| 1020 |
.bc-settings textarea,
|
| 1021 |
.bc-settings select{
|
| 1022 |
color:#241336 !important;
|
|
|
|
| 1023 |
}
|
| 1024 |
|
| 1025 |
.bc-howto{
|
| 1026 |
-
margin-top:
|
| 1027 |
-
padding:
|
| 1028 |
-
border-radius:
|
| 1029 |
-
background:
|
| 1030 |
-
color:
|
| 1031 |
-
font-size:
|
| 1032 |
-
line-height:
|
| 1033 |
-
border-left:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1034 |
}
|
| 1035 |
|
| 1036 |
-
/* CHAT WINDOW
|
| 1037 |
.bc-phone{
|
| 1038 |
position: relative;
|
| 1039 |
background: #ffffff;
|
|
@@ -1082,11 +1079,11 @@ footer{
|
|
| 1082 |
}
|
| 1083 |
|
| 1084 |
.bc-chat-shell{
|
| 1085 |
-
background:
|
| 1086 |
-
border-radius:
|
| 1087 |
-
padding:
|
| 1088 |
-
min-height:
|
| 1089 |
-
box-shadow: inset 0 0 0 2px #
|
| 1090 |
}
|
| 1091 |
|
| 1092 |
.bc-chat-wrap{
|
|
@@ -1178,12 +1175,12 @@ footer{
|
|
| 1178 |
}
|
| 1179 |
|
| 1180 |
.bc-empty-text{
|
| 1181 |
-
color:
|
| 1182 |
text-align:center;
|
| 1183 |
-
opacity:
|
| 1184 |
-
font-size:
|
| 1185 |
-
line-height:
|
| 1186 |
-
font-weight:
|
| 1187 |
}
|
| 1188 |
|
| 1189 |
.bc-input-bar{
|
|
@@ -1245,7 +1242,7 @@ footer{
|
|
| 1245 |
border-radius: 14px !important;
|
| 1246 |
}
|
| 1247 |
|
| 1248 |
-
/* DASHBOARD
|
| 1249 |
.bc-dashboard{
|
| 1250 |
background:#ffffff;
|
| 1251 |
border-radius:22px;
|
|
|
|
| 752 |
try:
|
| 753 |
history = history + [{"role": "user", "content": text}]
|
| 754 |
|
|
|
|
| 755 |
if is_general_chat(text):
|
| 756 |
reply = general_chat_reply(text, language_mode)
|
| 757 |
|
|
|
|
| 780 |
|
| 781 |
return "", history, render_chat(history), quiz_state, render_dashboard()
|
| 782 |
|
|
|
|
| 783 |
if quiz_state.get("active", False):
|
| 784 |
evaluation = oai_json(
|
| 785 |
build_quiz_eval_prompt(
|
|
|
|
| 844 |
|
| 845 |
return "", history, render_chat(history), quiz_state, render_dashboard()
|
| 846 |
|
|
|
|
| 847 |
records = search_hybrid(text, shortlist_k=30, final_k=5)
|
| 848 |
context = build_context(records)
|
| 849 |
|
|
|
|
| 850 |
if mode == "Quiz Me":
|
| 851 |
n_questions = choose_quiz_count(text, quiz_count_mode)
|
| 852 |
|
|
|
|
| 899 |
|
| 900 |
return "", history, render_chat(history), quiz_state, render_dashboard()
|
| 901 |
|
|
|
|
| 902 |
answer = oai_text(
|
| 903 |
build_tutor_prompt(
|
| 904 |
mode,
|
|
|
|
| 992 |
margin: 18px auto;
|
| 993 |
}
|
| 994 |
|
| 995 |
+
/* SETTINGS BOX - UVa style light theme */
|
| 996 |
.bc-settings{
|
| 997 |
+
background:#ffffff;
|
| 998 |
+
border-radius:22px;
|
| 999 |
+
padding:18px;
|
| 1000 |
+
box-shadow:0 12px 28px rgba(0,0,0,0.22);
|
| 1001 |
+
margin-bottom:16px;
|
| 1002 |
+
border-top:8px solid #5a2d77;
|
| 1003 |
+
color:#241336 !important;
|
| 1004 |
}
|
| 1005 |
|
| 1006 |
.bc-settings label{
|
| 1007 |
+
color:#5a2d77 !important;
|
| 1008 |
+
font-weight:800 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1009 |
}
|
| 1010 |
|
| 1011 |
.bc-settings input,
|
| 1012 |
.bc-settings textarea,
|
| 1013 |
.bc-settings select{
|
| 1014 |
color:#241336 !important;
|
| 1015 |
+
background:#ffffff !important;
|
| 1016 |
}
|
| 1017 |
|
| 1018 |
.bc-howto{
|
| 1019 |
+
margin-top:12px;
|
| 1020 |
+
padding:16px;
|
| 1021 |
+
border-radius:16px;
|
| 1022 |
+
background:#f4edf7;
|
| 1023 |
+
color:#241336 !important;
|
| 1024 |
+
font-size:14px;
|
| 1025 |
+
line-height:1.55;
|
| 1026 |
+
border-left:6px solid #c7a008;
|
| 1027 |
+
}
|
| 1028 |
+
|
| 1029 |
+
.bc-howto strong{
|
| 1030 |
+
color:#5a2d77 !important;
|
| 1031 |
}
|
| 1032 |
|
| 1033 |
+
/* CHAT WINDOW */
|
| 1034 |
.bc-phone{
|
| 1035 |
position: relative;
|
| 1036 |
background: #ffffff;
|
|
|
|
| 1079 |
}
|
| 1080 |
|
| 1081 |
.bc-chat-shell{
|
| 1082 |
+
background:#ffffff;
|
| 1083 |
+
border-radius:20px;
|
| 1084 |
+
padding:16px;
|
| 1085 |
+
min-height:460px;
|
| 1086 |
+
box-shadow: inset 0 0 0 2px #d8c6e8;
|
| 1087 |
}
|
| 1088 |
|
| 1089 |
.bc-chat-wrap{
|
|
|
|
| 1175 |
}
|
| 1176 |
|
| 1177 |
.bc-empty-text{
|
| 1178 |
+
color:#5a2d77 !important;
|
| 1179 |
text-align:center;
|
| 1180 |
+
opacity:1 !important;
|
| 1181 |
+
font-size:16px;
|
| 1182 |
+
line-height:1.7;
|
| 1183 |
+
font-weight:700;
|
| 1184 |
}
|
| 1185 |
|
| 1186 |
.bc-input-bar{
|
|
|
|
| 1242 |
border-radius: 14px !important;
|
| 1243 |
}
|
| 1244 |
|
| 1245 |
+
/* DASHBOARD */
|
| 1246 |
.bc-dashboard{
|
| 1247 |
background:#ffffff;
|
| 1248 |
border-radius:22px;
|