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