seawolf2357 commited on
Commit
1cb49d1
โ€ข
1 Parent(s): 1f5dbfe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -87,7 +87,7 @@ class MyClient(discord.Client):
87
  transcript_msg = "์ž๋ง‰ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค."
88
  system_prompt = "์ž๋ง‰ ์ •๋ณด๊ฐ€ ์—†์–ด ๋‹ต๊ธ€ ์ƒ์„ฑ์ด ์ œํ•œ๋ฉ๋‹ˆ๋‹ค."
89
 
90
- # ์Šค๋ ˆ๋“œ ์ค‘๋ณต ์ƒ์„ฑ ๋ฐฉ์ง€
91
  if message.thread:
92
  thread = message.thread
93
  else:
@@ -96,9 +96,13 @@ class MyClient(discord.Client):
96
  except discord.errors.HTTPException as e:
97
  logging.error(f"์Šค๋ ˆ๋“œ ์ƒ์„ฑ ์‹คํŒจ: {e}")
98
  return
99
-
100
- # ์ž๋ง‰ ์ •๋ณด๋ฅผ ์Šค๋ ˆ๋“œ์— ๊ฒŒ์‹œ
101
- await thread.send(transcript_msg)
 
 
 
 
102
 
103
  def extract_video_id(self, url):
104
  video_id_match = re.search(r"(?:v=|\/)([0-9A-Za-z_-]{11}).*", url)
 
87
  transcript_msg = "์ž๋ง‰ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค."
88
  system_prompt = "์ž๋ง‰ ์ •๋ณด๊ฐ€ ์—†์–ด ๋‹ต๊ธ€ ์ƒ์„ฑ์ด ์ œํ•œ๋ฉ๋‹ˆ๋‹ค."
89
 
90
+ # ์Šค๋ ˆ๋“œ ์ค‘๋ณต ์ƒ์„ฑ ๋ฐฉ์ง€
91
  if message.thread:
92
  thread = message.thread
93
  else:
 
96
  except discord.errors.HTTPException as e:
97
  logging.error(f"์Šค๋ ˆ๋“œ ์ƒ์„ฑ ์‹คํŒจ: {e}")
98
  return
99
+
100
+ # ์ž๋ง‰ ์ •๋ณด๊ฐ€ ๊ธธ ๊ฒฝ์šฐ ๋ถ„ํ• ํ•˜์—ฌ ์ „์†ก
101
+ max_length = 2000
102
+ for i in range(0, len(transcript_msg), max_length):
103
+ part_msg = transcript_msg[i:i+max_length]
104
+ await thread.send(part_msg)
105
+
106
 
107
  def extract_video_id(self, url):
108
  video_id_match = re.search(r"(?:v=|\/)([0-9A-Za-z_-]{11}).*", url)