Skip to content

Commit

Permalink
Remove 'thinking' message
Browse files Browse the repository at this point in the history
  • Loading branch information
fedeq committed Jul 17, 2023
1 parent 3dcefda commit 59a32e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/controllers/slack_controller.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import time
import socket
import ssl

import os

from flask import jsonify
from services.slack_service import (
Expand All @@ -24,12 +24,12 @@ def make_ssl_connection(host, port):

# POST /slack/events
def post_event(request):
host = "api.openai.com"
resolution_time = resolve_host(host)
print("It took %.2f seconds to resolve %s." % (resolution_time, host))
port = 443
connection_time = make_ssl_connection(host, port)
print("It took %.2f seconds to make an SSL connection to %s." % (connection_time, host))
# host = "api.openai.com"
# resolution_time = resolve_host(host)
# print("It took %.2f seconds to resolve %s." % (resolution_time, host))
# port = 443
# connection_time = make_ssl_connection(host, port)
# print("It took %.2f seconds to make an SSL connection to %s." % (connection_time, host))

if request.get("type") == "url_verification":
return request.get("challenge")
Expand Down
20 changes: 13 additions & 7 deletions src/services/slack_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ def process_event_payload(payload):
slack_bot_token = os.environ["SLACK_BOT_TOKEN"]
# slack_bot_token = team_data["slack_bot_token"]

msg_ts = send_message(
channel,
thread_to_reply,
"*Thinking...*",
slack_bot_token
)
# msg_ts = send_message(
# channel,
# thread_to_reply,
# "*Thinking...*",
# slack_bot_token
# )

username = get_user_name(user, slack_bot_token)
messages = [{
Expand All @@ -186,7 +186,13 @@ def process_event_payload(payload):
# increment_request_count(team_id)
# except Exception as error:
# print(error)
return update_message(channel, thread_to_reply, msg_ts, response, slack_bot_token)
send_message(
channel,
thread_to_reply,
response,
slack_bot_token
)
# return update_message(channel, thread_to_reply, msg_ts, response, slack_bot_token)
except Exception as error:
# Improve error handling
print(error)
Expand Down

0 comments on commit 59a32e1

Please sign in to comment.