Update app.py
Browse files
app.py
CHANGED
|
@@ -465,22 +465,8 @@ textarea {
|
|
| 465 |
}
|
| 466 |
</style>
|
| 467 |
""", unsafe_allow_html=True)
|
| 468 |
-
query = st.chat_input("چطور میتونم کمک کنم؟")
|
| 469 |
|
| 470 |
|
| 471 |
-
if query:
|
| 472 |
-
st.markdown(f'<div class="chat-message">{query}</div>', unsafe_allow_html=True)
|
| 473 |
-
|
| 474 |
-
think = st.markdown("""
|
| 475 |
-
<div class="thinking-message">
|
| 476 |
-
<p>در حال فکر کردن...</p>
|
| 477 |
-
<div class="spinner"></div>
|
| 478 |
-
</div>
|
| 479 |
-
""", unsafe_allow_html=True)
|
| 480 |
-
|
| 481 |
-
else:
|
| 482 |
-
st.markdown("")
|
| 483 |
-
|
| 484 |
# استایلها برای چرخش و پیام در حال فکر کردن
|
| 485 |
st.markdown("""
|
| 486 |
<style>
|
|
@@ -603,10 +589,21 @@ def remove_stop_words_from_lines(lines, stop_words):
|
|
| 603 |
cleaned_lines.append(" ".join(cleaned_words))
|
| 604 |
return cleaned_lines
|
| 605 |
|
| 606 |
-
# حفظ تاریخچه چت
|
| 607 |
if "chat_history" not in st.session_state:
|
| 608 |
st.session_state.chat_history = []
|
|
|
|
|
|
|
|
|
|
|
|
|
| 609 |
if query:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 610 |
# پیدا کردن ۱۰ خط نزدیکتر به سوال
|
| 611 |
closest_lines = find_closest_lines(query, doc_texts, stop_words, top_n=3)
|
| 612 |
|
|
|
|
| 465 |
}
|
| 466 |
</style>
|
| 467 |
""", unsafe_allow_html=True)
|
|
|
|
| 468 |
|
| 469 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
# استایلها برای چرخش و پیام در حال فکر کردن
|
| 471 |
st.markdown("""
|
| 472 |
<style>
|
|
|
|
| 589 |
cleaned_lines.append(" ".join(cleaned_words))
|
| 590 |
return cleaned_lines
|
| 591 |
|
|
|
|
| 592 |
if "chat_history" not in st.session_state:
|
| 593 |
st.session_state.chat_history = []
|
| 594 |
+
|
| 595 |
+
query = st.chat_input("چطور میتونم کمک کنم؟")
|
| 596 |
+
|
| 597 |
+
|
| 598 |
if query:
|
| 599 |
+
st.markdown(f'<div class="chat-message">{query}</div>', unsafe_allow_html=True)
|
| 600 |
+
|
| 601 |
+
think = st.markdown("""
|
| 602 |
+
<div class="thinking-message">
|
| 603 |
+
<p>در حال فکر کردن...</p>
|
| 604 |
+
<div class="spinner"></div>
|
| 605 |
+
</div>
|
| 606 |
+
""", unsafe_allow_html=True)
|
| 607 |
# پیدا کردن ۱۰ خط نزدیکتر به سوال
|
| 608 |
closest_lines = find_closest_lines(query, doc_texts, stop_words, top_n=3)
|
| 609 |
|