Upload app.py
Browse files
app.py
CHANGED
@@ -134,6 +134,12 @@ def handle_userinput(user_question):
|
|
134 |
else:
|
135 |
st.write(bot_template.replace(
|
136 |
"{{MSG}}", message.content), unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
|
139 |
def main():
|
@@ -142,14 +148,24 @@ def main():
|
|
142 |
page_icon=":books:")
|
143 |
st.write(css, unsafe_allow_html=True)
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
st.session_state.
|
|
|
|
|
|
|
|
|
149 |
|
150 |
st.header("Chat with multiple Files:")
|
151 |
user_question = st.text_input("Ask a question about your documents:")
|
|
|
|
|
152 |
if user_question:
|
|
|
|
|
|
|
|
|
153 |
handle_userinput(user_question)
|
154 |
|
155 |
with st.sidebar:
|
|
|
134 |
else:
|
135 |
st.write(bot_template.replace(
|
136 |
"{{MSG}}", message.content), unsafe_allow_html=True)
|
137 |
+
text_chunks = []
|
138 |
+
def initialize_conversation_chain():
|
139 |
+
# Add the necessary code to initialize the conversation_chain
|
140 |
+
# This may include loading the LlamaCpp model and creating the conversation_chain
|
141 |
+
vectorstore = get_vectorstore(text_chunks) # Replace this with the appropriate code
|
142 |
+
return get_conversation_chain(vectorstore)
|
143 |
|
144 |
|
145 |
def main():
|
|
|
148 |
page_icon=":books:")
|
149 |
st.write(css, unsafe_allow_html=True)
|
150 |
|
151 |
+
# ๋ํ ์ฒด์ธ์ด ์ธ์
์ํ์ ์๊ฑฐ๋ None์ธ ๊ฒฝ์ฐ ์ด๊ธฐํํฉ๋๋ค.
|
152 |
+
if "conversation" not in st.session_state or st.session_state.conversation is None:
|
153 |
+
# ์ ์ ํ ๋ฐ์ดํฐ๋ก text_chunks๋ฅผ ์ ์ํด์ผ ํฉ๋๋ค.
|
154 |
+
st.session_state.conversation = initialize_conversation_chain(text_chunks)
|
155 |
+
# if "conversation" not in st.session_state:
|
156 |
+
# st.session_state.conversation = None
|
157 |
+
# if "chat_history" not in st.session_state:
|
158 |
+
# st.session_state.chat_history = None
|
159 |
|
160 |
st.header("Chat with multiple Files:")
|
161 |
user_question = st.text_input("Ask a question about your documents:")
|
162 |
+
# if user_question:
|
163 |
+
# handle_userinput(user_question)
|
164 |
if user_question:
|
165 |
+
# Ensure that conversation_chain is initialized before calling handle_userinput
|
166 |
+
if st.session_state.conversation is None:
|
167 |
+
st.session_state.conversation = initialize_conversation_chain()
|
168 |
+
|
169 |
handle_userinput(user_question)
|
170 |
|
171 |
with st.sidebar:
|