seawolf2357
commited on
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'))
|
|