Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -155,17 +155,16 @@ fall_back_prompt = ChatPromptTemplate.from_template(fall_back_template)
|
|
| 155 |
|
| 156 |
|
| 157 |
chat_history = lambda x: "\n".join(
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
for msg in x["chat_history"]
|
| 165 |
-
]
|
| 166 |
)
|
| 167 |
|
| 168 |
|
|
|
|
| 169 |
fallback_chain = (
|
| 170 |
{"chat_history":chat_history , "query":itemgetter("query")}
|
| 171 |
| fall_back_prompt
|
|
|
|
| 155 |
|
| 156 |
|
| 157 |
chat_history = lambda x: "\n".join(
|
| 158 |
+
[
|
| 159 |
+
(
|
| 160 |
+
f"human: {msg.content}" if isinstance(msg, HumanMessage) else f"AI: {msg.content}"
|
| 161 |
+
)
|
| 162 |
+
for msg in x["chat_history"] if hasattr(msg, "content")
|
| 163 |
+
]
|
|
|
|
|
|
|
| 164 |
)
|
| 165 |
|
| 166 |
|
| 167 |
+
|
| 168 |
fallback_chain = (
|
| 169 |
{"chat_history":chat_history , "query":itemgetter("query")}
|
| 170 |
| fall_back_prompt
|