seawolf2357 commited on
Commit
ae155b0
โ€ข
1 Parent(s): 4a98e80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -116,8 +116,12 @@ async def generate_reply(comment, transcript):
116
  ์ž‘์„ฑ๋œ ๊ธ€์˜ ๋งˆ์ง€๋ง‰์— ๋ฐ˜๋“œ์‹œ ์ธ์‚ฟ๋ง๊ณผ OpenFreeAI ๋ผ๊ณ  ์ž์‹ ์„ ๋ฐํ˜€๋ผ.
117
  """
118
  prompt = f"{system_prompt}\n๋Œ“๊ธ€: {comment}\n๋น„๋””์˜ค ์ž๋ง‰: {transcript}"
119
- response = await hf_client(text=prompt, max_tokens=150)
120
- return response['choices'][0]['text']
 
 
 
 
121
 
122
  async def create_thread_and_send_reply(message, video_id, comment, reply, session):
123
  thread = await message.channel.create_thread(name=f"{message.author.name}์˜ ๋Œ“๊ธ€ ๋‹ต๊ธ€", message=message)
 
116
  ์ž‘์„ฑ๋œ ๊ธ€์˜ ๋งˆ์ง€๋ง‰์— ๋ฐ˜๋“œ์‹œ ์ธ์‚ฟ๋ง๊ณผ OpenFreeAI ๋ผ๊ณ  ์ž์‹ ์„ ๋ฐํ˜€๋ผ.
117
  """
118
  prompt = f"{system_prompt}\n๋Œ“๊ธ€: {comment}\n๋น„๋””์˜ค ์ž๋ง‰: {transcript}"
119
+ response = await hf_client.create_chat_completion(messages=[{"role": "system", "content": system_prompt}, {"role": "user", "content": comment}], max_tokens=150)
120
+ if response and response.choices:
121
+ return response.choices[0].text
122
+ else:
123
+ return "๋‹ต๋ณ€์„ ์ƒ์„ฑํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."
124
+
125
 
126
  async def create_thread_and_send_reply(message, video_id, comment, reply, session):
127
  thread = await message.channel.create_thread(name=f"{message.author.name}์˜ ๋Œ“๊ธ€ ๋‹ต๊ธ€", message=message)