Update app.py
Browse files
app.py
CHANGED
@@ -326,13 +326,19 @@ def generate_auswahl(prompt_in, file, file_history, chatbot, history, anzahl_doc
|
|
326 |
status = "Antwort der Vektordatenbank"
|
327 |
results, status = generate_text(prompt, chatbot, history, retriever, top_p=0.6, temperature=0.5, max_new_tokens=4048, max_context_length_tokens=2048, repetition_penalty=1.3, top_k=3)
|
328 |
|
329 |
-
#
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
relevant_docs = extract_document_info(relevant_docs_org)
|
338 |
|
|
|
326 |
status = "Antwort der Vektordatenbank"
|
327 |
results, status = generate_text(prompt, chatbot, history, retriever, top_p=0.6, temperature=0.5, max_new_tokens=4048, max_context_length_tokens=2048, repetition_penalty=1.3, top_k=3)
|
328 |
|
329 |
+
# Überprüfen, ob relevante Dokumente gefunden wurden
|
330 |
+
if results['relevant_docs']:
|
331 |
+
# in results sind die preprocessed Splits enthalten, dargestellt werden sollen die originalen:
|
332 |
+
relevant_docs_org = []
|
333 |
+
for result in results['relevant_docs']:
|
334 |
+
split_id = result.get("metadata", {}).get("split_id")
|
335 |
+
if split_id:
|
336 |
+
original_split = SPLIT_TO_ORIGINAL_MAPPING[split_id]
|
337 |
+
relevant_docs_org.append(original_split)
|
338 |
+
else:
|
339 |
+
# Keine relevanten Dokumente gefunden
|
340 |
+
status = "Keine relevanten Dokumente gefunden."
|
341 |
+
relevant_docs_org = []
|
342 |
|
343 |
relevant_docs = extract_document_info(relevant_docs_org)
|
344 |
|