Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,11 +26,27 @@ def push(text):
|
|
26 |
print(f"Pushover error: {e}")
|
27 |
|
28 |
def record_user_details(email, name="Name not provided", notes="not provided"):
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
return {"recorded": "ok"}
|
31 |
|
32 |
def record_unknown_question(question):
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
return {"recorded": "ok"}
|
35 |
|
36 |
record_user_details_json = {
|
@@ -185,9 +201,10 @@ with gr.Blocks(title="Jacob Isaacson Chatbot") as iface:
|
|
185 |
gr.ChatInterface(
|
186 |
fn=me.chat_stream,
|
187 |
chatbot=gr.Chatbot(show_copy_button=True),
|
188 |
-
|
189 |
-
|
190 |
)
|
191 |
|
192 |
if __name__ == "__main__":
|
193 |
iface.launch()
|
|
|
|
26 |
print(f"Pushover error: {e}")
|
27 |
|
28 |
def record_user_details(email, name="Name not provided", notes="not provided"):
|
29 |
+
latest_log = "
|
30 |
+
".join([f"{entry['role'].capitalize()}: {entry['content'][:200]}" for entry in me.session_log[-6:]])
|
31 |
+
msg = f"[New Contact]
|
32 |
+
Name: {name}
|
33 |
+
Email: {email}
|
34 |
+
Notes: {notes}
|
35 |
+
|
36 |
+
Recent Chat:
|
37 |
+
{latest_log}"
|
38 |
+
push(msg)
|
39 |
return {"recorded": "ok"}
|
40 |
|
41 |
def record_unknown_question(question):
|
42 |
+
latest_log = "
|
43 |
+
".join([f"{entry['role'].capitalize()}: {entry['content'][:200]}" for entry in me.session_log[-6:]])
|
44 |
+
msg = f"[Unknown Question]
|
45 |
+
Q: {question}
|
46 |
+
|
47 |
+
Recent Chat:
|
48 |
+
{latest_log}"
|
49 |
+
push(msg)
|
50 |
return {"recorded": "ok"}
|
51 |
|
52 |
record_user_details_json = {
|
|
|
201 |
gr.ChatInterface(
|
202 |
fn=me.chat_stream,
|
203 |
chatbot=gr.Chatbot(show_copy_button=True),
|
204 |
+
type="messages",
|
205 |
+
chatbot_initial_message={"role": "assistant", "content": "Hello, my name is Jacob Isaacson. Please ask me any questions about my professional career and I will do my best to respond."}
|
206 |
)
|
207 |
|
208 |
if __name__ == "__main__":
|
209 |
iface.launch()
|
210 |
+
|