seawolf2357
commited on
Commit
โข
76e110d
1
Parent(s):
fe75251
Update app.py
Browse files
app.py
CHANGED
@@ -49,13 +49,15 @@ async def generate_response(user_input, history, system_message, max_tokens, tem
|
|
49 |
messages.append({"role": "assistant", "content": val[1]})
|
50 |
messages.append({"role": "user", "content": user_input})
|
51 |
|
|
|
52 |
try:
|
53 |
-
response =
|
54 |
-
return response.choices[0].delta.content.strip()
|
55 |
except Exception as e:
|
56 |
logging.error(f"An error occurred: {e}")
|
57 |
return "์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. ๋ค์ ์๋ํด ์ฃผ์ธ์."
|
58 |
|
|
|
59 |
# ๋์ค์ฝ๋ ๋ด ์ธ์คํด์ค ์์ฑ ๋ฐ ์คํ
|
60 |
discord_client = MyClient(intents=intents)
|
61 |
discord_client.run(os.getenv('DISCORD_TOKEN'))
|
|
|
49 |
messages.append({"role": "assistant", "content": val[1]})
|
50 |
messages.append({"role": "user", "content": user_input})
|
51 |
|
52 |
+
# ํจ์๊ฐ ๋๊ธฐ ๋ฐฉ์์ด๋ฏ๋ก await๋ฅผ ์ฌ์ฉํ์ง ์์
|
53 |
try:
|
54 |
+
response = hf_client.chat_completion(messages, max_tokens=max_tokens, stream=False, temperature=temperature, top_p=top_p)
|
55 |
+
return response.choices[0].delta.content.strip() # ๋น๋๊ธฐ๊ฐ ์๋๋ฏ๋ก ๋ฐ๋ก ๊ฒฐ๊ณผ ์ ๊ทผ
|
56 |
except Exception as e:
|
57 |
logging.error(f"An error occurred: {e}")
|
58 |
return "์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. ๋ค์ ์๋ํด ์ฃผ์ธ์."
|
59 |
|
60 |
+
|
61 |
# ๋์ค์ฝ๋ ๋ด ์ธ์คํด์ค ์์ฑ ๋ฐ ์คํ
|
62 |
discord_client = MyClient(intents=intents)
|
63 |
discord_client.run(os.getenv('DISCORD_TOKEN'))
|