seawolf2357
commited on
Commit
β’
51ebe4a
1
Parent(s):
2276533
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ class MyClient(discord.Client):
|
|
26 |
logging.info('μμ μ λ©μμ§λ 무μν©λλ€.')
|
27 |
return
|
28 |
|
29 |
-
|
30 |
response = await generate_response(message.content)
|
31 |
await message.channel.send(response)
|
32 |
|
@@ -44,11 +44,13 @@ async def generate_response(user_input):
|
|
44 |
|
45 |
# λκΈ° ν¨μλ₯Ό λΉλκΈ°λ‘ μ²λ¦¬νκΈ° μν λνΌ μ¬μ©
|
46 |
loop = asyncio.get_event_loop()
|
47 |
-
response = await loop.run_in_executor(None, lambda: hf_client.chat_completion(messages, max_tokens=
|
48 |
-
|
|
|
49 |
# API μλ΅ λ‘κ·Έμ λ°λΌ content μμ± μ¬μ©
|
50 |
return response.choices[0].message.content.strip()
|
51 |
-
|
52 |
# λμ€μ½λ λ΄ μΈμ€ν΄μ€ μμ± λ° μ€ν
|
53 |
discord_client = MyClient(intents=intents)
|
54 |
discord_client.run(os.getenv('DISCORD_TOKEN'))
|
|
|
|
26 |
logging.info('μμ μ λ©μμ§λ 무μν©λλ€.')
|
27 |
return
|
28 |
|
29 |
+
logging.debug(f'Receiving message: {message.content}') # λ‘κΉ
μΆκ°
|
30 |
response = await generate_response(message.content)
|
31 |
await message.channel.send(response)
|
32 |
|
|
|
44 |
|
45 |
# λκΈ° ν¨μλ₯Ό λΉλκΈ°λ‘ μ²λ¦¬νκΈ° μν λνΌ μ¬μ©
|
46 |
loop = asyncio.get_event_loop()
|
47 |
+
response = await loop.run_in_executor(None, lambda: hf_client.chat_completion(messages, max_tokens=1000, stream=False, temperature=0.7, top_p=0.95))
|
48 |
+
logging.debug(f'API response: {response}') # API μλ΅ λ‘κΉ
|
49 |
+
|
50 |
# API μλ΅ λ‘κ·Έμ λ°λΌ content μμ± μ¬μ©
|
51 |
return response.choices[0].message.content.strip()
|
52 |
+
|
53 |
# λμ€μ½λ λ΄ μΈμ€ν΄μ€ μμ± λ° μ€ν
|
54 |
discord_client = MyClient(intents=intents)
|
55 |
discord_client.run(os.getenv('DISCORD_TOKEN'))
|
56 |
+
|