Spaces:
Sleeping
Sleeping
feat: Implement sample prompts and enhance introduction message for Eva
Browse files- Added `sample_prompt_send` function to simulate user messages and send them to the LLM.
- Introduced a dictionary of sample prompts for user interaction.
- Updated the introduction message to include buttons for sample prompts, enhancing user engagement.
TODO.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
# 📝 TODOs in Codebase
|
| 2 |
|
| 3 |
- `./app.py:37:# TODO: Create an introduction message here that explains the purpose of the app`
|
| 4 |
-
- `./app.py:
|
| 5 |
-
- `./app.py:
|
| 6 |
-
- `./app.py:
|
| 7 |
- `./pstuts_rag/pstuts_rag/datastore.py:26:# TODO: Write MCP server that ingests `mp4` folder`
|
| 8 |
- `./pstuts_rag/pstuts_rag/datastore.py:66:# TODO: accumulate transcripts of videos when loading, summarize each, then summarize summaries to get a description of the dataset for the prompt`
|
| 9 |
- `./pstuts_rag/pstuts_rag/nodes.py:113:# TODO More robust generation of queries - multiquery launch`
|
|
|
|
| 1 |
# 📝 TODOs in Codebase
|
| 2 |
|
| 3 |
- `./app.py:37:# TODO: Create an introduction message here that explains the purpose of the app`
|
| 4 |
+
- `./app.py:221: # TODO: Make the step label update instead of add`
|
| 5 |
+
- `./app.py:291:# TODO: Clean up imports.`
|
| 6 |
+
- `./app.py:293:# TODO Add buttons with pregenerated queries`
|
| 7 |
- `./pstuts_rag/pstuts_rag/datastore.py:26:# TODO: Write MCP server that ingests `mp4` folder`
|
| 8 |
- `./pstuts_rag/pstuts_rag/datastore.py:66:# TODO: accumulate transcripts of videos when loading, summarize each, then summarize summaries to get a description of the dataset for the prompt`
|
| 9 |
- `./pstuts_rag/pstuts_rag/nodes.py:113:# TODO More robust generation of queries - multiquery launch`
|
app.py
CHANGED
|
@@ -37,6 +37,23 @@ unique_id = uuid4().hex[0:8]
|
|
| 37 |
# TODO: Create an introduction message here that explains the purpose of the app
|
| 38 |
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
@cl.on_chat_start
|
| 41 |
async def on_chat_start():
|
| 42 |
"""
|
|
@@ -53,29 +70,41 @@ async def on_chat_start():
|
|
| 53 |
session_id = cl.context.session.id
|
| 54 |
current_time = datetime.now()
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
# Eva introduction message
|
| 57 |
await cl.Message(
|
| 58 |
content=(
|
| 59 |
"👋 Hi there! I'm **Eva**, your friendly Photoshop expert AI.\n\n"
|
|
|
|
| 60 |
"I'm here to help you with all your Photoshop questions, using real answers from training video transcripts. 🎥✨\n\n"
|
| 61 |
"**How I work:**\n"
|
| 62 |
"- I answer using only what's in the official training videos.\n"
|
| 63 |
"- If I find the answer, I'll include the timestamp so you can jump right to it! ⏱️\n"
|
| 64 |
"- If it's not covered, I'll let you know honestly—no guessing, no made-up info.\n\n"
|
| 65 |
"Feel free to ask anything about Photoshop, and let's get creative together! 🖼️🖱️\n"
|
| 66 |
-
"
|
| 67 |
),
|
|
|
|
| 68 |
author="Eva",
|
| 69 |
).send()
|
| 70 |
|
| 71 |
# Deactivate any previous session
|
| 72 |
active_session = {"id": session_id, "timestamp": current_time}
|
| 73 |
|
| 74 |
-
await cl.Message(
|
| 75 |
-
content=f"🟢 **Active Session**\nSession ID: `{session_id[:8]}...`\n\nYou can now send messages.",
|
| 76 |
-
author="System",
|
| 77 |
-
).send()
|
| 78 |
-
|
| 79 |
configuration = Configuration()
|
| 80 |
# Generate a unique thread_id for this chat session
|
| 81 |
thread_id = f"chat_{uuid4().hex[:8]}"
|
|
|
|
| 37 |
# TODO: Create an introduction message here that explains the purpose of the app
|
| 38 |
|
| 39 |
|
| 40 |
+
async def sample_prompt_send(action: cl.Action):
|
| 41 |
+
# Simulate a user message using the payload
|
| 42 |
+
msg = cl.Message(content=action.payload["text"], author="user")
|
| 43 |
+
await msg.send()
|
| 44 |
+
time.sleep(0.5)
|
| 45 |
+
await message_handler(msg) # send the message to LLM for response
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
sample_prompts = {
|
| 49 |
+
"sample_layers": "What are layers?",
|
| 50 |
+
"sample_lasso": "How do I use lasso when the background is very busy?",
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
for sample_label in sample_prompts:
|
| 54 |
+
sample_prompt_send = cl.action_callback(sample_label)(sample_prompt_send)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
@cl.on_chat_start
|
| 58 |
async def on_chat_start():
|
| 59 |
"""
|
|
|
|
| 70 |
session_id = cl.context.session.id
|
| 71 |
current_time = datetime.now()
|
| 72 |
|
| 73 |
+
sample_actions = [
|
| 74 |
+
cl.Action(
|
| 75 |
+
name=name,
|
| 76 |
+
label='"%s"' % text,
|
| 77 |
+
payload={"text": text},
|
| 78 |
+
icon="mouse-pointer-click",
|
| 79 |
+
)
|
| 80 |
+
for name, text in sample_prompts.items()
|
| 81 |
+
]
|
| 82 |
+
|
| 83 |
+
await cl.Message(
|
| 84 |
+
content=f"🟢 Session ID: `{session_id[:8]}` active.",
|
| 85 |
+
author="System",
|
| 86 |
+
).send()
|
| 87 |
+
|
| 88 |
# Eva introduction message
|
| 89 |
await cl.Message(
|
| 90 |
content=(
|
| 91 |
"👋 Hi there! I'm **Eva**, your friendly Photoshop expert AI.\n\n"
|
| 92 |
+
"---\n\n"
|
| 93 |
"I'm here to help you with all your Photoshop questions, using real answers from training video transcripts. 🎥✨\n\n"
|
| 94 |
"**How I work:**\n"
|
| 95 |
"- I answer using only what's in the official training videos.\n"
|
| 96 |
"- If I find the answer, I'll include the timestamp so you can jump right to it! ⏱️\n"
|
| 97 |
"- If it's not covered, I'll let you know honestly—no guessing, no made-up info.\n\n"
|
| 98 |
"Feel free to ask anything about Photoshop, and let's get creative together! 🖼️🖱️\n"
|
| 99 |
+
"Click on the following buttons to try out some sample prompts:\n"
|
| 100 |
),
|
| 101 |
+
actions=sample_actions,
|
| 102 |
author="Eva",
|
| 103 |
).send()
|
| 104 |
|
| 105 |
# Deactivate any previous session
|
| 106 |
active_session = {"id": session_id, "timestamp": current_time}
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
configuration = Configuration()
|
| 109 |
# Generate a unique thread_id for this chat session
|
| 110 |
thread_id = f"chat_{uuid4().hex[:8]}"
|