Spaces:
Runtime error
Runtime error
KonradSzafer
commited on
Commit
·
30f4d4c
1
Parent(s):
fbad967
debug cleanup
Browse files- app.py +2 -0
- discord_bot/__main__.py +0 -1
- discord_bot/client/client.py +0 -4
- qa_engine/config.py +1 -2
app.py
CHANGED
@@ -41,6 +41,7 @@ def gradio_interface():
|
|
41 |
def discord_bot_inference_thread():
|
42 |
client = DiscordClient(
|
43 |
qa_engine=qa_engine,
|
|
|
44 |
num_last_messages=config.num_last_messages,
|
45 |
use_names_in_context=config.use_names_in_context,
|
46 |
enable_commands=config.enable_commands,
|
@@ -48,6 +49,7 @@ def discord_bot_inference_thread():
|
|
48 |
)
|
49 |
client.run(config.discord_token)
|
50 |
|
|
|
51 |
def discord_bot():
|
52 |
thread = threading.Thread(target=discord_bot_inference_thread)
|
53 |
thread.start()
|
|
|
41 |
def discord_bot_inference_thread():
|
42 |
client = DiscordClient(
|
43 |
qa_engine=qa_engine,
|
44 |
+
channel_ids=config.discord_channel_ids,
|
45 |
num_last_messages=config.num_last_messages,
|
46 |
use_names_in_context=config.use_names_in_context,
|
47 |
enable_commands=config.enable_commands,
|
|
|
49 |
)
|
50 |
client.run(config.discord_token)
|
51 |
|
52 |
+
|
53 |
def discord_bot():
|
54 |
thread = threading.Thread(target=discord_bot_inference_thread)
|
55 |
thread.start()
|
discord_bot/__main__.py
CHANGED
@@ -14,7 +14,6 @@ qa_engine = QAEngine(
|
|
14 |
use_messages_for_context=config.use_messages_in_context,
|
15 |
debug=config.debug
|
16 |
)
|
17 |
-
print(f'channel_ids: {config.discord_channel_ids}')
|
18 |
client = DiscordClient(
|
19 |
qa_engine=qa_engine,
|
20 |
channel_ids=config.discord_channel_ids,
|
|
|
14 |
use_messages_for_context=config.use_messages_in_context,
|
15 |
debug=config.debug
|
16 |
)
|
|
|
17 |
client = DiscordClient(
|
18 |
qa_engine=qa_engine,
|
19 |
channel_ids=config.discord_channel_ids,
|
discord_bot/client/client.py
CHANGED
@@ -46,11 +46,7 @@ class DiscordClient(discord.Client):
|
|
46 |
'The number of last messages in context should be at least 1'
|
47 |
|
48 |
self.qa_engine: QAEngine = qa_engine
|
49 |
-
print(f'before parsing: {channel_ids}')
|
50 |
-
print(type(channel_ids))
|
51 |
self.channel_ids: list[int] = DiscordClient._process_channel_ids(channel_ids)
|
52 |
-
print(type(self.channel_ids))
|
53 |
-
print(type(self.channel_ids[0]))
|
54 |
self.num_last_messages: int = num_last_messages
|
55 |
self.use_names_in_context: bool = use_names_in_context
|
56 |
self.enable_commands: bool = enable_commands
|
|
|
46 |
'The number of last messages in context should be at least 1'
|
47 |
|
48 |
self.qa_engine: QAEngine = qa_engine
|
|
|
|
|
49 |
self.channel_ids: list[int] = DiscordClient._process_channel_ids(channel_ids)
|
|
|
|
|
50 |
self.num_last_messages: int = num_last_messages
|
51 |
self.use_names_in_context: bool = use_names_in_context
|
52 |
self.enable_commands: bool = enable_commands
|
qa_engine/config.py
CHANGED
@@ -7,12 +7,11 @@ from qa_engine import logger
|
|
7 |
|
8 |
def get_env(env_name: str, default: Any = None, warn: bool = True) -> str:
|
9 |
env = os.getenv(env_name)
|
10 |
-
print(f'env: {env}')
|
11 |
if not env:
|
12 |
if default is not None:
|
13 |
if warn:
|
14 |
logger.warning(
|
15 |
-
f'Environment variable {env_name} not found.' \
|
16 |
f'Using the default value: {default}.'
|
17 |
)
|
18 |
return default
|
|
|
7 |
|
8 |
def get_env(env_name: str, default: Any = None, warn: bool = True) -> str:
|
9 |
env = os.getenv(env_name)
|
|
|
10 |
if not env:
|
11 |
if default is not None:
|
12 |
if warn:
|
13 |
logger.warning(
|
14 |
+
f'Environment variable {env_name} not found. ' \
|
15 |
f'Using the default value: {default}.'
|
16 |
)
|
17 |
return default
|