Skip to content

Commit

Permalink
strip text for slackbot (#3416)
Browse files Browse the repository at this point in the history
* stripe text for slackbot

* k
  • Loading branch information
pablonyx authored Dec 10, 2024
1 parent 878a189 commit 1f2b7cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/danswer/connectors/slack/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ def thread_to_doc(
else first_message
)

doc_sem_id = f"{initial_sender_name} in #{channel['name']}: {snippet}"
doc_sem_id = f"{initial_sender_name} in #{channel['name']}: {snippet}".replace(
"\n", " "
)

return Document(
id=f"{channel_id}__{thread[0]['ts']}",
Expand Down
3 changes: 2 additions & 1 deletion backend/danswer/danswerbot/slack/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ def _build_documents_blocks(
continue
seen_docs_identifiers.add(d.document_id)

doc_sem_id = d.semantic_identifier
# Strip newlines from the semantic identifier for Slackbot formatting
doc_sem_id = d.semantic_identifier.replace("\n", " ")
if d.source_type == DocumentSource.SLACK.value:
doc_sem_id = "#" + doc_sem_id

Expand Down

0 comments on commit 1f2b7cb

Please sign in to comment.