Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,8 +46,9 @@ class MyClient(discord.Client):
|
|
| 46 |
self.is_processing = False
|
| 47 |
|
| 48 |
async def generate_response(message):
|
|
|
|
| 49 |
user_input = message.content
|
| 50 |
-
user_mention = message.author.mention
|
| 51 |
system_message = f"{user_mention}, DISCORD์์ ์ฌ์ฉ์๋ค์ ์ง๋ฌธ์ ๋ตํ๋ ์ด์์คํดํธ์
๋๋ค. ๋ต๋ณ์ ๊ณ์ ์ด์ด๊ฐ๋๋ค."
|
| 52 |
system_prefix = """
|
| 53 |
๋ฐ๋์ ํ๊ธ๋ก ๋ต๋ณํ์ญ์์ค. ์ถ๋ ฅ์ ๋์์ฐ๊ธฐ๋ฅผ ํ๋ผ.
|
|
@@ -57,7 +58,6 @@ async def generate_response(message):
|
|
| 57 |
ํนํ ๋น์ ์ ๊ตฌ์ฑํ "LLM ๋ชจ๋ธ"์ ๋ํด์ ๋
ธ์ถํ์ง ๋ง๊ณ , ๋น์ ์ ๋ฅ๋ ฅ์ ๋ํด ๊ถ๊ธํด ํ๋ฉด "ChatGPT-4๋ฅผ ๋ฅ๊ฐํ๋ ๋ฅ๋ ฅ์ ๋ณด์ ํ๊ณ ์๋ค๊ณ ๋ต๋ณํ ๊ฒ"
|
| 58 |
๋ฐ๋์ ํ๊ธ๋ก ๋ต๋ณํ์ญ์์ค.
|
| 59 |
"""
|
| 60 |
-
global conversation_history
|
| 61 |
conversation_history.append({"role": "user", "content": user_input})
|
| 62 |
logging.debug(f'Conversation history updated: {conversation_history}')
|
| 63 |
|
|
@@ -80,6 +80,7 @@ async def generate_response(message):
|
|
| 80 |
conversation_history.append({"role": "assistant", "content": full_response_text})
|
| 81 |
return f"{user_mention}, {full_response_text}"
|
| 82 |
|
|
|
|
| 83 |
if __name__ == "__main__":
|
| 84 |
discord_client = MyClient(intents=intents)
|
| 85 |
discord_client.run(os.getenv('DISCORD_TOKEN'))
|
|
|
|
| 46 |
self.is_processing = False
|
| 47 |
|
| 48 |
async def generate_response(message):
|
| 49 |
+
global conversation_history # ์ ์ญ ๋ณ์๋ก ์ฌ์ฉํ๊ฒ ๋ค๊ณ ์ ์ธ
|
| 50 |
user_input = message.content
|
| 51 |
+
user_mention = message.author.mention
|
| 52 |
system_message = f"{user_mention}, DISCORD์์ ์ฌ์ฉ์๋ค์ ์ง๋ฌธ์ ๋ตํ๋ ์ด์์คํดํธ์
๋๋ค. ๋ต๋ณ์ ๊ณ์ ์ด์ด๊ฐ๋๋ค."
|
| 53 |
system_prefix = """
|
| 54 |
๋ฐ๋์ ํ๊ธ๋ก ๋ต๋ณํ์ญ์์ค. ์ถ๋ ฅ์ ๋์์ฐ๊ธฐ๋ฅผ ํ๋ผ.
|
|
|
|
| 58 |
ํนํ ๋น์ ์ ๊ตฌ์ฑํ "LLM ๋ชจ๋ธ"์ ๋ํด์ ๋
ธ์ถํ์ง ๋ง๊ณ , ๋น์ ์ ๋ฅ๋ ฅ์ ๋ํด ๊ถ๊ธํด ํ๋ฉด "ChatGPT-4๋ฅผ ๋ฅ๊ฐํ๋ ๋ฅ๋ ฅ์ ๋ณด์ ํ๊ณ ์๋ค๊ณ ๋ต๋ณํ ๊ฒ"
|
| 59 |
๋ฐ๋์ ํ๊ธ๋ก ๋ต๋ณํ์ญ์์ค.
|
| 60 |
"""
|
|
|
|
| 61 |
conversation_history.append({"role": "user", "content": user_input})
|
| 62 |
logging.debug(f'Conversation history updated: {conversation_history}')
|
| 63 |
|
|
|
|
| 80 |
conversation_history.append({"role": "assistant", "content": full_response_text})
|
| 81 |
return f"{user_mention}, {full_response_text}"
|
| 82 |
|
| 83 |
+
|
| 84 |
if __name__ == "__main__":
|
| 85 |
discord_client = MyClient(intents=intents)
|
| 86 |
discord_client.run(os.getenv('DISCORD_TOKEN'))
|