Created
January 7, 2026 23:26
-
-
Save larkintuckerllc/18f7ce2f748ec72657c126905252e12a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/app.py b/app.py | |
| index c41525a..e0b9b9a 100644 | |
| --- a/app.py | |
| +++ b/app.py | |
| @@ -2,15 +2,17 @@ import os | |
| import threading | |
| import time | |
| +from langchain.chat_models import init_chat_model | |
| from slack_bolt import App | |
| from slack_bolt.adapter.socket_mode import SocketModeHandler | |
| from slack_sdk.errors import SlackApiError | |
| app = App(token=os.environ.get("SLACK_BOT_TOKEN")) | |
| +model = init_chat_model(model="gpt-5-nano") | |
| -def thinking(client, channel_id, thread_ts): | |
| - time.sleep(30) | |
| - client.chat_postMessage(channel=channel_id, thread_ts=thread_ts, text="Thought about it.") | |
| +def thinking(prompt, client, channel_id, thread_ts): | |
| + response = model.invoke(prompt) | |
| + client.chat_postMessage(channel=channel_id, thread_ts=thread_ts, text=response.content) | |
| @app.command("/agent") | |
| def handle_agent_command(ack, command, client, respond): | |
| @@ -21,7 +23,7 @@ def handle_agent_command(ack, command, client, respond): | |
| try: | |
| result = client.chat_postMessage(channel=channel_id, text=message) | |
| client.chat_postMessage(channel=channel_id, thread_ts=result["ts"], text="Thinking...") | |
| - threading.Thread(target=thinking, args=(client, channel_id, result["ts"])).start() | |
| + threading.Thread(target=thinking, args=(prompt,client, channel_id, result["ts"])).start() | |
| except SlackApiError as e: | |
| error = e.response["error"] | |
| if error == "not_in_channel": |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment