Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,24 +15,24 @@ client_name = ['2016 Election','2024 Election', 'Comparison two years']
|
|
| 15 |
|
| 16 |
def stream_chat_with_rag(
|
| 17 |
message: str,
|
| 18 |
-
history: list,
|
| 19 |
client_name: str
|
| 20 |
):
|
| 21 |
-
print(f"Message: {message}")
|
| 22 |
-
print(f"History: {history}")
|
| 23 |
|
| 24 |
-
# Build the conversation prompt including system prompt and history
|
| 25 |
-
conversation = f"For Client: {client_name}\n"
|
| 26 |
|
| 27 |
-
# Add previous conversation history
|
| 28 |
-
for user_input, assistant_response in history:
|
| 29 |
-
|
| 30 |
|
| 31 |
-
# Add the current user message
|
| 32 |
-
conversation += f"User: {message}\nAssistant:"
|
| 33 |
|
| 34 |
-
# Call the API with the user's process_query
|
| 35 |
-
question = message
|
| 36 |
#answer = client.predict(question=question, api_name="/run_graph")
|
| 37 |
answer = client.predict(
|
| 38 |
query= message,
|
|
|
|
| 15 |
|
| 16 |
def stream_chat_with_rag(
|
| 17 |
message: str,
|
| 18 |
+
# history: list,
|
| 19 |
client_name: str
|
| 20 |
):
|
| 21 |
+
# print(f"Message: {message}")
|
| 22 |
+
# print(f"History: {history}")
|
| 23 |
|
| 24 |
+
# # Build the conversation prompt including system prompt and history
|
| 25 |
+
# conversation = f"For Client: {client_name}\n"
|
| 26 |
|
| 27 |
+
# # Add previous conversation history
|
| 28 |
+
# for user_input, assistant_response in history:
|
| 29 |
+
# conversation += f"User: {user_input}\nAssistant: {assistant_response}\n"
|
| 30 |
|
| 31 |
+
# # Add the current user message
|
| 32 |
+
# conversation += f"User: {message}\nAssistant:"
|
| 33 |
|
| 34 |
+
# # # Call the API with the user's process_query
|
| 35 |
+
# question = message
|
| 36 |
#answer = client.predict(question=question, api_name="/run_graph")
|
| 37 |
answer = client.predict(
|
| 38 |
query= message,
|