Spaces:
Running
Running
seawolf2357
commited on
Commit
•
56be40f
1
Parent(s):
74a2ecd
Update app.py
Browse files
app.py
CHANGED
@@ -42,9 +42,15 @@ class MyClient(discord.Client):
|
|
42 |
if self.is_processing:
|
43 |
return
|
44 |
self.is_processing = True
|
|
|
45 |
try:
|
|
|
|
|
|
|
|
|
|
|
46 |
response = await generate_response(message)
|
47 |
-
await
|
48 |
finally:
|
49 |
self.is_processing = False
|
50 |
|
@@ -53,6 +59,7 @@ class MyClient(discord.Client):
|
|
53 |
isinstance(message.channel, discord.Thread) and message.channel.parent_id == SPECIFIC_CHANNEL_ID
|
54 |
)
|
55 |
|
|
|
56 |
async def generate_response(message):
|
57 |
global conversation_history
|
58 |
user_input = message.content
|
|
|
42 |
if self.is_processing:
|
43 |
return
|
44 |
self.is_processing = True
|
45 |
+
|
46 |
try:
|
47 |
+
if not isinstance(message.channel, discord.Thread):
|
48 |
+
thread = await message.create_thread(name=f"논문 작성 - {message.author.display_name}", auto_archive_duration=60)
|
49 |
+
else:
|
50 |
+
thread = message.channel
|
51 |
+
|
52 |
response = await generate_response(message)
|
53 |
+
await thread.send(response)
|
54 |
finally:
|
55 |
self.is_processing = False
|
56 |
|
|
|
59 |
isinstance(message.channel, discord.Thread) and message.channel.parent_id == SPECIFIC_CHANNEL_ID
|
60 |
)
|
61 |
|
62 |
+
|
63 |
async def generate_response(message):
|
64 |
global conversation_history
|
65 |
user_input = message.content
|