Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -198,18 +198,25 @@ def process_text(text_input):
|
|
198 |
st.markdown(text_input)
|
199 |
|
200 |
with st.chat_message("assistant"):
|
201 |
-
completion = openai.ChatCompletion.create(
|
202 |
-
model=MODEL,
|
203 |
-
messages=[
|
204 |
-
{"role": m["role"], "content": m["content"]}
|
205 |
-
for m in st.session_state.messages
|
206 |
-
],
|
207 |
-
stream=False
|
208 |
-
)
|
209 |
-
return_text = completion.choices[0].message.content
|
210 |
-
st.write("Assistant: " + return_text)
|
211 |
-
filename = generate_filename(text_input, "md")
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
create_and_save_file(return_text, file_type="md", prompt=text_input, is_image=False, should_save=True)
|
214 |
st.session_state.messages.append({"role": "assistant", "content": return_text})
|
215 |
|
|
|
198 |
st.markdown(text_input)
|
199 |
|
200 |
with st.chat_message("assistant"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
+
search_glossary(text_input)
|
203 |
+
|
204 |
+
|
205 |
+
useOpenAI=False
|
206 |
+
if useOpenAI:
|
207 |
+
completion = openai.ChatCompletion.create(
|
208 |
+
model=MODEL,
|
209 |
+
messages=[
|
210 |
+
{"role": m["role"], "content": m["content"]}
|
211 |
+
for m in st.session_state.messages
|
212 |
+
],
|
213 |
+
stream=False
|
214 |
+
)
|
215 |
+
return_text = completion.choices[0].message.content
|
216 |
+
st.write("Assistant: " + return_text)
|
217 |
+
|
218 |
+
|
219 |
+
filename = generate_filename(text_input, "md")
|
220 |
create_and_save_file(return_text, file_type="md", prompt=text_input, is_image=False, should_save=True)
|
221 |
st.session_state.messages.append({"role": "assistant", "content": return_text})
|
222 |
|