Spaces:
				
			
			
	
			
			
		Build error
		
	
	
	
			
			
	
	
	
	
		
		
		Build error
		
	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'))
         
     |