Skip to content

Commit

Permalink
k
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Feb 5, 2025
1 parent b9e3632 commit fa2180d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions backend/onyx/db/slack_channel_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,19 @@ def fetch_slack_channel_config(


def fetch_slack_channel_config_for_channel_or_default(
db_session: Session, slack_bot_id: int, channel_name: str
db_session: Session, slack_bot_id: int, channel_name: str | None
) -> SlackChannelConfig | None:
# attempt to find channel-specific config first
sc_config = db_session.scalar(
select(SlackChannelConfig).where(
SlackChannelConfig.slack_bot_id == slack_bot_id,
SlackChannelConfig.channel_config["channel_name"].astext == channel_name,
if channel_name is not None:
sc_config = db_session.scalar(
select(SlackChannelConfig).where(
SlackChannelConfig.slack_bot_id == slack_bot_id,
SlackChannelConfig.channel_config["channel_name"].astext
== channel_name,
)
)
)
else:
sc_config = None

if sc_config:
return sc_config
Expand Down
2 changes: 1 addition & 1 deletion backend/onyx/onyxbot/slack/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def _build_citations_blocks(

def _build_answer_blocks(
answer: ChatOnyxBotResponse, fallback_answer: str
) -> list[Block]:
) -> list[SectionBlock]:
if not answer.answer:
answer_blocks = [SectionBlock(text=fallback_answer)]
else:
Expand Down

0 comments on commit fa2180d

Please sign in to comment.