Spaces:
Sleeping
Sleeping
Commit ·
398fab1
1
Parent(s): a8612d1
Bug Fix : python {} error
Browse files
app.py
CHANGED
|
@@ -66,14 +66,23 @@ with gr.Blocks() as demo:
|
|
| 66 |
chroma_md = f"_ChromaDB error: {e}_"
|
| 67 |
matches = []
|
| 68 |
|
|
|
|
|
|
|
|
|
|
| 69 |
# Generate LLM response using matched context
|
| 70 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
prompt = f"""You are replying as **{user}** in a group chat planning a trip.
|
| 72 |
|
| 73 |
Here are some relevant past messages from the chat:
|
| 74 |
|
| 75 |
-
{
|
| 76 |
-
|
| 77 |
Now, as {user}, respond naturally to the following new message:
|
| 78 |
|
| 79 |
\"{message}\"
|
|
|
|
| 66 |
chroma_md = f"_ChromaDB error: {e}_"
|
| 67 |
matches = []
|
| 68 |
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
|
| 72 |
# Generate LLM response using matched context
|
| 73 |
try:
|
| 74 |
+
|
| 75 |
+
past_messages = "".join([
|
| 76 |
+
f"- [{metadata['timestamp']}] {metadata['user']}: {text}\n"
|
| 77 |
+
for text, metadata in zip(matches, results['metadatas'][0])
|
| 78 |
+
])
|
| 79 |
+
|
| 80 |
+
|
| 81 |
prompt = f"""You are replying as **{user}** in a group chat planning a trip.
|
| 82 |
|
| 83 |
Here are some relevant past messages from the chat:
|
| 84 |
|
| 85 |
+
{past_messages}
|
|
|
|
| 86 |
Now, as {user}, respond naturally to the following new message:
|
| 87 |
|
| 88 |
\"{message}\"
|