mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-03-26 17:51:54 +01:00
Add the latest document update to the Slack bot answer (#817)
* Add the latest source update to the Slack bot answer * fix mypy errors --------- Co-authored-by: Matthieu Boret <matthieu.boret@fr.clara.net>
This commit is contained in:
parent
2f001c23b7
commit
c6f354fd03
@ -1,5 +1,7 @@
|
||||
from datetime import datetime
|
||||
|
||||
import pytz
|
||||
import timeago # type: ignore
|
||||
from slack_sdk.models.blocks import ActionsBlock
|
||||
from slack_sdk.models.blocks import Block
|
||||
from slack_sdk.models.blocks import ButtonElement
|
||||
@ -21,7 +23,6 @@ from danswer.danswerbot.slack.utils import translate_vespa_highlight_to_slack
|
||||
from danswer.search.models import SavedSearchDoc
|
||||
from danswer.utils.text_processing import replace_whitespaces_w_space
|
||||
|
||||
|
||||
_MAX_BLURB_LEN = 75
|
||||
|
||||
|
||||
@ -109,11 +110,11 @@ def build_documents_blocks(
|
||||
match_str = translate_vespa_highlight_to_slack(d.match_highlights, used_chars)
|
||||
|
||||
included_docs += 1
|
||||
|
||||
updated_at = timeago.format(d.updated_at, datetime.now(pytz.utc))
|
||||
if d.link:
|
||||
block_text = f"<{d.link}|{doc_sem_id}>:\n>{remove_slack_text_interactions(match_str)}"
|
||||
block_text = f"<{d.link}|{doc_sem_id}>\nUpdated {updated_at}\n>{remove_slack_text_interactions(match_str)}"
|
||||
else:
|
||||
block_text = f"{doc_sem_id}:\n>{remove_slack_text_interactions(match_str)}"
|
||||
block_text = f"{doc_sem_id}\nUpdated {updated_at}\n>{remove_slack_text_interactions(match_str)}"
|
||||
|
||||
section_blocks.append(
|
||||
SectionBlock(text=block_text),
|
||||
|
@ -54,6 +54,7 @@ slack-sdk==3.20.2
|
||||
SQLAlchemy[mypy]==2.0.15
|
||||
tensorflow==2.13.0
|
||||
tiktoken==0.4.0
|
||||
timeago==1.0.16
|
||||
torch==2.0.1
|
||||
torchvision==0.15.2
|
||||
transformers==4.30.1
|
||||
|
@ -13,6 +13,7 @@ types-setuptools==68.0.0.3
|
||||
types-psutil==5.9.5.17
|
||||
types-psycopg2==2.9.21.10
|
||||
types-python-dateutil==2.8.19.13
|
||||
types-pytz==2023.3.1.1
|
||||
types-regex==2023.3.23.1
|
||||
types-requests==2.28.11.17
|
||||
types-retry==0.9.9.3
|
||||
|
Loading…
x
Reference in New Issue
Block a user