Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,8 @@ from langchain_community.llms import HuggingFaceTextGenInference
|
|
| 3 |
import os
|
| 4 |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
| 5 |
from langchain.schema import StrOutputParser
|
| 6 |
-
from datetime import datetime
|
|
|
|
| 7 |
|
| 8 |
from custom_llm import CustomLLM, custom_chain_with_history
|
| 9 |
|
|
@@ -113,7 +114,7 @@ if prompt := st.chat_input("Ask me anything.."):
|
|
| 113 |
# Insert data into the table
|
| 114 |
st.session_state.cursor.execute(
|
| 115 |
"INSERT INTO chat_history (input_text, response_text, created_at) VALUES (%s, %s, %s)",
|
| 116 |
-
(prompt, response, datetime.now())
|
| 117 |
)
|
| 118 |
|
| 119 |
# Commit the transaction
|
|
|
|
| 3 |
import os
|
| 4 |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
| 5 |
from langchain.schema import StrOutputParser
|
| 6 |
+
# from datetime import datetime
|
| 7 |
+
from datetime import datetime, timezone, timedelta
|
| 8 |
|
| 9 |
from custom_llm import CustomLLM, custom_chain_with_history
|
| 10 |
|
|
|
|
| 114 |
# Insert data into the table
|
| 115 |
st.session_state.cursor.execute(
|
| 116 |
"INSERT INTO chat_history (input_text, response_text, created_at) VALUES (%s, %s, %s)",
|
| 117 |
+
(prompt, response, datetime.now(timezone.utc) + timedelta(hours=7))
|
| 118 |
)
|
| 119 |
|
| 120 |
# Commit the transaction
|