seawolf2357 commited on
Commit
857bc15
โ€ข
1 Parent(s): 6d24cf5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -12,10 +12,8 @@ intents = discord.Intents.default()
12
  intents.messages = True
13
 
14
  # ์ถ”๋ก  API ํด๋ผ์ด์–ธํŠธ ์„ค์ •
15
- # hf_client = InferenceClient("CohereForAI/c4ai-command-r-plus", token=os.getenv("HF_TOKEN"))
16
  hf_client = InferenceClient("meta-llama/Meta-Llama-3-70B-Instruct", token=os.getenv("HF_TOKEN"))
17
 
18
-
19
  class MyClient(discord.Client):
20
  def __init__(self, *args, **kwargs):
21
  super().__init__(*args, **kwargs)
@@ -51,13 +49,10 @@ async def generate_response(user_input):
51
  # ์ŠคํŠธ๋ฆฌ๋ฐ ์‘๋‹ต์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋กœ์ง ์ถ”๊ฐ€
52
  full_response = ""
53
  for part in response:
54
- full_response += part.message.content.strip()
55
 
56
  return full_response
57
 
58
-
59
-
60
  # ๋””์Šค์ฝ”๋“œ ๋ด‡ ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ ๋ฐ ์‹คํ–‰
61
  discord_client = MyClient(intents=intents)
62
  discord_client.run(os.getenv('DISCORD_TOKEN'))
63
-
 
12
  intents.messages = True
13
 
14
  # ์ถ”๋ก  API ํด๋ผ์ด์–ธํŠธ ์„ค์ •
 
15
  hf_client = InferenceClient("meta-llama/Meta-Llama-3-70B-Instruct", token=os.getenv("HF_TOKEN"))
16
 
 
17
  class MyClient(discord.Client):
18
  def __init__(self, *args, **kwargs):
19
  super().__init__(*args, **kwargs)
 
49
  # ์ŠคํŠธ๋ฆฌ๋ฐ ์‘๋‹ต์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋กœ์ง ์ถ”๊ฐ€
50
  full_response = ""
51
  for part in response:
52
+ full_response += part.choices[0].delta.content.strip() # ์ŠคํŠธ๋ฆฌ๋ฐ ๋ธํƒ€ ๋‚ด์šฉ ์ถ”๊ฐ€
53
 
54
  return full_response
55
 
 
 
56
  # ๋””์Šค์ฝ”๋“œ ๋ด‡ ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ ๋ฐ ์‹คํ–‰
57
  discord_client = MyClient(intents=intents)
58
  discord_client.run(os.getenv('DISCORD_TOKEN'))