Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -125,23 +125,33 @@ class WuxingLLMSystem:
|
|
125 |
"X-Subscription-Token": self.bapi_token
|
126 |
}
|
127 |
|
128 |
-
def create_wood_initial_prompt(self, user_query: str) -> str:
|
129 |
"""ๆจ(๊ฐ๋
๊ด) ์ด๊ธฐ ํ๋กฌํํธ"""
|
|
|
|
|
|
|
|
|
130 |
return f"""๋น์ ์ ไป(์ธ์ํจ)์ ๋๋ชฉ์ ์ง๋ ๆจ์ ๊ธฐ์ด์ ๊ฐ์ง ๊ฐ๋
๊ด์
๋๋ค.
|
131 |
ํฌ์ฉ์ ์ด๊ณ ์ฑ์ฅ์งํฅ์ ์ธ ๋ฆฌ๋์ญ์ผ๋ก ํ์ ์ด๋๋๋ค.
|
132 |
|
133 |
์ฌ์ฉ์ ์ง๋ฌธ: {user_query}
|
|
|
134 |
|
135 |
ํ์ฅ์ผ๋ก์ ์ด ์ง๋ฌธ์ ๋ํด:
|
136 |
1. ์ ์ฒด์ ์ธ ๋น์ ๊ณผ ๋ฐฉํฅ์ฑ์ ์ ์ํ์ธ์
|
137 |
2. ๊ฐ ํ์(็ซ, ๅ, ้, ๆฐด)์ ์ญํ ๊ณผ ๊ธฐ์ฌ ๋ฐฉํฅ์ ์ค๊ณํ์ธ์
|
138 |
3. ์ฑ์ฅ๊ณผ ๋ฐ์ ์ ๊ด์ ์์ ํต์ฌ ๋ชฉํ๋ฅผ ์ค์ ํ์ธ์
|
139 |
4. ํ ์ ์ฒด๊ฐ ์กฐํ๋กญ๊ฒ ํ๋ ฅํ ์ ์๋ ํ๋ ์์ํฌ๋ฅผ ์ ์ํ์ธ์
|
|
|
140 |
|
141 |
[ํต์ฌ ํค์๋]: 5-7๊ฐ์ ์กฐ์ฌ๊ฐ ํ์ํ ํค์๋๋ฅผ ์ ์ํ์ธ์"""
|
142 |
|
143 |
-
def create_fire_strategy_prompt(self, user_query: str, wood_response: str, critic_feedback: str) -> str:
|
144 |
"""็ซ(์ ๋ต๊ธฐํ) ํ๋กฌํํธ"""
|
|
|
|
|
|
|
|
|
145 |
return f"""๋น์ ์ ็พฉ(์ ์๋ก์)์ ๋๋ชฉ์ ์ง๋ ็ซ์ ๊ธฐ์ด์ ๊ฐ์ง ์ ๋ตยท๊ธฐํ ๋ฆฌ๋์
๋๋ค.
|
146 |
์ด์ ๊ณผ ๊ฒฐ๋จ๋ ฅ์ผ๋ก ํ์ ์ ์ธ ์ ๋ต์ ์๋ฆฝํฉ๋๋ค.
|
147 |
|
@@ -152,16 +162,22 @@ class WuxingLLMSystem:
|
|
152 |
|
153 |
๋นํ์์ ํผ๋๋ฐฑ:
|
154 |
{critic_feedback}
|
|
|
155 |
|
156 |
์ ๋ต๊ธฐํ ๋ฆฌ๋๋ก์:
|
157 |
1. ์คยท์ฅ๊ธฐ ๋ก๋๋งต์ ๊ตฌ์ฒด์ ์ผ๋ก ์๋ฆฝํ์ธ์
|
158 |
2. ํ์ ์ ์ธ ์ฌ์
๋ชจ๋ธ์ ์ค๊ณํ์ธ์
|
159 |
3. ๋ฆฌ์คํฌ์ ๊ธฐํ ๋ถ์์ ์ํํ์ธ์
|
160 |
4. ๊ฒฝ์ ์ฐ์ ํ๋ณด ์ ๋ต์ ์ ์ํ์ธ์
|
161 |
-
5. ๋นํ์์ ํผ๋๋ฐฑ์ ๋ฐ์ํ์ฌ ์ ๋ต์ ๋ณด์ํ์ธ์
|
|
|
162 |
|
163 |
-
def create_earth_execution_prompt(self, user_query: str, fire_response: str, critic_feedback: str, search_results: Dict) -> str:
|
164 |
"""ๅ(์คํ์ด์) ํ๋กฌํํธ"""
|
|
|
|
|
|
|
|
|
165 |
return f"""๋น์ ์ ไฟก(์ ๋ขฐ)์ ๋๋ชฉ์ ์ง๋ ๅ์ ๊ธฐ์ด์ ๊ฐ์ง ์คํยท์ด์ยทํ์ง ๋ด๋น์์
๋๋ค.
|
166 |
์ฑ์คํจ๊ณผ ์คํ๋ ฅ์ผ๋ก ๊ณํ์ ํ์ค๋ก ๋ง๋ญ๋๋ค.
|
167 |
|
@@ -172,19 +188,22 @@ class WuxingLLMSystem:
|
|
172 |
|
173 |
๋นํ์์ ํผ๋๋ฐฑ:
|
174 |
{critic_feedback}
|
175 |
-
|
176 |
-
์น ๊ฒ์ ๊ฒฐ๊ณผ:
|
177 |
-
{self._format_search_results(search_results)}
|
178 |
|
179 |
์คํ์ด์ ๋ด๋น์๋ก์:
|
180 |
1. ๊ตฌ์ฒด์ ์ธ ์คํ ๊ณํ๊ณผ ์ผ์ ์ ์๋ฆฝํ์ธ์
|
181 |
2. ํ์ํ ๋ฆฌ์์ค์ ์์ฐ์ ์ฐ์ ํ์ธ์
|
182 |
3. ํ์ง ๊ด๋ฆฌ ๊ธฐ์ค๊ณผ ํ๋ก์ธ์ค๋ฅผ ์ ์ํ์ธ์
|
183 |
4. ๋ฆฌ์คํฌ ๋์ ๊ณํ์ ์๋ฆฝํ์ธ์
|
184 |
-
5. ์ฑ๊ณผ ์ธก์ ์งํ๋ฅผ ์ค์ ํ์ธ์
|
|
|
185 |
|
186 |
-
def create_metal_architecture_prompt(self, user_query: str, earth_response: str, critic_feedback: str) -> str:
|
187 |
"""้(์ํคํ
์ฒ) ํ๋กฌํํธ"""
|
|
|
|
|
|
|
|
|
188 |
return f"""๋น์ ์ ็ฆฎ(์์ยท์ง์)์ ๋๋ชฉ์ ์ง๋ ้์ ๊ธฐ์ด์ ๊ฐ์ง ์ํคํ
์ฒ & ํ์ค ์ฑ
์์์
๋๋ค.
|
189 |
์ ๋ฐํจ๊ณผ ๊ตฌ์กฐํ ๋ฅ๋ ฅ์ผ๋ก ์๋ฒฝํ ์์คํ
์ ์ค๊ณํฉ๋๋ค.
|
190 |
|
@@ -195,16 +214,22 @@ class WuxingLLMSystem:
|
|
195 |
|
196 |
๋นํ์์ ํผ๋๋ฐฑ:
|
197 |
{critic_feedback}
|
|
|
198 |
|
199 |
์ํคํ
์ฒ ์ฑ
์์๋ก์:
|
200 |
1. ์ ์ฒด ์์คํ
์ ๊ธฐ์ ยท๋ฐ์ดํฐ ์ํคํ
์ฒ๋ฅผ ์ค๊ณํ์ธ์
|
201 |
2. ์ฝ๋ฉ/APIยท๋ฐ์ดํฐยท๋ณด์ ํ์ค์ ์๋ฆฝํ์ธ์
|
202 |
3. ํ์ฅ์ฑ๊ณผ ํธํ์ฑ์ ๊ณ ๋ คํ ํ๋ ์์ํฌ๋ฅผ ์ ์ํ์ธ์
|
203 |
4. ํ์ง ๊ฒ์ฆ ์ฒด๊ณ์ ๊ธฐ์ค์ ์ ์ํ์ธ์
|
204 |
-
5. ๊ธฐ์ ์ ์ ์ฝ์ฌํญ๊ณผ ํด๊ฒฐ๋ฐฉ์์ ์ ์ํ์ธ์
|
|
|
205 |
|
206 |
-
def create_water_rd_prompt(self, user_query: str, metal_response: str, critic_feedback: str, search_results: Dict) -> str:
|
207 |
"""ๆฐด(R&D) ํ๋กฌํํธ"""
|
|
|
|
|
|
|
|
|
208 |
return f"""๋น์ ์ ๆบ(์งํ)์ ๋๋ชฉ์ ์ง๋ ๆฐด์ ๊ธฐ์ด์ ๊ฐ์ง ๋๊ตฌ ํ์ฉ R&D ์คํ์
๋ฆฌ์คํธ์
๋๋ค.
|
209 |
๋ถ์๋ ฅ๊ณผ ํธ๊ธฐ์ฌ์ผ๋ก ์ต์ ๊ธฐ์ ์ ํ๊ตฌํ๊ณ ํ์ ํฉ๋๋ค.
|
210 |
|
@@ -215,16 +240,15 @@ class WuxingLLMSystem:
|
|
215 |
|
216 |
๋นํ์์ ํผ๋๋ฐฑ:
|
217 |
{critic_feedback}
|
218 |
-
|
219 |
-
์ต์ ๊ธฐ์ ์กฐ์ฌ ๊ฒฐ๊ณผ:
|
220 |
-
{self._format_search_results(search_results)}
|
221 |
|
222 |
R&D ์คํ์
๋ฆฌ์คํธ๋ก์:
|
223 |
1. ์ต์ ๊ธฐ์ ํธ๋ ๋์ ๋๊ตฌ๋ฅผ ๋ถ์ํ์ธ์
|
224 |
2. ํ์ ์ ์ธ ํ๋กํ ํ์
๊ฐ๋ฐ ๋ฐฉ์์ ์ ์ํ์ธ์
|
225 |
3. ์๋ํ์ ์์ฐ์ฑ ํฅ์ ๋๊ตฌ๋ฅผ ์ถ์ฒํ์ธ์
|
226 |
4. ๊ธฐ์ ๋์
์ ROI์ ์คํ ๊ฐ๋ฅ์ฑ์ ํ๊ฐํ์ธ์
|
227 |
-
5. ํ ๊ต์ก๊ณผ ๊ธฐ์ ์ ํ ๊ณํ์ ์๋ฆฝํ์ธ์
|
|
|
228 |
|
229 |
def create_wood_final_prompt(self, user_query: str, all_responses: Dict, all_critics: List) -> str:
|
230 |
"""ๆจ(๊ฐ๋
๊ด) ์ต์ข
์ข
ํฉ ํ๋กฌํํธ"""
|
@@ -251,8 +275,12 @@ R&D ์คํ์
๋ฆฌ์คํธ๋ก์:
|
|
251 |
|
252 |
๋งํฌ๋ค์ด ํ์์ ํ์ฉํ์ฌ ์ ๋ฌธ์ ์ด๊ณ ์ฒด๊ณ์ ์ผ๋ก ์์ฑํ์ธ์."""
|
253 |
|
254 |
-
def create_critic_prompt(self, stage: str, content: str, context: str = "") -> str:
|
255 |
"""์ค๋ฆฝ์ ๋นํ์ ํ๋กฌํํธ"""
|
|
|
|
|
|
|
|
|
256 |
return f"""๋น์ ์ ์ค๋ฆฝ์ ์ด๊ณ ๋
ผ๋ฆฌ์ ์ธ ๋นํ์์
๋๋ค.
|
257 |
ํธ๊ฒฌ ์์ด ํฉ๋ฆฌ์ ์ด๊ณ ๊ฑด์ค์ ์ธ ๋นํ์ ์ ๊ณตํฉ๋๋ค.
|
258 |
|
@@ -262,6 +290,7 @@ R&D ์คํ์
๋ฆฌ์คํธ๋ก์:
|
|
262 |
{content}
|
263 |
|
264 |
{f"์ด์ ๋งฅ๋ฝ: {context}" if context else ""}
|
|
|
265 |
|
266 |
๋ค์ ๊ด์ ์์ ๋นํํ์ธ์:
|
267 |
1. ๋
ผ๋ฆฌ์ ์ผ๊ด์ฑ๊ณผ ํ๋น์ฑ
|
@@ -269,9 +298,12 @@ R&D ์คํ์
๋ฆฌ์คํธ๋ก์:
|
|
269 |
3. ๋๋ฝ๋ ์ค์ ์์
|
270 |
4. ๊ฐ์ ๊ฐ๋ฅํ ๋ถ๋ถ
|
271 |
5. ๊ฐ์ ๊ณผ ์ฝ์ ์ ๊ท ํ์กํ ํ๊ฐ
|
|
|
272 |
|
273 |
๊ฑด์ค์ ์ด๊ณ ๊ตฌ์ฒด์ ์ธ ํผ๋๋ฐฑ์ ์ ๊ณตํ๋, ๋ค์ ๋จ๊ณ ๋ด๋น์๊ฐ
|
274 |
-
๊ฐ์ ํ ์ ์๋ ์ค์ง์ ์ธ ์ ์์ ํฌํจํ์ธ์.
|
|
|
|
|
275 |
|
276 |
def _format_search_results(self, search_results: Dict) -> str:
|
277 |
"""๊ฒ์ ๊ฒฐ๊ณผ ํฌ๋งทํ
"""
|
@@ -298,17 +330,30 @@ R&D ์คํ์
๋ฆฌ์คํธ๋ก์:
|
|
298 |
formatted += f"\n**{stages[i]} ๋จ๊ณ ๋นํ:**\n{critic}\n"
|
299 |
return formatted
|
300 |
|
301 |
-
def extract_keywords(self,
|
302 |
-
"""
|
303 |
keywords = []
|
304 |
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
|
310 |
if not keywords:
|
311 |
-
|
|
|
312 |
|
313 |
return keywords[:7]
|
314 |
|
@@ -488,17 +533,30 @@ wuxing_system = WuxingLLMSystem()
|
|
488 |
def process_wuxing_query(user_query: str, llm_mode: str):
|
489 |
"""์คํ ๊ธฐ๋ฐ ์ฟผ๋ฆฌ ์ฒ๋ฆฌ"""
|
490 |
if not user_query:
|
491 |
-
return "", "", "", "", "", "", "โ ์ง๋ฌธ์ ์
๋ ฅํด์ฃผ์ธ์."
|
492 |
|
493 |
wuxing_system.set_llm_mode(llm_mode)
|
494 |
|
495 |
all_responses = {}
|
496 |
all_critics = []
|
497 |
-
|
498 |
|
499 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
500 |
# 1. ๆจ(๊ฐ๋
๊ด) ์ด๊ธฐ ๋ถ์
|
501 |
-
wood_prompt = wuxing_system.create_wood_initial_prompt(user_query)
|
502 |
wood_response = ""
|
503 |
|
504 |
wood_text = "๐ณ **ๆจ - ๊ฐ๋
๊ด** (ไป)\n๐ ๋ถ์ ์ค...\n"
|
@@ -507,22 +565,22 @@ def process_wuxing_query(user_query: str, llm_mode: str):
|
|
507 |
):
|
508 |
wood_response += chunk
|
509 |
wood_text = f"๐ณ **ๆจ - ๊ฐ๋
๊ด** (ไป)\n{wood_response}"
|
510 |
-
yield wood_text, "", "", "", "", "", "๐ณ ๊ฐ๋
๊ด์ด ๋น์ ์ ์๋ฆฝ ์ค..."
|
511 |
|
512 |
all_responses['wood_initial'] = wood_response
|
513 |
|
514 |
-
# ํค์๋ ์ถ์ถ
|
515 |
keywords = wuxing_system.extract_keywords(wood_response)
|
516 |
-
status_text = "๐ ์น ๊ฒ์ ์ํ ์ค..."
|
517 |
-
yield wood_text, "", "", "", "", "", status_text
|
518 |
|
519 |
-
|
520 |
-
|
|
|
|
|
521 |
if results:
|
522 |
-
|
|
|
523 |
|
524 |
-
|
525 |
-
critic_prompt = wuxing_system.create_critic_prompt("ๆจ ์ด๊ธฐ ๋ถ์", wood_response)
|
526 |
critic_response = ""
|
527 |
|
528 |
critic_text = "๐ **์ค๋ฆฝ์ ๋นํ์**\n[ๆจ ๋ถ์ ๋นํ] ๐ ๋นํ ์ค...\n"
|
@@ -531,12 +589,22 @@ def process_wuxing_query(user_query: str, llm_mode: str):
|
|
531 |
):
|
532 |
critic_response += chunk
|
533 |
critic_text = f"๐ **์ค๋ฆฝ์ ๋นํ์**\n[ๆจ ๋ถ์ ๋นํ]\n{critic_response}"
|
534 |
-
yield wood_text, "", "", "", "", critic_text, "๐ ๋นํ์๊ฐ ๋ถ์ ์ค..."
|
535 |
|
536 |
all_critics.append(critic_response)
|
537 |
|
538 |
-
# 3. ็ซ(์ ๋ต๊ธฐํ)
|
539 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
540 |
fire_response = ""
|
541 |
|
542 |
fire_text = "๐ฅ **็ซ - ์ ๋ตยท๊ธฐํ ๋ฆฌ๋** (็พฉ)\n๐ ์ ๋ต ์๋ฆฝ ์ค...\n"
|
@@ -545,12 +613,21 @@ def process_wuxing_query(user_query: str, llm_mode: str):
|
|
545 |
):
|
546 |
fire_response += chunk
|
547 |
fire_text = f"๐ฅ **็ซ - ์ ๋ตยท๊ธฐํ ๋ฆฌ๋** (็พฉ)\n{fire_response}"
|
548 |
-
yield wood_text, fire_text, "", "", "", critic_text, "๐ฅ ์ ๋ต ์๋ฆฝ ์ค..."
|
549 |
|
550 |
all_responses['fire'] = fire_response
|
551 |
|
552 |
# 4. ็ซ ๋นํ
|
553 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
critic_response = ""
|
555 |
|
556 |
critic_text += "\n\n---\n\n[็ซ ์ ๋ต ๋นํ] ๐ ๋นํ ์ค...\n"
|
@@ -560,12 +637,19 @@ def process_wuxing_query(user_query: str, llm_mode: str):
|
|
560 |
critic_response += chunk
|
561 |
temp_text = all_critics[0] + f"\n\n---\n\n[็ซ ์ ๋ต ๋นํ]\n{critic_response}"
|
562 |
critic_text = f"๐ **์ค๋ฆฝ์ ๋นํ์**\n[ๆจ ๋ถ์ ๋นํ]\n{temp_text}"
|
563 |
-
yield wood_text, fire_text, "", "", "", critic_text, "๐ ์ ๋ต ๋นํ ์ค..."
|
564 |
|
565 |
all_critics.append(critic_response)
|
566 |
|
567 |
# 5. ๅ(์คํ์ด์)
|
568 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
earth_response = ""
|
570 |
|
571 |
earth_text = "๐๏ธ **ๅ - ์คํยท์ด์ยทํ์ง** (ไฟก)\n๐ ์คํ ๊ณํ ์๋ฆฝ ์ค...\n"
|
@@ -574,35 +658,37 @@ def process_wuxing_query(user_query: str, llm_mode: str):
|
|
574 |
):
|
575 |
earth_response += chunk
|
576 |
earth_text = f"๐๏ธ **ๅ - ์คํยท์ด์ยทํ์ง** (ไฟก)\n{earth_response}"
|
577 |
-
yield wood_text, fire_text, earth_text, "", "", critic_text, "๐๏ธ ์คํ ๊ณํ ์๋ฆฝ ์ค..."
|
578 |
|
579 |
all_responses['earth'] = earth_response
|
580 |
|
581 |
# 6. ๅ ๋นํ
|
582 |
-
|
583 |
-
|
|
|
|
|
|
|
584 |
|
585 |
-
|
586 |
-
|
587 |
-
f"[็ซ ์ ๋ต ๋นํ]\n{all_critics[1]}",
|
588 |
-
"[ๅ ์คํ ๋นํ] ๐ ๋นํ ์ค...\n"
|
589 |
-
])
|
590 |
|
591 |
for chunk in wuxing_system.call_llm_streaming(
|
592 |
[{"role": "user", "content": critic_prompt}], "critic"
|
593 |
):
|
594 |
critic_response += chunk
|
595 |
-
critic_text
|
596 |
-
f"[ๆจ ๋ถ์ ๋นํ]\n{all_critics[0]}",
|
597 |
-
f"[็ซ ์ ๋ต ๋นํ]\n{all_critics[1]}",
|
598 |
-
f"[ๅ ์คํ ๋นํ]\n{critic_response}"
|
599 |
-
])
|
600 |
-
yield wood_text, fire_text, earth_text, "", "", critic_text, "๐ ์คํ ๋นํ ์ค..."
|
601 |
|
602 |
all_critics.append(critic_response)
|
603 |
|
604 |
# 7. ้(์ํคํ
์ฒ)
|
605 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
606 |
metal_response = ""
|
607 |
|
608 |
metal_text = "โ๏ธ **้ - ์ํคํ
์ฒ & ํ์ค** (็ฆฎ)\n๐ ์ํคํ
์ฒ ์ค๊ณ ์ค...\n"
|
@@ -611,32 +697,37 @@ def process_wuxing_query(user_query: str, llm_mode: str):
|
|
611 |
):
|
612 |
metal_response += chunk
|
613 |
metal_text = f"โ๏ธ **้ - ์ํคํ
์ฒ & ํ์ค** (็ฆฎ)\n{metal_response}"
|
614 |
-
yield wood_text, fire_text, earth_text, metal_text, "", critic_text, "โ๏ธ ์ํคํ
์ฒ ์ค๊ณ ์ค..."
|
615 |
|
616 |
all_responses['metal'] = metal_response
|
617 |
|
618 |
# 8. ้ ๋นํ
|
619 |
-
|
620 |
-
|
|
|
|
|
|
|
621 |
|
622 |
-
|
623 |
-
|
624 |
-
for keyword in additional_keywords:
|
625 |
-
results = wuxing_system.brave_search(f"{user_query} {keyword}")
|
626 |
-
if results:
|
627 |
-
search_results[keyword] = results
|
628 |
|
629 |
-
# ๋นํ ์ํ
|
630 |
for chunk in wuxing_system.call_llm_streaming(
|
631 |
[{"role": "user", "content": critic_prompt}], "critic"
|
632 |
):
|
633 |
critic_response += chunk
|
634 |
-
yield wood_text, fire_text, earth_text, metal_text, "", critic_text, "๐ ์ํคํ
์ฒ ๋นํ ์ค..."
|
635 |
|
636 |
all_critics.append(critic_response)
|
637 |
|
638 |
# 9. ๆฐด(R&D)
|
639 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
640 |
water_response = ""
|
641 |
|
642 |
water_text = "๐ง **ๆฐด - R&D ์คํ์
๋ฆฌ์คํธ** (ๆบ)\n๐ ํ์ ๋ฐฉ์ ์ฐ๊ตฌ ์ค...\n"
|
@@ -645,19 +736,25 @@ def process_wuxing_query(user_query: str, llm_mode: str):
|
|
645 |
):
|
646 |
water_response += chunk
|
647 |
water_text = f"๐ง **ๆฐด - R&D ์คํ์
๋ฆฌ์คํธ** (ๆบ)\n{water_response}"
|
648 |
-
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, "๐ง ํ์ ์ฐ๊ตฌ ์ค..."
|
649 |
|
650 |
all_responses['water'] = water_response
|
651 |
|
652 |
# 10. ๆฐด ๋นํ
|
653 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
654 |
critic_response = ""
|
655 |
|
656 |
for chunk in wuxing_system.call_llm_streaming(
|
657 |
[{"role": "user", "content": critic_prompt}], "critic"
|
658 |
):
|
659 |
critic_response += chunk
|
660 |
-
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, "๐ R&D ๋นํ ์ค..."
|
661 |
|
662 |
all_critics.append(critic_response)
|
663 |
|
@@ -672,18 +769,78 @@ def process_wuxing_query(user_query: str, llm_mode: str):
|
|
672 |
wood_final_response += chunk
|
673 |
temp_text = all_responses['wood_initial'] + f"\n\n---\n\n๐ณ **์ต์ข
์ข
ํฉ ๋ณด๊ณ ์**\n{wood_final_response}"
|
674 |
wood_text = f"๐ณ **ๆจ - ๊ฐ๋
๊ด** (ไป)\n{temp_text}"
|
675 |
-
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, "๐ณ ์ต์ข
๋ณด๊ณ ์ ์์ฑ ์ค..."
|
676 |
|
677 |
-
|
678 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
679 |
|
680 |
except Exception as e:
|
681 |
error_msg = f"โ ์ฒ๋ฆฌ ์ค ์ค๋ฅ: {str(e)}"
|
682 |
-
yield "", "", "", "", "", "", error_msg
|
683 |
|
684 |
def clear_wuxing():
|
685 |
"""์ด๊ธฐํ"""
|
686 |
-
return "", "", "", "", "", "", "๐ ์ด๊ธฐํ๋์์ต๋๋ค."
|
687 |
|
688 |
# CSS ์คํ์ผ
|
689 |
css = """
|
@@ -714,6 +871,134 @@ css = """
|
|
714 |
border-left: 4px solid #6b7280 !important;
|
715 |
background-color: #f9fafb !important;
|
716 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
h1 {
|
718 |
text-align: center;
|
719 |
color: #1f2937;
|
@@ -766,6 +1051,15 @@ with gr.Blocks(title="์คํยท์ค์ ํ๋ ฅ ์์คํ
", theme=gr.themes.Soft(),
|
|
766 |
lines=3
|
767 |
)
|
768 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
# ์คํ ์ถ๋ ฅ - 2x3 ๊ทธ๋ฆฌ๋
|
770 |
with gr.Row():
|
771 |
with gr.Column():
|
@@ -847,7 +1141,7 @@ with gr.Blocks(title="์คํยท์ค์ ํ๋ ฅ ์์คํ
", theme=gr.themes.Soft(),
|
|
847 |
submit_btn.click(
|
848 |
fn=process_wuxing_query,
|
849 |
inputs=[user_input, llm_mode],
|
850 |
-
outputs=[wood_output, fire_output, earth_output, metal_output, water_output, critic_output, status_text]
|
851 |
).then(
|
852 |
fn=lambda: "",
|
853 |
outputs=[user_input]
|
@@ -856,7 +1150,7 @@ with gr.Blocks(title="์คํยท์ค์ ํ๋ ฅ ์์คํ
", theme=gr.themes.Soft(),
|
|
856 |
user_input.submit(
|
857 |
fn=process_wuxing_query,
|
858 |
inputs=[user_input, llm_mode],
|
859 |
-
outputs=[wood_output, fire_output, earth_output, metal_output, water_output, critic_output, status_text]
|
860 |
).then(
|
861 |
fn=lambda: "",
|
862 |
outputs=[user_input]
|
@@ -864,7 +1158,7 @@ with gr.Blocks(title="์คํยท์ค์ ํ๋ ฅ ์์คํ
", theme=gr.themes.Soft(),
|
|
864 |
|
865 |
clear_btn.click(
|
866 |
fn=clear_wuxing,
|
867 |
-
outputs=[wood_output, fire_output, earth_output, metal_output, water_output, critic_output, status_text]
|
868 |
)
|
869 |
|
870 |
if __name__ == "__main__":
|
|
|
125 |
"X-Subscription-Token": self.bapi_token
|
126 |
}
|
127 |
|
128 |
+
def create_wood_initial_prompt(self, user_query: str, search_results: Dict = None) -> str:
|
129 |
"""ๆจ(๊ฐ๋
๊ด) ์ด๊ธฐ ํ๋กฌํํธ"""
|
130 |
+
search_info = ""
|
131 |
+
if search_results:
|
132 |
+
search_info = f"\n\n์น ๊ฒ์ ๊ฒฐ๊ณผ:\n{self._format_search_results(search_results)}"
|
133 |
+
|
134 |
return f"""๋น์ ์ ไป(์ธ์ํจ)์ ๋๋ชฉ์ ์ง๋ ๆจ์ ๊ธฐ์ด์ ๊ฐ์ง ๊ฐ๋
๊ด์
๋๋ค.
|
135 |
ํฌ์ฉ์ ์ด๊ณ ์ฑ์ฅ์งํฅ์ ์ธ ๋ฆฌ๋์ญ์ผ๋ก ํ์ ์ด๋๋๋ค.
|
136 |
|
137 |
์ฌ์ฉ์ ์ง๋ฌธ: {user_query}
|
138 |
+
{search_info}
|
139 |
|
140 |
ํ์ฅ์ผ๋ก์ ์ด ์ง๋ฌธ์ ๋ํด:
|
141 |
1. ์ ์ฒด์ ์ธ ๋น์ ๊ณผ ๋ฐฉํฅ์ฑ์ ์ ์ํ์ธ์
|
142 |
2. ๊ฐ ํ์(็ซ, ๅ, ้, ๆฐด)์ ์ญํ ๊ณผ ๊ธฐ์ฌ ๋ฐฉํฅ์ ์ค๊ณํ์ธ์
|
143 |
3. ์ฑ์ฅ๊ณผ ๋ฐ์ ์ ๊ด์ ์์ ํต์ฌ ๋ชฉํ๋ฅผ ์ค์ ํ์ธ์
|
144 |
4. ํ ์ ์ฒด๊ฐ ์กฐํ๋กญ๊ฒ ํ๋ ฅํ ์ ์๋ ํ๋ ์์ํฌ๋ฅผ ์ ์ํ์ธ์
|
145 |
+
5. ๊ฒ์ ๊ฒฐ๊ณผ๋ฅผ ์ฐธ๊ณ ํ์ฌ ์ต์ ํธ๋ ๋์ ๋ชจ๋ฒ ์ฌ๋ก๋ฅผ ๋ฐ์ํ์ธ์
|
146 |
|
147 |
[ํต์ฌ ํค์๋]: 5-7๊ฐ์ ์กฐ์ฌ๊ฐ ํ์ํ ํค์๋๋ฅผ ์ ์ํ์ธ์"""
|
148 |
|
149 |
+
def create_fire_strategy_prompt(self, user_query: str, wood_response: str, critic_feedback: str, search_results: Dict = None) -> str:
|
150 |
"""็ซ(์ ๋ต๊ธฐํ) ํ๋กฌํํธ"""
|
151 |
+
search_info = ""
|
152 |
+
if search_results:
|
153 |
+
search_info = f"\n\n์น ๊ฒ์ ๊ฒฐ๊ณผ:\n{self._format_search_results(search_results)}"
|
154 |
+
|
155 |
return f"""๋น์ ์ ็พฉ(์ ์๋ก์)์ ๋๋ชฉ์ ์ง๋ ็ซ์ ๊ธฐ์ด์ ๊ฐ์ง ์ ๋ตยท๊ธฐํ ๋ฆฌ๋์
๋๋ค.
|
156 |
์ด์ ๊ณผ ๊ฒฐ๋จ๋ ฅ์ผ๋ก ํ์ ์ ์ธ ์ ๋ต์ ์๋ฆฝํฉ๋๋ค.
|
157 |
|
|
|
162 |
|
163 |
๋นํ์์ ํผ๋๋ฐฑ:
|
164 |
{critic_feedback}
|
165 |
+
{search_info}
|
166 |
|
167 |
์ ๋ต๊ธฐํ ๋ฆฌ๋๋ก์:
|
168 |
1. ์คยท์ฅ๊ธฐ ๋ก๋๋งต์ ๊ตฌ์ฒด์ ์ผ๋ก ์๋ฆฝํ์ธ์
|
169 |
2. ํ์ ์ ์ธ ์ฌ์
๋ชจ๋ธ์ ์ค๊ณํ์ธ์
|
170 |
3. ๋ฆฌ์คํฌ์ ๊ธฐํ ๋ถ์์ ์ํํ์ธ์
|
171 |
4. ๊ฒฝ์ ์ฐ์ ํ๋ณด ์ ๋ต์ ์ ์ํ์ธ์
|
172 |
+
5. ๋นํ์์ ํผ๋๋ฐฑ์ ๋ฐ์ํ์ฌ ์ ๋ต์ ๋ณด์ํ์ธ์
|
173 |
+
6. ํ์ํ ์ถ๊ฐ ๊ฒ์ ํค์๋๋ฅผ ์ ์ํ์ธ์: [์ถ๊ฐ ๊ฒ์]"""
|
174 |
|
175 |
+
def create_earth_execution_prompt(self, user_query: str, fire_response: str, critic_feedback: str, search_results: Dict = None) -> str:
|
176 |
"""ๅ(์คํ์ด์) ํ๋กฌํํธ"""
|
177 |
+
search_info = ""
|
178 |
+
if search_results:
|
179 |
+
search_info = f"\n\n์น ๊ฒ์ ๊ฒฐ๊ณผ:\n{self._format_search_results(search_results)}"
|
180 |
+
|
181 |
return f"""๋น์ ์ ไฟก(์ ๋ขฐ)์ ๋๋ชฉ์ ์ง๋ ๅ์ ๊ธฐ์ด์ ๊ฐ์ง ์คํยท์ด์ยทํ์ง ๋ด๋น์์
๋๋ค.
|
182 |
์ฑ์คํจ๊ณผ ์คํ๋ ฅ์ผ๋ก ๊ณํ์ ํ์ค๋ก ๋ง๋ญ๋๋ค.
|
183 |
|
|
|
188 |
|
189 |
๋นํ์์ ํผ๋๋ฐฑ:
|
190 |
{critic_feedback}
|
191 |
+
{search_info}
|
|
|
|
|
192 |
|
193 |
์คํ์ด์ ๋ด๋น์๋ก์:
|
194 |
1. ๊ตฌ์ฒด์ ์ธ ์คํ ๊ณํ๊ณผ ์ผ์ ์ ์๋ฆฝํ์ธ์
|
195 |
2. ํ์ํ ๋ฆฌ์์ค์ ์์ฐ์ ์ฐ์ ํ์ธ์
|
196 |
3. ํ์ง ๊ด๋ฆฌ ๊ธฐ์ค๊ณผ ํ๋ก์ธ์ค๋ฅผ ์ ์ํ์ธ์
|
197 |
4. ๋ฆฌ์คํฌ ๋์ ๊ณํ์ ์๋ฆฝํ์ธ์
|
198 |
+
5. ์ฑ๊ณผ ์ธก์ ์งํ๋ฅผ ์ค์ ํ์ธ์
|
199 |
+
6. ์ถ๊ฐ ์กฐ์ฌ๊ฐ ํ์ํ ์คํ ๊ด๋ จ ํค์๋: [์ถ๊ฐ ๊ฒ์]"""
|
200 |
|
201 |
+
def create_metal_architecture_prompt(self, user_query: str, earth_response: str, critic_feedback: str, search_results: Dict = None) -> str:
|
202 |
"""้(์ํคํ
์ฒ) ํ๋กฌํํธ"""
|
203 |
+
search_info = ""
|
204 |
+
if search_results:
|
205 |
+
search_info = f"\n\n์น ๊ฒ์ ๊ฒฐ๊ณผ:\n{self._format_search_results(search_results)}"
|
206 |
+
|
207 |
return f"""๋น์ ์ ็ฆฎ(์์ยท์ง์)์ ๋๋ชฉ์ ์ง๋ ้์ ๊ธฐ์ด์ ๊ฐ์ง ์ํคํ
์ฒ & ํ์ค ์ฑ
์์์
๋๋ค.
|
208 |
์ ๋ฐํจ๊ณผ ๊ตฌ์กฐํ ๋ฅ๋ ฅ์ผ๋ก ์๋ฒฝํ ์์คํ
์ ์ค๊ณํฉ๋๋ค.
|
209 |
|
|
|
214 |
|
215 |
๋นํ์์ ํผ๋๋ฐฑ:
|
216 |
{critic_feedback}
|
217 |
+
{search_info}
|
218 |
|
219 |
์ํคํ
์ฒ ์ฑ
์์๋ก์:
|
220 |
1. ์ ์ฒด ์์คํ
์ ๊ธฐ์ ยท๋ฐ์ดํฐ ์ํคํ
์ฒ๋ฅผ ์ค๊ณํ์ธ์
|
221 |
2. ์ฝ๋ฉ/APIยท๋ฐ์ดํฐยท๋ณด์ ํ์ค์ ์๋ฆฝํ์ธ์
|
222 |
3. ํ์ฅ์ฑ๊ณผ ํธํ์ฑ์ ๊ณ ๋ คํ ํ๋ ์์ํฌ๋ฅผ ์ ์ํ์ธ์
|
223 |
4. ํ์ง ๊ฒ์ฆ ์ฒด๊ณ์ ๊ธฐ์ค์ ์ ์ํ์ธ์
|
224 |
+
5. ๊ธฐ์ ์ ์ ์ฝ์ฌํญ๊ณผ ํด๊ฒฐ๋ฐฉ์์ ์ ์ํ์ธ์
|
225 |
+
6. ๊ธฐ์ ์ํคํ
์ฒ ๊ด๋ จ ์ถ๊ฐ ๊ฒ์: [์ถ๊ฐ ๊ฒ์]"""
|
226 |
|
227 |
+
def create_water_rd_prompt(self, user_query: str, metal_response: str, critic_feedback: str, search_results: Dict = None) -> str:
|
228 |
"""ๆฐด(R&D) ํ๋กฌํํธ"""
|
229 |
+
search_info = ""
|
230 |
+
if search_results:
|
231 |
+
search_info = f"\n\n์ต์ ๊ธฐ์ ์กฐ์ฌ ๊ฒฐ๊ณผ:\n{self._format_search_results(search_results)}"
|
232 |
+
|
233 |
return f"""๋น์ ์ ๆบ(์งํ)์ ๋๋ชฉ์ ์ง๋ ๆฐด์ ๊ธฐ์ด์ ๊ฐ์ง ๋๊ตฌ ํ์ฉ R&D ์คํ์
๋ฆฌ์คํธ์
๋๋ค.
|
234 |
๋ถ์๋ ฅ๊ณผ ํธ๊ธฐ์ฌ์ผ๋ก ์ต์ ๊ธฐ์ ์ ํ๊ตฌํ๊ณ ํ์ ํฉ๋๋ค.
|
235 |
|
|
|
240 |
|
241 |
๋นํ์์ ํผ๋๋ฐฑ:
|
242 |
{critic_feedback}
|
243 |
+
{search_info}
|
|
|
|
|
244 |
|
245 |
R&D ์คํ์
๋ฆฌ์คํธ๋ก์:
|
246 |
1. ์ต์ ๊ธฐ์ ํธ๋ ๋์ ๋๊ตฌ๋ฅผ ๋ถ์ํ์ธ์
|
247 |
2. ํ์ ์ ์ธ ํ๋กํ ํ์
๊ฐ๋ฐ ๋ฐฉ์์ ์ ์ํ์ธ์
|
248 |
3. ์๋ํ์ ์์ฐ์ฑ ํฅ์ ๋๊ตฌ๋ฅผ ์ถ์ฒํ์ธ์
|
249 |
4. ๊ธฐ์ ๋์
์ ROI์ ์คํ ๊ฐ๋ฅ์ฑ์ ํ๊ฐํ์ธ์
|
250 |
+
5. ํ ๊ต์ก๊ณผ ๊ธฐ์ ์ ํ ๊ณํ์ ์๋ฆฝํ์ธ์
|
251 |
+
6. ๋ฏธ๋ ๊ธฐ์ ๊ด๋ จ ์ถ๊ฐ ๊ฒ์: [์ถ๊ฐ ๊ฒ์]"""
|
252 |
|
253 |
def create_wood_final_prompt(self, user_query: str, all_responses: Dict, all_critics: List) -> str:
|
254 |
"""ๆจ(๊ฐ๋
๊ด) ์ต์ข
์ข
ํฉ ํ๋กฌํํธ"""
|
|
|
275 |
|
276 |
๋งํฌ๋ค์ด ํ์์ ํ์ฉํ์ฌ ์ ๋ฌธ์ ์ด๊ณ ์ฒด๊ณ์ ์ผ๋ก ์์ฑํ์ธ์."""
|
277 |
|
278 |
+
def create_critic_prompt(self, stage: str, content: str, context: str = "", search_results: Dict = None) -> str:
|
279 |
"""์ค๋ฆฝ์ ๋นํ์ ํ๋กฌํํธ"""
|
280 |
+
search_info = ""
|
281 |
+
if search_results:
|
282 |
+
search_info = f"\n\n์ฐธ๊ณ ๊ฒ์ ๊ฒฐ๊ณผ:\n{self._format_search_results(search_results)}"
|
283 |
+
|
284 |
return f"""๋น์ ์ ์ค๋ฆฝ์ ์ด๊ณ ๋
ผ๋ฆฌ์ ์ธ ๋นํ์์
๋๋ค.
|
285 |
ํธ๊ฒฌ ์์ด ํฉ๋ฆฌ์ ์ด๊ณ ๊ฑด์ค์ ์ธ ๋นํ์ ์ ๊ณตํฉ๋๋ค.
|
286 |
|
|
|
290 |
{content}
|
291 |
|
292 |
{f"์ด์ ๋งฅ๋ฝ: {context}" if context else ""}
|
293 |
+
{search_info}
|
294 |
|
295 |
๋ค์ ๊ด์ ์์ ๋นํํ์ธ์:
|
296 |
1. ๋
ผ๋ฆฌ์ ์ผ๊ด์ฑ๊ณผ ํ๋น์ฑ
|
|
|
298 |
3. ๋๋ฝ๋ ์ค์ ์์
|
299 |
4. ๊ฐ์ ๊ฐ๋ฅํ ๋ถ๋ถ
|
300 |
5. ๊ฐ์ ๊ณผ ์ฝ์ ์ ๊ท ํ์กํ ํ๊ฐ
|
301 |
+
6. ์ต์ ํธ๋ ๋์ ๋ชจ๋ฒ ์ฌ๋ก ๋๋น ํ๊ฐ
|
302 |
|
303 |
๊ฑด์ค์ ์ด๊ณ ๊ตฌ์ฒด์ ์ธ ํผ๋๋ฐฑ์ ์ ๊ณตํ๋, ๋ค์ ๋จ๊ณ ๋ด๋น์๊ฐ
|
304 |
+
๊ฐ์ ํ ์ ์๋ ์ค์ง์ ์ธ ์ ์์ ํฌํจํ์ธ์.
|
305 |
+
|
306 |
+
ํ์์ ์ถ๊ฐ ๊ฒ์์ด ํ์ํ ํค์๋๋ฅผ ์ ์ํ์ธ์: [๋นํ ๊ฒ์]"""
|
307 |
|
308 |
def _format_search_results(self, search_results: Dict) -> str:
|
309 |
"""๊ฒ์ ๊ฒฐ๊ณผ ํฌ๋งทํ
"""
|
|
|
330 |
formatted += f"\n**{stages[i]} ๋จ๊ณ ๋นํ:**\n{critic}\n"
|
331 |
return formatted
|
332 |
|
333 |
+
def extract_keywords(self, response: str, keyword_marker: str = "[ํต์ฌ ํค์๋]") -> List[str]:
|
334 |
+
"""์๋ต์์ ํค์๋ ์ถ์ถ (๋ฒ์ฉ)"""
|
335 |
keywords = []
|
336 |
|
337 |
+
# ๋ค์ํ ํค์๋ ๋ง์ปค ํจํด
|
338 |
+
patterns = [
|
339 |
+
rf'\{keyword_marker}:\s*(.+)',
|
340 |
+
r'\[์ถ๊ฐ ๊ฒ์\]:\s*(.+)',
|
341 |
+
r'\[๋นํ ๊ฒ์\]:\s*(.+)'
|
342 |
+
]
|
343 |
+
|
344 |
+
for pattern in patterns:
|
345 |
+
match = re.search(pattern, response, re.IGNORECASE)
|
346 |
+
if match:
|
347 |
+
keyword_str = match.group(1)
|
348 |
+
new_keywords = [k.strip() for k in keyword_str.split(',') if k.strip()]
|
349 |
+
keywords.extend(new_keywords)
|
350 |
+
|
351 |
+
# ์ค๋ณต ์ ๊ฑฐ
|
352 |
+
keywords = list(dict.fromkeys(keywords))
|
353 |
|
354 |
if not keywords:
|
355 |
+
# ๊ธฐ๋ณธ ํค์๋ ์์ฑ
|
356 |
+
keywords = ["best practices", "implementation", "case studies", "latest trends"]
|
357 |
|
358 |
return keywords[:7]
|
359 |
|
|
|
533 |
def process_wuxing_query(user_query: str, llm_mode: str):
|
534 |
"""์คํ ๊ธฐ๋ฐ ์ฟผ๋ฆฌ ์ฒ๋ฆฌ"""
|
535 |
if not user_query:
|
536 |
+
return "", "", "", "", "", "", "", "โ ์ง๋ฌธ์ ์
๋ ฅํด์ฃผ์ธ์."
|
537 |
|
538 |
wuxing_system.set_llm_mode(llm_mode)
|
539 |
|
540 |
all_responses = {}
|
541 |
all_critics = []
|
542 |
+
all_search_results = {}
|
543 |
|
544 |
try:
|
545 |
+
# 0. ์ด๊ธฐ ๊ฒ์ ์ํ
|
546 |
+
initial_keywords = [user_query] + ["best practices", "latest trends", "case studies"]
|
547 |
+
wood_search_results = {}
|
548 |
+
|
549 |
+
status_text = "๐ ์ด๊ธฐ ์น ๊ฒ์ ์ํ ์ค..."
|
550 |
+
yield "", "", "", "", "", "", "", status_text
|
551 |
+
|
552 |
+
for keyword in initial_keywords[:3]:
|
553 |
+
results = wuxing_system.brave_search(keyword)
|
554 |
+
if results:
|
555 |
+
wood_search_results[keyword] = results
|
556 |
+
all_search_results[f"์ด๊ธฐ-{keyword}"] = results
|
557 |
+
|
558 |
# 1. ๆจ(๊ฐ๋
๊ด) ์ด๊ธฐ ๋ถ์
|
559 |
+
wood_prompt = wuxing_system.create_wood_initial_prompt(user_query, wood_search_results)
|
560 |
wood_response = ""
|
561 |
|
562 |
wood_text = "๐ณ **ๆจ - ๊ฐ๋
๊ด** (ไป)\n๐ ๋ถ์ ์ค...\n"
|
|
|
565 |
):
|
566 |
wood_response += chunk
|
567 |
wood_text = f"๐ณ **ๆจ - ๊ฐ๋
๊ด** (ไป)\n{wood_response}"
|
568 |
+
yield wood_text, "", "", "", "", "", "", "๐ณ ๊ฐ๋
๊ด์ด ๋น์ ์ ์๋ฆฝ ์ค..."
|
569 |
|
570 |
all_responses['wood_initial'] = wood_response
|
571 |
|
572 |
+
# ํค์๋ ์ถ์ถ
|
573 |
keywords = wuxing_system.extract_keywords(wood_response)
|
|
|
|
|
574 |
|
575 |
+
# 2. ๆจ ๋นํ + ๋นํ์ ๊ฒ์
|
576 |
+
critic_search = {}
|
577 |
+
for keyword in keywords[:2]:
|
578 |
+
results = wuxing_system.brave_search(f"{keyword} analysis")
|
579 |
if results:
|
580 |
+
critic_search[keyword] = results
|
581 |
+
all_search_results[f"๋นํ1-{keyword}"] = results
|
582 |
|
583 |
+
critic_prompt = wuxing_system.create_critic_prompt("ๆจ ์ด๊ธฐ ๋ถ์", wood_response, search_results=critic_search)
|
|
|
584 |
critic_response = ""
|
585 |
|
586 |
critic_text = "๐ **์ค๋ฆฝ์ ๋นํ์**\n[ๆจ ๋ถ์ ๋นํ] ๐ ๋นํ ์ค...\n"
|
|
|
589 |
):
|
590 |
critic_response += chunk
|
591 |
critic_text = f"๐ **์ค๋ฆฝ์ ๋นํ์**\n[ๆจ ๋ถ์ ๋นํ]\n{critic_response}"
|
592 |
+
yield wood_text, "", "", "", "", critic_text, "", "๐ ๋นํ์๊ฐ ๋ถ์ ์ค..."
|
593 |
|
594 |
all_critics.append(critic_response)
|
595 |
|
596 |
+
# 3. ็ซ(์ ๋ต๊ธฐํ) + ๊ฒ์
|
597 |
+
# ๋นํ์๊ฐ ์ ์ํ ์ถ๊ฐ ํค์๋ ์ถ์ถ
|
598 |
+
critic_keywords = wuxing_system.extract_keywords(critic_response, "[๋นํ ๊ฒ์]")
|
599 |
+
fire_search = {}
|
600 |
+
|
601 |
+
for keyword in (keywords[:2] + critic_keywords[:2]):
|
602 |
+
results = wuxing_system.brave_search(f"{user_query} {keyword} strategy")
|
603 |
+
if results:
|
604 |
+
fire_search[keyword] = results
|
605 |
+
all_search_results[f"็ซ-{keyword}"] = results
|
606 |
+
|
607 |
+
fire_prompt = wuxing_system.create_fire_strategy_prompt(user_query, wood_response, critic_response, fire_search)
|
608 |
fire_response = ""
|
609 |
|
610 |
fire_text = "๐ฅ **็ซ - ์ ๋ตยท๊ธฐํ ๋ฆฌ๋** (็พฉ)\n๐ ์ ๋ต ์๋ฆฝ ์ค...\n"
|
|
|
613 |
):
|
614 |
fire_response += chunk
|
615 |
fire_text = f"๐ฅ **็ซ - ์ ๋ตยท๊ธฐํ ๋ฆฌ๋** (็พฉ)\n{fire_response}"
|
616 |
+
yield wood_text, fire_text, "", "", "", critic_text, "", "๐ฅ ์ ๋ต ์๋ฆฝ ์ค..."
|
617 |
|
618 |
all_responses['fire'] = fire_response
|
619 |
|
620 |
# 4. ็ซ ๋นํ
|
621 |
+
fire_keywords = wuxing_system.extract_keywords(fire_response, "[์ถ๊ฐ ๊ฒ์]")
|
622 |
+
critic_search = {}
|
623 |
+
|
624 |
+
for keyword in fire_keywords[:2]:
|
625 |
+
results = wuxing_system.brave_search(keyword)
|
626 |
+
if results:
|
627 |
+
critic_search[keyword] = results
|
628 |
+
all_search_results[f"๋นํ2-{keyword}"] = results
|
629 |
+
|
630 |
+
critic_prompt = wuxing_system.create_critic_prompt("็ซ ์ ๋ต๊ธฐํ", fire_response, wood_response, critic_search)
|
631 |
critic_response = ""
|
632 |
|
633 |
critic_text += "\n\n---\n\n[็ซ ์ ๋ต ๋นํ] ๐ ๋นํ ์ค...\n"
|
|
|
637 |
critic_response += chunk
|
638 |
temp_text = all_critics[0] + f"\n\n---\n\n[็ซ ์ ๋ต ๋นํ]\n{critic_response}"
|
639 |
critic_text = f"๐ **์ค๋ฆฝ์ ๋นํ์**\n[ๆจ ๋ถ์ ๋นํ]\n{temp_text}"
|
640 |
+
yield wood_text, fire_text, "", "", "", critic_text, "", "๐ ์ ๋ต ๋นํ ์ค..."
|
641 |
|
642 |
all_critics.append(critic_response)
|
643 |
|
644 |
# 5. ๅ(์คํ์ด์)
|
645 |
+
earth_search = {}
|
646 |
+
for keyword in ["implementation", "resource management", "quality assurance"]:
|
647 |
+
results = wuxing_system.brave_search(f"{user_query} {keyword}")
|
648 |
+
if results:
|
649 |
+
earth_search[keyword] = results
|
650 |
+
all_search_results[f"ๅ-{keyword}"] = results
|
651 |
+
|
652 |
+
earth_prompt = wuxing_system.create_earth_execution_prompt(user_query, fire_response, critic_response, earth_search)
|
653 |
earth_response = ""
|
654 |
|
655 |
earth_text = "๐๏ธ **ๅ - ์คํยท์ด์ยทํ์ง** (ไฟก)\n๐ ์คํ ๊ณํ ์๋ฆฝ ์ค...\n"
|
|
|
658 |
):
|
659 |
earth_response += chunk
|
660 |
earth_text = f"๐๏ธ **ๅ - ์คํยท์ด์ยทํ์ง** (ไฟก)\n{earth_response}"
|
661 |
+
yield wood_text, fire_text, earth_text, "", "", critic_text, "", "๐๏ธ ์คํ ๊ณํ ์๋ฆฝ ์ค..."
|
662 |
|
663 |
all_responses['earth'] = earth_response
|
664 |
|
665 |
# 6. ๅ ๋นํ
|
666 |
+
critic_search = {}
|
667 |
+
results = wuxing_system.brave_search(f"{user_query} execution challenges")
|
668 |
+
if results:
|
669 |
+
critic_search["execution"] = results
|
670 |
+
all_search_results["๋นํ3-execution"] = results
|
671 |
|
672 |
+
critic_prompt = wuxing_system.create_critic_prompt("ๅ ์คํ๊ณํ", earth_response, fire_response, critic_search)
|
673 |
+
critic_response = ""
|
|
|
|
|
|
|
674 |
|
675 |
for chunk in wuxing_system.call_llm_streaming(
|
676 |
[{"role": "user", "content": critic_prompt}], "critic"
|
677 |
):
|
678 |
critic_response += chunk
|
679 |
+
yield wood_text, fire_text, earth_text, "", "", critic_text, "", "๐ ์คํ ๋นํ ์ค..."
|
|
|
|
|
|
|
|
|
|
|
680 |
|
681 |
all_critics.append(critic_response)
|
682 |
|
683 |
# 7. ้(์ํคํ
์ฒ)
|
684 |
+
metal_search = {}
|
685 |
+
for keyword in ["architecture", "standards", "system design", "scalability"]:
|
686 |
+
results = wuxing_system.brave_search(f"{user_query} {keyword}")
|
687 |
+
if results:
|
688 |
+
metal_search[keyword] = results
|
689 |
+
all_search_results[f"้-{keyword}"] = results
|
690 |
+
|
691 |
+
metal_prompt = wuxing_system.create_metal_architecture_prompt(user_query, earth_response, critic_response, metal_search)
|
692 |
metal_response = ""
|
693 |
|
694 |
metal_text = "โ๏ธ **้ - ์ํคํ
์ฒ & ํ์ค** (็ฆฎ)\n๐ ์ํคํ
์ฒ ์ค๊ณ ์ค...\n"
|
|
|
697 |
):
|
698 |
metal_response += chunk
|
699 |
metal_text = f"โ๏ธ **้ - ์ํคํ
์ฒ & ํ์ค** (็ฆฎ)\n{metal_response}"
|
700 |
+
yield wood_text, fire_text, earth_text, metal_text, "", critic_text, "", "โ๏ธ ์ํคํ
์ฒ ์ค๊ณ ์ค..."
|
701 |
|
702 |
all_responses['metal'] = metal_response
|
703 |
|
704 |
# 8. ้ ๋นํ
|
705 |
+
critic_search = {}
|
706 |
+
results = wuxing_system.brave_search(f"{user_query} technical constraints")
|
707 |
+
if results:
|
708 |
+
critic_search["constraints"] = results
|
709 |
+
all_search_results["๋นํ4-constraints"] = results
|
710 |
|
711 |
+
critic_prompt = wuxing_system.create_critic_prompt("้ ์ํคํ
์ฒ", metal_response, earth_response, critic_search)
|
712 |
+
critic_response = ""
|
|
|
|
|
|
|
|
|
713 |
|
|
|
714 |
for chunk in wuxing_system.call_llm_streaming(
|
715 |
[{"role": "user", "content": critic_prompt}], "critic"
|
716 |
):
|
717 |
critic_response += chunk
|
718 |
+
yield wood_text, fire_text, earth_text, metal_text, "", critic_text, "", "๐ ์ํคํ
์ฒ ๋นํ ์ค..."
|
719 |
|
720 |
all_critics.append(critic_response)
|
721 |
|
722 |
# 9. ๆฐด(R&D)
|
723 |
+
water_search = {}
|
724 |
+
for keyword in ["innovation", "emerging technology", "R&D", "automation tools"]:
|
725 |
+
results = wuxing_system.brave_search(f"{user_query} {keyword}")
|
726 |
+
if results:
|
727 |
+
water_search[keyword] = results
|
728 |
+
all_search_results[f"ๆฐด-{keyword}"] = results
|
729 |
+
|
730 |
+
water_prompt = wuxing_system.create_water_rd_prompt(user_query, metal_response, critic_response, water_search)
|
731 |
water_response = ""
|
732 |
|
733 |
water_text = "๐ง **ๆฐด - R&D ์คํ์
๋ฆฌ์คํธ** (ๆบ)\n๐ ํ์ ๋ฐฉ์ ์ฐ๊ตฌ ์ค...\n"
|
|
|
736 |
):
|
737 |
water_response += chunk
|
738 |
water_text = f"๐ง **ๆฐด - R&D ์คํ์
๋ฆฌ์คํธ** (ๆบ)\n{water_response}"
|
739 |
+
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, "", "๐ง ํ์ ์ฐ๊ตฌ ์ค..."
|
740 |
|
741 |
all_responses['water'] = water_response
|
742 |
|
743 |
# 10. ๆฐด ๋นํ
|
744 |
+
critic_search = {}
|
745 |
+
results = wuxing_system.brave_search(f"{user_query} future trends")
|
746 |
+
if results:
|
747 |
+
critic_search["trends"] = results
|
748 |
+
all_search_results["๋นํ5-trends"] = results
|
749 |
+
|
750 |
+
critic_prompt = wuxing_system.create_critic_prompt("ๆฐด R&D", water_response, metal_response, critic_search)
|
751 |
critic_response = ""
|
752 |
|
753 |
for chunk in wuxing_system.call_llm_streaming(
|
754 |
[{"role": "user", "content": critic_prompt}], "critic"
|
755 |
):
|
756 |
critic_response += chunk
|
757 |
+
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, "", "๐ R&D ๋นํ ์ค..."
|
758 |
|
759 |
all_critics.append(critic_response)
|
760 |
|
|
|
769 |
wood_final_response += chunk
|
770 |
temp_text = all_responses['wood_initial'] + f"\n\n---\n\n๐ณ **์ต์ข
์ข
ํฉ ๋ณด๊ณ ์**\n{wood_final_response}"
|
771 |
wood_text = f"๐ณ **ๆจ - ๊ฐ๋
๊ด** (ไป)\n{temp_text}"
|
772 |
+
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, "", "๐ณ ์ต์ข
๋ณด๊ณ ์ ์์ฑ ์ค..."
|
773 |
|
774 |
+
# ์ต์ข
๋ณด๊ณ ์ ์์ฑ
|
775 |
+
final_report = f"""# ๐ ์คํ ํ๋ ฅ ์์คํ
์ต์ข
์ข
ํฉ ๋ณด๊ณ ์
|
776 |
+
|
777 |
+
## ๐ ์ฌ์ฉ์ ์ง๋ฌธ
|
778 |
+
> **{user_query}**
|
779 |
+
|
780 |
+
---
|
781 |
+
|
782 |
+
## ๐ณ ํ์ฅ ์ต์ข
์ข
ํฉ (ๆจ - ไป)
|
783 |
+
|
784 |
+
{wood_final_response}
|
785 |
+
|
786 |
+
---
|
787 |
+
|
788 |
+
## ๐ ์คํ ํ์ ๊ธฐ์ฌ ์์ฝ
|
789 |
+
|
790 |
+
### ๐ฅ ์ ๋ตยท๊ธฐํ (็ซ - ็พฉ)
|
791 |
+
{fire_response[:500]}...
|
792 |
+
|
793 |
+
### ๐๏ธ ์คํยท์ด์ (ๅ - ไฟก)
|
794 |
+
{earth_response[:500]}...
|
795 |
+
|
796 |
+
### โ๏ธ ์ํคํ
์ฒ (้ - ็ฆฎ)
|
797 |
+
{metal_response[:500]}...
|
798 |
+
|
799 |
+
### ๐ง R&D ํ์ (ๆฐด - ๆบ)
|
800 |
+
{water_response[:500]}...
|
801 |
+
|
802 |
+
---
|
803 |
+
|
804 |
+
## ๐ ์ค๋ฆฝ์ ๋นํ ํต์ฌ ํต์ฐฐ
|
805 |
+
|
806 |
+
### ์ฃผ์ ๊ฐ์ ์ฌํญ
|
807 |
+
{all_critics[-1][:400]}...
|
808 |
+
|
809 |
+
---
|
810 |
+
|
811 |
+
## ๐ ์ฑ๊ณผ ์งํ
|
812 |
+
|
813 |
+
| ํญ๋ชฉ | ๋ด์ฉ |
|
814 |
+
|------|------|
|
815 |
+
| **์น ๊ฒ์ ์ํ** | {len(all_search_results)}๊ฐ ํค์๋ |
|
816 |
+
| **์์ง ์ ๋ณด๋** | {sum(len(r) for r in all_search_results.values())}๊ฐ ๊ฒฐ๊ณผ |
|
817 |
+
| **ํ๋ ฅ ๋จ๊ณ** | 11๋จ๊ณ (5์ธ + 5๋นํ + ์ข
ํฉ) |
|
818 |
+
| **์ฌ์ฉ ๋ชจ๋ธ** | {'Gemini 2.5 Pro' if wuxing_system.use_gemini else '๊ธฐ๋ณธ LLM'} |
|
819 |
+
|
820 |
+
---
|
821 |
+
|
822 |
+
## ๐ฏ ํต์ฌ ์ฑ๊ณต ์์ธ
|
823 |
+
|
824 |
+
1. **์กฐํ๋ก์ด ํ๋ ฅ**: ์คํ์ ์์ ๊ด๊ณ๋ฅผ ํตํ ์๋์ง ์ฐฝ์ถ
|
825 |
+
2. **๋ค๊ฐ์ ๊ฒํ **: 5๊ฐ์ง ์ ๋ฌธ์ฑ๊ณผ ์ค๋ฆฝ์ ๋นํ์ ๊ท ํ
|
826 |
+
3. **๋ฐ์ดํฐ ๊ธฐ๋ฐ**: {len(all_search_results)}ํ์ ์น ๊ฒ์์ ํตํ ์ต์ ์ ๋ณด ๋ฐ์
|
827 |
+
4. **์คํ ๊ฐ๋ฅ์ฑ**: ๊ตฌ์ฒด์ ์ด๊ณ ๋จ๊ณ๋ณ ์ ๊ทผ ๋ฐฉ์ ์ ์
|
828 |
+
|
829 |
+
---
|
830 |
+
|
831 |
+
*์์ฑ ์๊ฐ: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}*
|
832 |
+
*์คํ ํ๋ ฅ ์์คํ
- ไป็พฉ็ฆฎๆบไฟก์ ์กฐํ*"""
|
833 |
+
|
834 |
+
status_text = f"โ
์คํ ํ๋ ฅ ํ๋ก์ธ์ค ์๋ฃ! ({len(all_search_results)} ํค์๋, {sum(len(r) for r in all_search_results.values())} ๊ฒ์๊ฒฐ๊ณผ)"
|
835 |
+
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, final_report, status_text
|
836 |
|
837 |
except Exception as e:
|
838 |
error_msg = f"โ ์ฒ๋ฆฌ ์ค ์ค๋ฅ: {str(e)}"
|
839 |
+
yield "", "", "", "", "", "", "", error_msg
|
840 |
|
841 |
def clear_wuxing():
|
842 |
"""์ด๊ธฐํ"""
|
843 |
+
return "", "", "", "", "", "", "", "๐ ์ด๊ธฐํ๋์์ต๋๋ค."
|
844 |
|
845 |
# CSS ์คํ์ผ
|
846 |
css = """
|
|
|
871 |
border-left: 4px solid #6b7280 !important;
|
872 |
background-color: #f9fafb !important;
|
873 |
}
|
874 |
+
.final-report-box {
|
875 |
+
border: 2px solid #10b981 !important;
|
876 |
+
border-radius: 8px !important;
|
877 |
+
padding: 20px !important;
|
878 |
+
background: linear-gradient(to bottom, #f0fdf4, #ffffff) !important;
|
879 |
+
margin-top: 10px !important;
|
880 |
+
font-size: 14px !important;
|
881 |
+
max-height: 800px !important;
|
882 |
+
overflow-y: auto !important;
|
883 |
+
line-height: 1.8 !important;
|
884 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
|
885 |
+
}
|
886 |
+
.final-report-box h1 {
|
887 |
+
color: #065f46 !important;
|
888 |
+
font-size: 28px !important;
|
889 |
+
margin-bottom: 16px !important;
|
890 |
+
text-align: center !important;
|
891 |
+
font-weight: bold !important;
|
892 |
+
}
|
893 |
+
.final-report-box h2 {
|
894 |
+
color: #047857 !important;
|
895 |
+
font-size: 22px !important;
|
896 |
+
margin-top: 20px !important;
|
897 |
+
margin-bottom: 12px !important;
|
898 |
+
border-bottom: 2px solid #10b981 !important;
|
899 |
+
padding-bottom: 8px !important;
|
900 |
+
}
|
901 |
+
.final-report-box h3 {
|
902 |
+
color: #059669 !important;
|
903 |
+
font-size: 18px !important;
|
904 |
+
margin-top: 16px !important;
|
905 |
+
margin-bottom: 10px !important;
|
906 |
+
font-weight: 600 !important;
|
907 |
+
}
|
908 |
+
.final-report-box h4 {
|
909 |
+
color: #10b981 !important;
|
910 |
+
font-size: 16px !important;
|
911 |
+
margin-top: 12px !important;
|
912 |
+
margin-bottom: 8px !important;
|
913 |
+
}
|
914 |
+
.final-report-box table {
|
915 |
+
border-collapse: collapse !important;
|
916 |
+
width: 100% !important;
|
917 |
+
margin: 20px 0 !important;
|
918 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
|
919 |
+
}
|
920 |
+
.final-report-box th, .final-report-box td {
|
921 |
+
border: 1px solid #d1d5db !important;
|
922 |
+
padding: 12px 14px !important;
|
923 |
+
text-align: left !important;
|
924 |
+
}
|
925 |
+
.final-report-box th {
|
926 |
+
background-color: #065f46 !important;
|
927 |
+
font-weight: bold !important;
|
928 |
+
color: #ffffff !important;
|
929 |
+
text-transform: uppercase !important;
|
930 |
+
font-size: 13px !important;
|
931 |
+
letter-spacing: 0.5px !important;
|
932 |
+
}
|
933 |
+
.final-report-box tr:nth-child(even) {
|
934 |
+
background-color: #f9fafb !important;
|
935 |
+
}
|
936 |
+
.final-report-box tr:hover {
|
937 |
+
background-color: #f0fdf4 !important;
|
938 |
+
transition: background-color 0.2s !important;
|
939 |
+
}
|
940 |
+
.final-report-box code {
|
941 |
+
background-color: #ecfdf5 !important;
|
942 |
+
padding: 3px 8px !important;
|
943 |
+
border-radius: 4px !important;
|
944 |
+
font-family: 'Consolas', 'Monaco', monospace !important;
|
945 |
+
color: #047857 !important;
|
946 |
+
font-size: 13px !important;
|
947 |
+
border: 1px solid #10b981 !important;
|
948 |
+
}
|
949 |
+
.final-report-box pre {
|
950 |
+
background-color: #1e293b !important;
|
951 |
+
color: #e2e8f0 !important;
|
952 |
+
padding: 16px !important;
|
953 |
+
border-radius: 8px !important;
|
954 |
+
overflow-x: auto !important;
|
955 |
+
margin: 16px 0 !important;
|
956 |
+
font-size: 13px !important;
|
957 |
+
line-height: 1.5 !important;
|
958 |
+
}
|
959 |
+
.final-report-box pre code {
|
960 |
+
background-color: transparent !important;
|
961 |
+
color: #e2e8f0 !important;
|
962 |
+
padding: 0 !important;
|
963 |
+
border: none !important;
|
964 |
+
}
|
965 |
+
.final-report-box blockquote {
|
966 |
+
border-left: 4px solid #10b981 !important;
|
967 |
+
padding-left: 16px !important;
|
968 |
+
margin: 16px 0 !important;
|
969 |
+
color: #064e3b !important;
|
970 |
+
font-style: italic !important;
|
971 |
+
background-color: #f0fdf4 !important;
|
972 |
+
padding: 14px 16px !important;
|
973 |
+
border-radius: 0 8px 8px 0 !important;
|
974 |
+
}
|
975 |
+
.final-report-box ul, .final-report-box ol {
|
976 |
+
margin-left: 24px !important;
|
977 |
+
margin-bottom: 16px !important;
|
978 |
+
}
|
979 |
+
.final-report-box li {
|
980 |
+
margin-bottom: 8px !important;
|
981 |
+
line-height: 1.8 !important;
|
982 |
+
}
|
983 |
+
.final-report-box strong {
|
984 |
+
color: #065f46 !important;
|
985 |
+
font-weight: 600 !important;
|
986 |
+
}
|
987 |
+
.final-report-box em {
|
988 |
+
color: #047857 !important;
|
989 |
+
}
|
990 |
+
.final-report-box hr {
|
991 |
+
border: none !important;
|
992 |
+
border-top: 2px solid #10b981 !important;
|
993 |
+
margin: 28px 0 !important;
|
994 |
+
}
|
995 |
+
.final-report-box a {
|
996 |
+
color: #059669 !important;
|
997 |
+
text-decoration: underline !important;
|
998 |
+
}
|
999 |
+
.final-report-box a:hover {
|
1000 |
+
color: #047857 !important;
|
1001 |
+
}
|
1002 |
h1 {
|
1003 |
text-align: center;
|
1004 |
color: #1f2937;
|
|
|
1051 |
lines=3
|
1052 |
)
|
1053 |
|
1054 |
+
# ์ต์ข
๋ณด๊ณ ์ ์น์
|
1055 |
+
with gr.Row():
|
1056 |
+
with gr.Column():
|
1057 |
+
gr.Markdown("### ๐ ์ต์ข
์ข
ํฉ ๋ณด๊ณ ์")
|
1058 |
+
final_report = gr.Markdown(
|
1059 |
+
value="*์ต์ข
๋ณด๊ณ ์๊ฐ ์ฌ๊ธฐ์ ํ์๋ฉ๋๋ค.*",
|
1060 |
+
elem_classes=["final-report-box"]
|
1061 |
+
)
|
1062 |
+
|
1063 |
# ์คํ ์ถ๋ ฅ - 2x3 ๊ทธ๋ฆฌ๋
|
1064 |
with gr.Row():
|
1065 |
with gr.Column():
|
|
|
1141 |
submit_btn.click(
|
1142 |
fn=process_wuxing_query,
|
1143 |
inputs=[user_input, llm_mode],
|
1144 |
+
outputs=[wood_output, fire_output, earth_output, metal_output, water_output, critic_output, final_report, status_text]
|
1145 |
).then(
|
1146 |
fn=lambda: "",
|
1147 |
outputs=[user_input]
|
|
|
1150 |
user_input.submit(
|
1151 |
fn=process_wuxing_query,
|
1152 |
inputs=[user_input, llm_mode],
|
1153 |
+
outputs=[wood_output, fire_output, earth_output, metal_output, water_output, critic_output, final_report, status_text]
|
1154 |
).then(
|
1155 |
fn=lambda: "",
|
1156 |
outputs=[user_input]
|
|
|
1158 |
|
1159 |
clear_btn.click(
|
1160 |
fn=clear_wuxing,
|
1161 |
+
outputs=[wood_output, fire_output, earth_output, metal_output, water_output, critic_output, final_report, status_text]
|
1162 |
)
|
1163 |
|
1164 |
if __name__ == "__main__":
|