seawolf2357 commited on
Commit
c08cf4c
β€’
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'))