Compare commits
4 Commits
feature/de
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 200500ecd1 | |||
| d8d2c43ade | |||
| 461343cf80 | |||
| 920b616468 |
@@ -448,7 +448,7 @@ def make_app(ws):
|
||||
)
|
||||
return
|
||||
|
||||
client.reactions_add(channel=channel, timestamp=message_ts, name="eyes")
|
||||
client.reactions_add(channel=channel, timestamp=message_ts, name="fire")
|
||||
|
||||
try:
|
||||
ws_logger.info("DeepSeek API call starting model=%s", deepseek_model)
|
||||
@@ -491,10 +491,10 @@ def make_app(ws):
|
||||
finally:
|
||||
try:
|
||||
client.reactions_remove(
|
||||
channel=channel, timestamp=message_ts, name="eyes"
|
||||
channel=channel, timestamp=message_ts, name="fire"
|
||||
)
|
||||
except Exception:
|
||||
ws_logger.warning("Failed to remove eyes reaction", exc_info=True)
|
||||
ws_logger.warning("Failed to remove fire reaction", exc_info=True)
|
||||
|
||||
return slack_app
|
||||
|
||||
|
||||
@@ -25,7 +25,12 @@ logger = logging.getLogger(__name__)
|
||||
# Constants
|
||||
# ---------------------------------------------------------------------------
|
||||
DEEPSEEK_TIMEOUT = 120 # seconds
|
||||
MAX_INLINE_LENGTH = 2800 # characters
|
||||
MAX_INLINE_LENGTH = 10_000 # characters
|
||||
|
||||
def _has_code_snippet(text: str) -> bool:
|
||||
"""Return True if the text contains a fenced code block."""
|
||||
return "```" in text
|
||||
|
||||
MAX_TOOL_TURNS = 5 # max tool-call back-and-forths with DeepSeek
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -488,16 +493,21 @@ def make_app(ws):
|
||||
|
||||
reply_text = md_to_slack(reply_text)
|
||||
|
||||
if len(reply_text) <= MAX_INLINE_LENGTH:
|
||||
if len(reply_text) <= MAX_INLINE_LENGTH and not _has_code_snippet(reply_text):
|
||||
await say(text=reply_text, thread_ts=thread_ts)
|
||||
else:
|
||||
initial_comment = (
|
||||
"The response contains a code snippet, which doesn't render well inline."
|
||||
if _has_code_snippet(reply_text)
|
||||
else "The response was too long for an inline message."
|
||||
)
|
||||
await client.files_upload_v2(
|
||||
channel=channel,
|
||||
thread_ts=thread_ts,
|
||||
content=reply_text,
|
||||
filename="response.txt",
|
||||
title="DeepSeek Response",
|
||||
initial_comment="The response was too long for an inline message.",
|
||||
initial_comment=initial_comment,
|
||||
)
|
||||
|
||||
except Exception as exc:
|
||||
|
||||
Reference in New Issue
Block a user