Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,6 +34,10 @@ template = """
|
|
| 34 |
The final answer should be in a concise natural language.
|
| 35 |
|
| 36 |
Use the history if you can not understand the question.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
If the question is in another language, translate it to English before proceeding.
|
| 39 |
|
|
@@ -155,7 +159,7 @@ if __name__ == '__main__':
|
|
| 155 |
response = ""
|
| 156 |
|
| 157 |
responses.append(response)
|
| 158 |
-
st.session_state['history'].append(db_chain.intermediate_steps.get("result",''))
|
| 159 |
|
| 160 |
response = "\n\n".join(responses)
|
| 161 |
if response == "":
|
|
@@ -193,7 +197,7 @@ if __name__ == '__main__':
|
|
| 193 |
if "SQLQuery" in response or "Answer:" in response:
|
| 194 |
response = "Sorry I may not have answer to this question."
|
| 195 |
|
| 196 |
-
st.session_state['history'].append(db_chain.intermediate_steps.get("result",''))
|
| 197 |
|
| 198 |
with st.chat_message("assistant"):
|
| 199 |
st.markdown(response)
|
|
@@ -237,7 +241,7 @@ if __name__ == '__main__':
|
|
| 237 |
response = ""
|
| 238 |
|
| 239 |
responses.append(response)
|
| 240 |
-
st.session_state['history'].append(db_chain.intermediate_steps.get("result",''))
|
| 241 |
|
| 242 |
response = "\n\n".join(responses)
|
| 243 |
if response == "":
|
|
@@ -275,7 +279,7 @@ if __name__ == '__main__':
|
|
| 275 |
if "SQLQuery" in response or "Answer:" in response:
|
| 276 |
response = "Sorry I may not have answer to this question."
|
| 277 |
|
| 278 |
-
st.session_state['history'].append(db_chain.intermediate_steps.get("result",''))
|
| 279 |
|
| 280 |
with st.chat_message("assistant"):
|
| 281 |
st.markdown(response)
|
|
|
|
| 34 |
The final answer should be in a concise natural language.
|
| 35 |
|
| 36 |
Use the history if you can not understand the question.
|
| 37 |
+
|
| 38 |
+
Make sure youn understand the plural nouns and process them accordingly to ensure correct query.
|
| 39 |
+
|
| 40 |
+
For instance, commodities should be converted to commodity, products should be converted to product, SKUs to be converted to SKU, families to be converted to family.
|
| 41 |
|
| 42 |
If the question is in another language, translate it to English before proceeding.
|
| 43 |
|
|
|
|
| 159 |
response = ""
|
| 160 |
|
| 161 |
responses.append(response)
|
| 162 |
+
st.session_state['history'].append(db_chain.intermediate_steps.get("result",'') + "\n SQLQuery \n" + db_chain.intermediate_steps.get("sql_cmd",''))
|
| 163 |
|
| 164 |
response = "\n\n".join(responses)
|
| 165 |
if response == "":
|
|
|
|
| 197 |
if "SQLQuery" in response or "Answer:" in response:
|
| 198 |
response = "Sorry I may not have answer to this question."
|
| 199 |
|
| 200 |
+
st.session_state['history'].append(db_chain.intermediate_steps.get("result",'') + "\n SQLQuery \n" + db_chain.intermediate_steps.get("sql_cmd",''))
|
| 201 |
|
| 202 |
with st.chat_message("assistant"):
|
| 203 |
st.markdown(response)
|
|
|
|
| 241 |
response = ""
|
| 242 |
|
| 243 |
responses.append(response)
|
| 244 |
+
st.session_state['history'].append(db_chain.intermediate_steps.get("result",'') + "\n SQLQuery \n" + db_chain.intermediate_steps.get("sql_cmd",''))
|
| 245 |
|
| 246 |
response = "\n\n".join(responses)
|
| 247 |
if response == "":
|
|
|
|
| 279 |
if "SQLQuery" in response or "Answer:" in response:
|
| 280 |
response = "Sorry I may not have answer to this question."
|
| 281 |
|
| 282 |
+
st.session_state['history'].append(db_chain.intermediate_steps.get("result",'') + "\n SQLQuery \n" + db_chain.intermediate_steps.get("sql_cmd",''))
|
| 283 |
|
| 284 |
with st.chat_message("assistant"):
|
| 285 |
st.markdown(response)
|