Skip to content

Commit

Permalink
fix create element
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-pasquier committed Mar 14, 2024
1 parent 380f9c4 commit a153ef5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/utils/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ def _create_text_element(doc: Document, element_class: type[Text]) -> Element:
Returns:
Element: Text element created from the Document object.
"""
match doc.metadata["source"]:
source = doc.metadata.get("source", "content")
match source:
case "content":
element = element_class(
type=doc.metadata["type"],
Expand Down Expand Up @@ -357,7 +358,8 @@ def _create_image_element(doc: Document, element_class: type[Image]) -> Element:
Returns:
Element: Image element created from the Document object.
"""
match doc.metadata["source"]:
source = doc.metadata.get("source", "content")
match source:
case "content":
element = element_class(
type=doc.metadata["type"],
Expand Down

0 comments on commit a153ef5

Please sign in to comment.