seawolf2357 commited on
Commit
51ebe4a
β€’
1 Parent(s): 2276533

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
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=4000, stream=False, temperature=0.7, top_p=0.95))
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
+