Update app.py
Browse files
app.py
CHANGED
@@ -226,26 +226,6 @@ def custom_css():
|
|
226 |
|
227 |
|
228 |
|
229 |
-
|
230 |
-
#nicht in Gebrauch...................................
|
231 |
-
def get_rag_response(question):
|
232 |
-
# Abfrage der relevanten Dokumente aus Chroma DB
|
233 |
-
docs = chroma_db.search(question, top_k=5)
|
234 |
-
passages = [doc['text'] for doc in docs]
|
235 |
-
links = [doc.get('url', 'No URL available') for doc in docs]
|
236 |
-
|
237 |
-
# Generieren der Antwort
|
238 |
-
context = " ".join(passages)
|
239 |
-
qa_input = {"question": question, "context": context}
|
240 |
-
answer = qa_pipeline(qa_input)['answer']
|
241 |
-
|
242 |
-
# Zusammenstellen der Ausgabe
|
243 |
-
response = {
|
244 |
-
"answer": answer,
|
245 |
-
"documents": [{"link": link, "passage": passage} for link, passage in zip(links, passages)]
|
246 |
-
}
|
247 |
-
|
248 |
-
return response
|
249 |
|
250 |
def create_history_entry(page_content, metadata):
|
251 |
source = metadata.get('source', 'No source available')
|
@@ -297,6 +277,7 @@ def generate_auswahl(prompt_in, file, file_history, chatbot, history, anzahl_doc
|
|
297 |
results = generate_text_zu_doc(neu_file, prompt, k, rag_option, chatbot, history, vektordatenbank)
|
298 |
|
299 |
for text in results:
|
|
|
300 |
entry = create_history_entry(text['page_content'], text['metadata'])
|
301 |
print("hier...........................")
|
302 |
history = history + [[prompt, entry]]
|
|
|
226 |
|
227 |
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
|
230 |
def create_history_entry(page_content, metadata):
|
231 |
source = metadata.get('source', 'No source available')
|
|
|
277 |
results = generate_text_zu_doc(neu_file, prompt, k, rag_option, chatbot, history, vektordatenbank)
|
278 |
|
279 |
for text in results:
|
280 |
+
print("text..............."+str(text))
|
281 |
entry = create_history_entry(text['page_content'], text['metadata'])
|
282 |
print("hier...........................")
|
283 |
history = history + [[prompt, entry]]
|