seawolf2357
commited on
Commit
โข
857bc15
1
Parent(s):
6d24cf5
Update app.py
Browse files
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.
|
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'))
|
|