mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-05-22 09:40:10 +02:00
BookStack connector: Changed to use id-based document ids
This commit is contained in:
parent
104a248b11
commit
019e474a4e
@ -72,7 +72,7 @@ class BookstackConnector(LoadConnector, PollConnector):
|
|||||||
url = self.bookstack_client.build_app_url("/books/" + book.get("slug"))
|
url = self.bookstack_client.build_app_url("/books/" + book.get("slug"))
|
||||||
text = book.get("name", "") + "\n" + book.get("description", "")
|
text = book.get("name", "") + "\n" + book.get("description", "")
|
||||||
return Document(
|
return Document(
|
||||||
id=url,
|
id="book:" + str(book.get("id")),
|
||||||
sections=[Section(link=url, text=text)],
|
sections=[Section(link=url, text=text)],
|
||||||
source=DocumentSource.BOOKSTACK,
|
source=DocumentSource.BOOKSTACK,
|
||||||
semantic_identifier="Book: " + book.get("name"),
|
semantic_identifier="Book: " + book.get("name"),
|
||||||
@ -86,7 +86,7 @@ class BookstackConnector(LoadConnector, PollConnector):
|
|||||||
url = self.bookstack_client.build_app_url("/books/" + chapter.get("book_slug") + "/chapter/" + chapter.get("slug"))
|
url = self.bookstack_client.build_app_url("/books/" + chapter.get("book_slug") + "/chapter/" + chapter.get("slug"))
|
||||||
text = chapter.get("name", "") + "\n" + chapter.get("description", "")
|
text = chapter.get("name", "") + "\n" + chapter.get("description", "")
|
||||||
return Document(
|
return Document(
|
||||||
id=url,
|
id="chapter:" + str(chapter.get("id")),
|
||||||
sections=[Section(link=url, text=text)],
|
sections=[Section(link=url, text=text)],
|
||||||
source=DocumentSource.BOOKSTACK,
|
source=DocumentSource.BOOKSTACK,
|
||||||
semantic_identifier="Chapter: " + chapter.get("name"),
|
semantic_identifier="Chapter: " + chapter.get("name"),
|
||||||
@ -100,7 +100,7 @@ class BookstackConnector(LoadConnector, PollConnector):
|
|||||||
url = self.bookstack_client.build_app_url("/shelves/" + shelf.get("slug"))
|
url = self.bookstack_client.build_app_url("/shelves/" + shelf.get("slug"))
|
||||||
text = shelf.get("name", "") + "\n" + shelf.get("description", "")
|
text = shelf.get("name", "") + "\n" + shelf.get("description", "")
|
||||||
return Document(
|
return Document(
|
||||||
id=url,
|
id="shelf:" + str(shelf.get("id")),
|
||||||
sections=[Section(link=url, text=text)],
|
sections=[Section(link=url, text=text)],
|
||||||
source=DocumentSource.BOOKSTACK,
|
source=DocumentSource.BOOKSTACK,
|
||||||
semantic_identifier="Shelf: " + shelf.get("name"),
|
semantic_identifier="Shelf: " + shelf.get("name"),
|
||||||
@ -119,7 +119,7 @@ class BookstackConnector(LoadConnector, PollConnector):
|
|||||||
text = soup.get_text(HTML_SEPARATOR)
|
text = soup.get_text(HTML_SEPARATOR)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
return Document(
|
return Document(
|
||||||
id=url,
|
id="page:" + page_id,
|
||||||
sections=[Section(link=url, text=text)],
|
sections=[Section(link=url, text=text)],
|
||||||
source=DocumentSource.BOOKSTACK,
|
source=DocumentSource.BOOKSTACK,
|
||||||
semantic_identifier="Page: " + page_data.get("name"),
|
semantic_identifier="Page: " + page_data.get("name"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user