Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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}์ด"
|