Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
ann huang + give hf feedback
Browse files
app.py
CHANGED
@@ -27,6 +27,7 @@ ASK_FOR_HELP_CHANNEL_ID = 1019883044724822016
|
|
27 |
GRADIO_CHANNEL_ID = 1025174734427656283
|
28 |
ARGILLA_HELP_CHANNEL_ID = 1253640751481356330
|
29 |
DATA_DISCUSSIONS_CHANNEL_ID = 1217179426002047076
|
|
|
30 |
|
31 |
TRIGGERS = {
|
32 |
("discord bot",): ["<@U051DB2754M>"], # adam
|
@@ -51,6 +52,13 @@ TRIGGERS = {
|
|
51 |
("documentation",): ["<@U02DATT4C5B>"], # steven liu
|
52 |
("gradio",): ["<@U02NMK75F1V>", "<@U04FLGQ26PQ>"], # abubakar abid, yuvraj sharma
|
53 |
("dataset", "feedback"): ["<@U0768RCHCRY>"], # ben burtenshaw
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
|
56 |
daily_pings = []
|
@@ -108,9 +116,30 @@ async def on_message(message):
|
|
108 |
# post to slack only if thread already exists
|
109 |
post_to_slack_forum_version(message, SLACK_CHANNEL_ID, message.content, message.author, thread_ts=slack_thread_ts)
|
110 |
|
|
|
|
|
|
|
111 |
await bot.process_commands(message)
|
112 |
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
def extract_adjacent_words(content, trigger):
|
115 |
words = content.split()
|
116 |
pattern = r'\s*\b'.join(map(re.escape, trigger))
|
|
|
27 |
GRADIO_CHANNEL_ID = 1025174734427656283
|
28 |
ARGILLA_HELP_CHANNEL_ID = 1253640751481356330
|
29 |
DATA_DISCUSSIONS_CHANNEL_ID = 1217179426002047076
|
30 |
+
GIVE_HF_FEEDBACK_CHANNEL_ID = 897391062975385640
|
31 |
|
32 |
TRIGGERS = {
|
33 |
("discord bot",): ["<@U051DB2754M>"], # adam
|
|
|
52 |
("documentation",): ["<@U02DATT4C5B>"], # steven liu
|
53 |
("gradio",): ["<@U02NMK75F1V>", "<@U04FLGQ26PQ>"], # abubakar abid, yuvraj sharma
|
54 |
("dataset", "feedback"): ["<@U0768RCHCRY>"], # ben burtenshaw
|
55 |
+
("git",): ["<@U07F1NP5U0K>"], # ann huang
|
56 |
+
("lfs",): ["<@U07F1NP5U0K>"], # ann huang
|
57 |
+
("dataset",): ["<@U07F1NP5U0K>"], # ann huang
|
58 |
+
("xet",): ["<@U07F1NP5U0K>"], # ann huang
|
59 |
+
("upload",): ["<@U07F1NP5U0K>"], # ann huang
|
60 |
+
("download",): ["<@U07F1NP5U0K>"], # ann huang
|
61 |
+
("stream",): ["<@U07F1NP5U0K>"], # ann huang
|
62 |
}
|
63 |
|
64 |
daily_pings = []
|
|
|
116 |
# post to slack only if thread already exists
|
117 |
post_to_slack_forum_version(message, SLACK_CHANNEL_ID, message.content, message.author, thread_ts=slack_thread_ts)
|
118 |
|
119 |
+
if message.channel.id == GENERAL_CHANNEL_ID:
|
120 |
+
post_to_slack_general(message, SLACK_CHANNEL_ID)
|
121 |
+
|
122 |
await bot.process_commands(message)
|
123 |
|
124 |
|
125 |
+
def post_to_slack_general(message, channel):
|
126 |
+
text = f"New post in `#give-hf-feedback` by {message.author}: {message.content}"
|
127 |
+
# Handle attachments if any
|
128 |
+
if message.attachments:
|
129 |
+
for attachment in message.attachments:
|
130 |
+
attachment_url = attachment.url
|
131 |
+
text += f"\nAttachment: {attachment_url}"
|
132 |
+
try:
|
133 |
+
response = slack_client.chat_postMessage(
|
134 |
+
channel=channel,
|
135 |
+
text=text,
|
136 |
+
)
|
137 |
+
return response['ts']
|
138 |
+
except SlackApiError as e:
|
139 |
+
print(f"Error posting to Slack: {e.response['error']}")
|
140 |
+
return None
|
141 |
+
|
142 |
+
|
143 |
def extract_adjacent_words(content, trigger):
|
144 |
words = content.split()
|
145 |
pattern = r'\s*\b'.join(map(re.escape, trigger))
|