Update falcon.py
Browse files
falcon.py
CHANGED
|
@@ -16,10 +16,8 @@ falcon_client = Client("HuggingFaceH4/falcon-chat", HF_TOKEN)
|
|
| 16 |
BOT_USER_ID = 1086256910572986469 if os.getenv("TEST_ENV", False) else 1102236653545861151
|
| 17 |
FALCON_CHANNEL_ID = 1079459939405279232 if os.getenv("TEST_ENV", False) else 1119313248056004729
|
| 18 |
|
| 19 |
-
|
| 20 |
def falcon_initial_generation(prompt, instructions, thread):
|
| 21 |
"""Solves two problems at once; 1) The Slash command + job.submit interaction, and 2) the need for job.submit in order to locate the full generated text"""
|
| 22 |
-
global falcon_userid_threadid_dictionary
|
| 23 |
global threadid_conversation
|
| 24 |
|
| 25 |
chathistory = falcon_client.predict(fn_index=5)
|
|
@@ -47,10 +45,7 @@ async def try_falcon(interaction, prompt):
|
|
| 47 |
"""Generates text based on a given prompt"""
|
| 48 |
try:
|
| 49 |
global falcon_userid_threadid_dictionary # tracks userid-thread existence
|
| 50 |
-
global instructions
|
| 51 |
global threadid_conversation
|
| 52 |
-
global BOT_USER_ID
|
| 53 |
-
global FALCON_CHANNEL_ID
|
| 54 |
|
| 55 |
if interaction.user.id != BOT_USER_ID:
|
| 56 |
if interaction.channel.id == FALCON_CHANNEL_ID:
|
|
|
|
| 16 |
BOT_USER_ID = 1086256910572986469 if os.getenv("TEST_ENV", False) else 1102236653545861151
|
| 17 |
FALCON_CHANNEL_ID = 1079459939405279232 if os.getenv("TEST_ENV", False) else 1119313248056004729
|
| 18 |
|
|
|
|
| 19 |
def falcon_initial_generation(prompt, instructions, thread):
|
| 20 |
"""Solves two problems at once; 1) The Slash command + job.submit interaction, and 2) the need for job.submit in order to locate the full generated text"""
|
|
|
|
| 21 |
global threadid_conversation
|
| 22 |
|
| 23 |
chathistory = falcon_client.predict(fn_index=5)
|
|
|
|
| 45 |
"""Generates text based on a given prompt"""
|
| 46 |
try:
|
| 47 |
global falcon_userid_threadid_dictionary # tracks userid-thread existence
|
|
|
|
| 48 |
global threadid_conversation
|
|
|
|
|
|
|
| 49 |
|
| 50 |
if interaction.user.id != BOT_USER_ID:
|
| 51 |
if interaction.channel.id == FALCON_CHANNEL_ID:
|