mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-02 05:03:15 +00:00
chore: Better err handling for extracting repos, always post reply (#1007)
* chore: Better err handling for extracting repos, always post reply * cr
This commit is contained in:
parent
51b4b27c2e
commit
163649197b
1 changed files with 6 additions and 8 deletions
|
|
@ -244,21 +244,19 @@ def generate_thread_id_from_slack_thread(channel_id: str, thread_id: str) -> str
|
|||
|
||||
async def get_slack_repo_config(message: str, channel_id: str, thread_ts: str) -> dict[str, str]:
|
||||
"""Resolve repository configuration for Slack-triggered runs."""
|
||||
owner = SLACK_REPO_OWNER.strip() or "langchain-ai"
|
||||
name = SLACK_REPO_NAME.strip() or "langchainplus"
|
||||
|
||||
if "repo:" in message:
|
||||
# extract out the repo from the message assuming its in the format of repo:owner/repo
|
||||
import re
|
||||
|
||||
match = re.search(r"repo:([^ ]+)", message)
|
||||
if match:
|
||||
repo = match.group(1)
|
||||
owner, name = repo.split("/")
|
||||
await post_slack_thread_reply(
|
||||
channel_id, thread_ts, f"Using repository: `{owner}/{name}`"
|
||||
)
|
||||
return {"owner": owner, "name": name}
|
||||
if "/" in repo:
|
||||
owner, name = repo.split("/", 1)
|
||||
|
||||
owner = SLACK_REPO_OWNER.strip() or "langchain-ai"
|
||||
name = SLACK_REPO_NAME.strip() or "langchainplus"
|
||||
await post_slack_thread_reply(channel_id, thread_ts, f"Using repository: `{owner}/{name}`")
|
||||
return {"owner": owner, "name": name}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue