Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -112,8 +112,13 @@ def answer_question(question, chat_history):
|
|
| 112 |
|
| 113 |
print(f"Gelen soru: {question}")
|
| 114 |
|
| 115 |
-
retrieved_docs = vector_db.similarity_search(question, k=2)
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
print(f"Bağlam için {len(retrieved_docs)} belge bulundu. İlk 200 karakter:\n{context[:200]}...")
|
| 119 |
|
|
|
|
| 112 |
|
| 113 |
print(f"Gelen soru: {question}")
|
| 114 |
|
| 115 |
+
retrieved_docs = vector_db.similarity_search(question, k=2)
|
| 116 |
+
context = "\n\n".join([doc.page_content for doc in retrieved_docs])
|
| 117 |
+
|
| 118 |
+
# GPT2 modelinin token sınırını aşmamak için bağlamı kısalt
|
| 119 |
+
if len(context) > 1500:
|
| 120 |
+
context = context[:1500]
|
| 121 |
+
|
| 122 |
|
| 123 |
print(f"Bağlam için {len(retrieved_docs)} belge bulundu. İlk 200 karakter:\n{context[:200]}...")
|
| 124 |
|