strip text for slackbot (#3416)

* stripe text for slackbot

* k
This commit is contained in:
pablonyx 2024-12-10 13:42:35 -08:00 committed by GitHub
parent 878a189011
commit 1f2b7cb9c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -171,7 +171,9 @@ def thread_to_doc(
else first_message 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( return Document(
id=f"{channel_id}__{thread[0]['ts']}", id=f"{channel_id}__{thread[0]['ts']}",

View File

@ -204,7 +204,8 @@ def _build_documents_blocks(
continue continue
seen_docs_identifiers.add(d.document_id) 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: if d.source_type == DocumentSource.SLACK.value:
doc_sem_id = "#" + doc_sem_id doc_sem_id = "#" + doc_sem_id