aiqtech commited on
Commit
371c534
ยท
verified ยท
1 Parent(s): 8c1ebc3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -2
app.py CHANGED
@@ -421,7 +421,7 @@ class SpeedOptimizedMultiAgentSystem:
421
  AgentRole.FINALIZER: """[์ตœ์ข…ํ†ตํ•ฉ]
422
  ๋ชจ๋“ ์˜๊ฒฌ ์ข…ํ•ฉโ†’์ตœ์ ๋‹ต๋ณ€
423
  ๋ช…ํ™•๊ตฌ์กฐ+์‹ค์šฉ์ •๋ณด+์ฐฝ์˜๊ท ํ˜•
424
- ํ•ต์‹ฌ๋จผ์ €+์ƒ์„ธ๋Š”ํ›„์ˆœ์œ„"""
425
  }
426
 
427
  async def parallel_process_agents(
@@ -579,10 +579,36 @@ class SpeedOptimizedMultiAgentSystem:
579
 
580
  # ์ตœ์ข… ๋‹ต๋ณ€ ์ŠคํŠธ๋ฆฌ๋ฐ
581
  accumulated_response = ""
 
 
582
  async for chunk in self.streaming.buffer_and_yield(final_task):
583
- accumulated_response += chunk
 
 
 
 
 
 
 
 
 
 
 
 
 
 
584
  yield accumulated_response, agent_thoughts
585
 
 
 
 
 
 
 
 
 
 
 
586
  # ์ฒ˜๋ฆฌ ์‹œ๊ฐ„ ์ถ”๊ฐ€
587
  processing_time = time.time() - start_time
588
  accumulated_response += f"\n\n---\nโšก ์ฒ˜๋ฆฌ ์‹œ๊ฐ„: {processing_time:.1f}์ดˆ"
 
421
  AgentRole.FINALIZER: """[์ตœ์ข…ํ†ตํ•ฉ]
422
  ๋ชจ๋“ ์˜๊ฒฌ ์ข…ํ•ฉโ†’์ตœ์ ๋‹ต๋ณ€
423
  ๋ช…ํ™•๊ตฌ์กฐ+์‹ค์šฉ์ •๋ณด+์ฐฝ์˜๊ท ํ˜•
424
+ ๋ฐ”๋กœ ํ•ต์‹ฌ ๋‚ด์šฉ๋ถ€ํ„ฐ ์‹œ์ž‘. ๋ถˆํ•„์š”ํ•œ ํ—ค๋”๋‚˜ ๋งˆํฌ์—… ์—†์ด."""
425
  }
426
 
427
  async def parallel_process_agents(
 
579
 
580
  # ์ตœ์ข… ๋‹ต๋ณ€ ์ŠคํŠธ๋ฆฌ๋ฐ
581
  accumulated_response = ""
582
+ temp_buffer = "" # ์ž„์‹œ ๋ฒ„ํผ ์ถ”๊ฐ€
583
+
584
  async for chunk in self.streaming.buffer_and_yield(final_task):
585
+ temp_buffer += chunk
586
+
587
+ # "| --- # ๐ŸŒฑ **์ตœ์ข…ํ†ตํ•ฉ ๋‹ต๋ณ€:" ๋ถ€๋ถ„ ์ œ๊ฑฐ
588
+ if "| --- # ๐ŸŒฑ **์ตœ์ข…ํ†ตํ•ฉ ๋‹ต๋ณ€:" in temp_buffer:
589
+ # ํ•ด๋‹น ํ…์ŠคํŠธ ์ดํ›„์˜ ๋‚ด์šฉ๋งŒ ์ถ”์ถœ
590
+ parts = temp_buffer.split("| --- # ๐ŸŒฑ **์ตœ์ข…ํ†ตํ•ฉ ๋‹ต๋ณ€:")
591
+ if len(parts) > 1:
592
+ temp_buffer = parts[1]
593
+
594
+ # "**โ€“์˜ค๋ฅ˜: ---" ๋ถ€๋ถ„์ด ๋‚˜ํƒ€๋‚˜๋ฉด ๊ทธ ์ „๊นŒ์ง€๋งŒ ์‚ฌ์šฉ
595
+ if "**โ€“์˜ค๋ฅ˜: ---" in temp_buffer:
596
+ temp_buffer = temp_buffer.split("**โ€“์˜ค๋ฅ˜: ---")[0]
597
+
598
+ # ์ •๋ฆฌ๋œ ๋‚ด์šฉ์„ accumulated_response์— ์ถ”๊ฐ€
599
+ accumulated_response = temp_buffer
600
  yield accumulated_response, agent_thoughts
601
 
602
+ # ์ตœ์ข… ์ •๋ฆฌ - ํ˜น์‹œ ๋‚จ์•„์žˆ์„ ์ˆ˜ ์žˆ๋Š” ๋ถˆํ•„์š”ํ•œ ๋ถ€๋ถ„ ์ œ๊ฑฐ
603
+ if "| --- # ๐ŸŒฑ **์ตœ์ข…ํ†ตํ•ฉ ๋‹ต๋ณ€:" in accumulated_response:
604
+ accumulated_response = accumulated_response.split("| --- # ๐ŸŒฑ **์ตœ์ข…ํ†ตํ•ฉ ๋‹ต๋ณ€:")[1]
605
+
606
+ if "**โ€“์˜ค๋ฅ˜: ---" in accumulated_response:
607
+ accumulated_response = accumulated_response.split("**โ€“์˜ค๋ฅ˜: ---")[0]
608
+
609
+ # ์•ž๋’ค ๊ณต๋ฐฑ ์ œ๊ฑฐ
610
+ accumulated_response = accumulated_response.strip()
611
+
612
  # ์ฒ˜๋ฆฌ ์‹œ๊ฐ„ ์ถ”๊ฐ€
613
  processing_time = time.time() - start_time
614
  accumulated_response += f"\n\n---\nโšก ์ฒ˜๋ฆฌ ์‹œ๊ฐ„: {processing_time:.1f}์ดˆ"