Skip to content

Commit efa3688

Browse files
chore: standardises configs
1 parent 60dea0c commit efa3688

File tree

4 files changed

+18
-54
lines changed

4 files changed

+18
-54
lines changed

packages/slackBotFunction/app/config/__init__.py

Whitespace-only changes.

packages/slackBotFunction/app/config/config.py

Lines changed: 0 additions & 51 deletions
This file was deleted.

packages/slackBotFunction/app/core/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,9 @@
5959
GUARD_VERSION = os.environ["GUARD_RAIL_VERSION"]
6060

6161
logger.info(f"Guardrail ID: {GUARD_RAIL_ID}, Version: {GUARD_VERSION}")
62+
63+
# Bot response messages
64+
BOT_MESSAGES = {
65+
"empty_query": "Hi there! Please ask me a question and I'll help you find information from our knowledge base.",
66+
"error_response": "Sorry, an error occurred while processing your request. Please try again later.",
67+
}

packages/slackBotFunction/app/slack/slack_events.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@
77
import time
88
import boto3
99
from slack_sdk import WebClient
10-
from app.core.config import table, logger, KNOWLEDGEBASE_ID, RAG_MODEL_ID, AWS_REGION, GUARD_RAIL_ID, GUARD_VERSION
10+
from app.config.config import (
11+
table,
12+
logger,
13+
KNOWLEDGEBASE_ID,
14+
RAG_MODEL_ID,
15+
AWS_REGION,
16+
GUARD_RAIL_ID,
17+
GUARD_VERSION,
18+
BOT_MESSAGES,
19+
)
1120

1221

1322
def process_async_slack_event(slack_event_data):
@@ -47,7 +56,7 @@ def process_async_slack_event(slack_event_data):
4756
if not user_query:
4857
client.chat_postMessage(
4958
channel=channel,
50-
text="Hi there! Please ask me a question and I'll help you find information from our knowledge base.",
59+
text=BOT_MESSAGES["empty_query"],
5160
thread_ts=thread_ts,
5261
)
5362
return
@@ -76,7 +85,7 @@ def process_async_slack_event(slack_event_data):
7685
try:
7786
client.chat_postMessage(
7887
channel=channel,
79-
text="Sorry, an error occurred while processing your request. Please try again later.",
88+
text=BOT_MESSAGES["error_response"],
8089
thread_ts=thread_ts,
8190
)
8291
except Exception as post_err:

0 commit comments

Comments
 (0)