Small corrections
Browse files
app.py
CHANGED
|
@@ -58,7 +58,7 @@ indexing.run({"sources": ["knowledge-plain.txt"]})
|
|
| 58 |
##################################
|
| 59 |
|
| 60 |
no_answer_message = (
|
| 61 |
-
"I'm not allowed to answer this
|
| 62 |
"APIs access in accordance DSA’s transparency and data-sharing provisions. "
|
| 63 |
"Is there anything else I can do for you? "
|
| 64 |
)
|
|
@@ -167,7 +167,7 @@ def chat(message, history):
|
|
| 167 |
"""
|
| 168 |
Chat function for Gradio. Uses the pipeline to produce next answer.
|
| 169 |
"""
|
| 170 |
-
conv_history = "\n\n".join([f"{message[
|
| 171 |
user_history = [message for message in history if message["role"] == "user"]
|
| 172 |
results = answer_query.run({"user_history": user_history, "query": message,
|
| 173 |
"conv_history": conv_history})
|
|
@@ -180,4 +180,4 @@ def chat(message, history):
|
|
| 180 |
return answer
|
| 181 |
|
| 182 |
if __name__ == "__main__":
|
| 183 |
-
gr.ChatInterface(chat, type="messages").launch()
|
|
|
|
| 58 |
##################################
|
| 59 |
|
| 60 |
no_answer_message = (
|
| 61 |
+
"I'm not allowed to answer this question. Please ask something related to "
|
| 62 |
"APIs access in accordance DSA’s transparency and data-sharing provisions. "
|
| 63 |
"Is there anything else I can do for you? "
|
| 64 |
)
|
|
|
|
| 167 |
"""
|
| 168 |
Chat function for Gradio. Uses the pipeline to produce next answer.
|
| 169 |
"""
|
| 170 |
+
conv_history = "\n\n".join([f"{message['role']}: {message['content']}" for message in history[-2:]])
|
| 171 |
user_history = [message for message in history if message["role"] == "user"]
|
| 172 |
results = answer_query.run({"user_history": user_history, "query": message,
|
| 173 |
"conv_history": conv_history})
|
|
|
|
| 180 |
return answer
|
| 181 |
|
| 182 |
if __name__ == "__main__":
|
| 183 |
+
gr.ChatInterface(chat, type="messages").launch()
|