Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -103,10 +103,11 @@ conversation_chain = ConversationalRetrievalChain.from_llm(
|
|
103 |
retriever=vectorstore.as_retriever(),
|
104 |
memory=memory,
|
105 |
combine_docs_chain_kwargs={"prompt": qa_prompt},
|
106 |
-
return_source_documents=
|
107 |
-
|
108 |
)
|
109 |
|
|
|
110 |
def audio_frame_callback(frame: av.AudioFrame) -> av.AudioFrame:
|
111 |
audio = frame.to_ndarray().flatten()
|
112 |
st.session_state.audio_buffer.put(audio)
|
@@ -122,12 +123,10 @@ def get_ai_response(user_input: str) -> str:
|
|
122 |
if len(user_input) > 512:
|
123 |
user_input = user_input[:512]
|
124 |
|
125 |
-
response
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
if not response or 'answer' not in response:
|
131 |
if attempt < max_retries - 1:
|
132 |
time.sleep(2 ** attempt)
|
133 |
continue
|
|
|
103 |
retriever=vectorstore.as_retriever(),
|
104 |
memory=memory,
|
105 |
combine_docs_chain_kwargs={"prompt": qa_prompt},
|
106 |
+
return_source_documents=False, # Changed to False
|
107 |
+
chain_type="stuff"
|
108 |
)
|
109 |
|
110 |
+
|
111 |
def audio_frame_callback(frame: av.AudioFrame) -> av.AudioFrame:
|
112 |
audio = frame.to_ndarray().flatten()
|
113 |
st.session_state.audio_buffer.put(audio)
|
|
|
123 |
if len(user_input) > 512:
|
124 |
user_input = user_input[:512]
|
125 |
|
126 |
+
# Update response handling
|
127 |
+
response = conversation_chain({"question": user_input})
|
128 |
+
|
129 |
+
if not response:
|
|
|
|
|
130 |
if attempt < max_retries - 1:
|
131 |
time.sleep(2 ** attempt)
|
132 |
continue
|