seawolf2357 commited on
Commit
c08cf4c
ยท
verified ยท
1 Parent(s): 22dee1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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'))