Spaces:
Runtime error
Runtime error
update
Browse files184 unmodified lines1851861871881891905 unmodified lines19619719819920020169 unmodified lines271272273274275276277278184 unmodified linesfor doc in final_docs:page = doc.metadata.get('page_number', 'N/A')file_name = doc.metadata.get('source_file') or doc.metadata.get('source')source = f"[{os.path.basename(file_name)} | Trang {page}]" if file_name else f"[Trang {page}]"block = f"{source}\n{doc.page_content}"5 unmodified linescontext_parts.append(block)context_docs.append({'source': file_name or "Không rõ",'page': page})69 unmodified linesyield "\n\n---\n\n"yield "## 📚 Tài liệu tham khảo\n\n"seen_sources = set()for i, doc_info in enumerate(context_docs, 1):source_key = f"{doc_info['source']}_{doc_info['page']}"if source_key not in seen_sources:seen_sources.add(source_key)yield f"- **{doc_info['source']}** (Trang {doc_info['page']})\n"184 unmodified lines1851861871881891901915 unmodified lines19719819920020120220369 unmodified lines273274275276277278279280281282283284184 unmodified linesfor doc in final_docs:page = doc.metadata.get('page_number', 'N/A')file_name = doc.metadata.get('source_file') or doc.metadata.get('source')object_path = doc.metadata.get('source_relpath') or doc.metadata.get('object_path') or ''source = f"[{os.path.basename(file_name)} | Trang {page}]" if file_name else f"[Trang {page}]"block = f"{source}\n{doc.page_content}"5 unmodified linescontext_parts.append(block)context_docs.append({'source': file_name or "Không rõ",'object_path': object_path,'page': page})69 unmodified linesyield "\n\n---\n\n"yield "## 📚 Tài liệu tham khảo\n\n"seen_sources = set()for doc_info in context_docs:source_key = f"{doc_info['source']}_{doc_info['page']}"if source_key not in seen_sources:seen_sources.add(source_key)object_path = str(doc_info.get('object_path') or '').strip()if object_path:yield f"- **{object_path}** (Trang {doc_info['page']})\n"else:yield f"- **{doc_info['source']}** (Trang {doc_info['page']})\n"
rag/qa_pipeline.py+8-2