diff --git a/app/graph.py b/app/graph.py index 7729ff5..1bdb460 100644 --- a/app/graph.py +++ b/app/graph.py @@ -78,26 +78,14 @@ class AgentState(TypedDict): "tools": slack_toolkit.get_tools(), "system_prompt": "You are a slack toolkit.", }, - "WebrcaCreate": { - "tools": [webrca_create], - "system_prompt": "You are a webrca incident creator.", - }, - "DatetimeProvider": { - "tools": [datetime_provider], - "system_prompt": "You are a datetime provider.", - }, "ThreadSummary": { "tools": [get_thread_msg], "system_prompt": "You are a slack thread messages summarizer.", }, - "DatetimeProvider": { - "tools": [datetime_provider], - "system_prompt": "You are a datetime provider.", + "WebrcaCreate": { + "tools": [webrca_create], + "system_prompt": "You are a webrca incident creator.", }, - "ThreadSummary": { - "tools": [get_thread_msg], - "system_prompt": "You are a slack thread messages summarizer.", - } } SUPERVISOR_MEMBERS = {k: v["system_prompt"] for k, v in GRAPH.items()} diff --git a/app/tools/get_thread_msg.py b/app/tools/get_thread_msg.py index 4423980..a933024 100644 --- a/app/tools/get_thread_msg.py +++ b/app/tools/get_thread_msg.py @@ -1,19 +1,18 @@ -from slack_sdk import WebClient -from slack_sdk.errors import SlackApiError from langchain_core.tools import tool -import os +from slack_sdk.errors import SlackApiError + +from app.dependencies.slack_client import slack_client + @tool() def get_thread_msg(channel_id: str, thread_ts: str): """ Retrieves messages from a specified thread. """ - client = WebClient(token=os.getenv('SLACK_BOT_TOKEN')) try: - response = client.conversations_replies(channel=channel_id, ts=thread_ts) + response = slack_client.conversations_replies(channel=channel_id, ts=thread_ts) messages = response['messages'] return {'thread_messages': messages} except SlackApiError as e: print(f"Error fetching thread messages: {e}") return {'error': str(e)} -