Spaces:
Running
Running
seawolf2357
commited on
Commit
โข
b4a00e6
1
Parent(s):
2abbdfc
Update app.py
Browse files
app.py
CHANGED
@@ -76,9 +76,10 @@ class MyClient(discord.Client):
|
|
76 |
self.is_processing = True
|
77 |
try:
|
78 |
response = await generate_response(message)
|
79 |
-
if response and response.strip()
|
80 |
-
response
|
81 |
-
|
|
|
82 |
finally:
|
83 |
self.is_processing = False
|
84 |
logging.debug("Message processing completed, ready for the next one.")
|
@@ -103,12 +104,17 @@ async def generate_response(message):
|
|
103 |
else:
|
104 |
system_message = f"{user_mention}, ๊ด๋ จ ๋ฒ๋ฅ ์ ๋ณด๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค."
|
105 |
|
106 |
-
#
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
if __name__ == "__main__":
|
112 |
discord_client = MyClient(intents=intents)
|
113 |
discord_client.run(os.getenv('DISCORD_TOKEN'))
|
114 |
-
|
|
|
76 |
self.is_processing = True
|
77 |
try:
|
78 |
response = await generate_response(message)
|
79 |
+
if response and response.strip():
|
80 |
+
await message.channel.send(response)
|
81 |
+
else:
|
82 |
+
await message.channel.send("์ฃ์กํฉ๋๋ค, ์ ๊ณตํ ์ ์๋ ์ ๋ณด๊ฐ ์์ต๋๋ค.")
|
83 |
finally:
|
84 |
self.is_processing = False
|
85 |
logging.debug("Message processing completed, ready for the next one.")
|
|
|
104 |
else:
|
105 |
system_message = f"{user_mention}, ๊ด๋ จ ๋ฒ๋ฅ ์ ๋ณด๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค."
|
106 |
|
107 |
+
# ๋ฉ์์ง ๊ธธ์ด ์ ํ ์ฒ๋ฆฌ
|
108 |
+
max_length = 2000
|
109 |
+
if len(system_message) > max_length:
|
110 |
+
response_parts = []
|
111 |
+
for i in range(0, len(system_message), max_length):
|
112 |
+
part_response = system_message[i:i + max_length]
|
113 |
+
await message.channel.send(part_response)
|
114 |
+
response_parts.append(part_response)
|
115 |
+
return response_parts[0] if response_parts else "์ฃ์กํฉ๋๋ค, ์ ๊ณตํ ์ ์๋ ์ ๋ณด๊ฐ ์์ต๋๋ค."
|
116 |
+
return system_message
|
117 |
|
118 |
if __name__ == "__main__":
|
119 |
discord_client = MyClient(intents=intents)
|
120 |
discord_client.run(os.getenv('DISCORD_TOKEN'))
|
|