fix #7782: check title and excerpt separately for page_content (#7783)

- Description: check title and excerpt separately for page_content so
that if title is empty but excerpt is present, the page_content will
only contain the excerpt
  - Issue: #7782 
  - Tag maintainer: @3coins @baskaryan 
  - Twitter handle: wilsonleao
This commit is contained in:
Wilson Leao Neto 2023-07-19 03:46:23 +02:00 committed by GitHub
parent d92926cbc2
commit efa67ed0ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,9 +38,12 @@ def combined_text(title: str, excerpt: str) -> str:
The combined text.
"""
if not title or not excerpt:
return ""
return f"Document Title: {title} \nDocument Excerpt: \n{excerpt}\n"
text = ""
if title:
text += f"Document Title: {title}\n"
if excerpt:
text += f"Document Excerpt: \n{excerpt}\n"
return text
class Highlight(BaseModel, extra=Extra.allow):