SOMA-Oriental / app-BACKUP3.py
aiqtech's picture
Rename app.py to app-BACKUP3.py
8fcd4d1 verified
raw
history blame
58 kB
import gradio as gr
import os
import json
import requests
from datetime import datetime
import time
from typing import List, Dict, Any, Generator, Tuple
import logging
import re
# ๋กœ๊น… ์„ค์ •
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# ์ถ”๊ฐ€ ์ž„ํฌํŠธ
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import urllib.request
# Gemini API ์ž„ํฌํŠธ
try:
from google import genai
from google.genai import types
GEMINI_AVAILABLE = True
except ImportError:
GEMINI_AVAILABLE = False
logger.warning("Google Gemini API๊ฐ€ ์„ค์น˜๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. pip install google-genai๋กœ ์„ค์น˜ํ•˜์„ธ์š”.")
# ํ™˜๊ฒฝ ๋ณ€์ˆ˜์—์„œ ํ† ํฐ ๊ฐ€์ ธ์˜ค๊ธฐ
FRIENDLI_TOKEN = os.getenv("FRIENDLI_TOKEN", "YOUR_FRIENDLI_TOKEN")
BAPI_TOKEN = os.getenv("BAPI_TOKEN", "YOUR_BRAVE_API_TOKEN")
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY", "YOUR_GEMINI_API_KEY")
API_URL = "https://api.friendli.ai/dedicated/v1/chat/completions"
BRAVE_SEARCH_URL = "https://api.search.brave.com/res/v1/web/search"
MODEL_ID = "dep89a2fld32mcm"
TEST_MODE = os.getenv("TEST_MODE", "false").lower() == "true"
# ์ „์—ญ ๋ณ€์ˆ˜
conversation_history = []
class WuxingLLMSystem:
"""์˜คํ–‰ยท์˜ค์ƒ ๊ธฐ๋ฐ˜ AGI๊ธ‰ ํ˜‘๋ ฅ์  ๋ณด๊ณ ์„œ ์ž‘์„ฑ ์‹œ์Šคํ…œ"""
def __init__(self):
self.token = FRIENDLI_TOKEN
self.bapi_token = BAPI_TOKEN
self.gemini_api_key = GEMINI_API_KEY
self.api_url = API_URL
self.brave_url = BRAVE_SEARCH_URL
self.model_id = MODEL_ID
self.test_mode = TEST_MODE or (self.token == "YOUR_FRIENDLI_TOKEN")
self.use_gemini = False
self.gemini_client = None
# ์˜คํ–‰ ์—ญํ•  ์ •์˜ - AGI ์ˆ˜์ค€ ์ „๋ฌธ๊ฐ€ ํŒ€
self.wuxing_roles = {
"wood": {
"name": "์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž (Chief Vision Officer)",
"virtue": "ไป",
"element": "ๆœจ",
"traits": "ํ†ต์ฐฐ๋ ฅ, ๋ฏธ๋ž˜์˜ˆ์ธก, ํฌ์šฉ์  ๋ฆฌ๋”์‹ญ",
"expertise": "๊ฑฐ์‹œ์  ๋น„์ „, ์‹œ์Šคํ…œ์  ์‚ฌ๊ณ , ํ˜์‹  ์ „๋žต, ์กฐ์ง ๋ฌธํ™” ์„ค๊ณ„",
"color": "#10b981"
},
"fire": {
"name": "ํ˜์‹  ์ „๋žต ์•„ํ‚คํ…ํŠธ (Innovation Strategy Architect)",
"virtue": "็พฉ",
"element": "็ซ",
"traits": "ํŒŒ๊ดด์  ํ˜์‹ , ์ „๋žต์  ์ง๊ด€, ๋ฆฌ์Šคํฌ ํ…Œ์ดํ‚น",
"expertise": "๋น„์ฆˆ๋‹ˆ์Šค ๋ชจ๋ธ ํ˜์‹ , ์‹œ์žฅ ํŒŒ๊ดด ์ „๋žต, ๊ฒฝ์Ÿ์šฐ์œ„ ์„ค๊ณ„",
"color": "#ef4444"
},
"metal": {
"name": "์‹œ์Šคํ…œ ์•„ํ‚คํ…์ฒ˜ ๋งˆ์Šคํ„ฐ (Systems Architecture Master)",
"virtue": "็ฆฎ",
"element": "้‡‘",
"traits": "์ •๋ฐ€์„ฑ, ์™„๋ฒฝ์ฃผ์˜, ์‹œ์Šคํ…œ ํ†ตํ•ฉ๋ ฅ",
"expertise": "์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ์•„ํ‚คํ…์ฒ˜, ๊ธฐ์ˆ  ๊ฑฐ๋ฒ„๋„Œ์Šค, ํ‘œ์ค€ํ™” ์ „๋žต",
"color": "#f59e0b"
},
"water": {
"name": "๋ฏธ๋ž˜๊ธฐ์ˆ  ์—ฐ๊ตฌ์†Œ์žฅ (Future Tech Research Director)",
"virtue": "ๆ™บ",
"element": "ๆฐด",
"traits": "๊นŠ์€ ๋ถ„์„๋ ฅ, ๊ธฐ์ˆ  ํ†ต์ฐฐ, ํ˜์‹ ์  ์‚ฌ๊ณ ",
"expertise": "์‹ ๊ธฐ์ˆ  R&D, ๊ธฐ์ˆ  ์œตํ•ฉ, AI/ML, ํ€€ํ…€ ์ปดํ“จํŒ…",
"color": "#3b82f6"
},
"earth": {
"name": "์‹คํ–‰ ์ตœ์ ํ™” ์ „๋ฌธ๊ฐ€ (Execution Excellence Expert)",
"virtue": "ไฟก",
"element": "ๅœŸ",
"traits": "์ฒด๊ณ„์„ฑ, ์‹ ๋ขฐ์„ฑ, ์‹คํ–‰ ์™„๋ฒฝ์„ฑ",
"expertise": "ํ”„๋กœ์ ํŠธ ๊ฑฐ๋ฒ„๋„Œ์Šค, ํ’ˆ์งˆ ์‹œ์Šคํ…œ, ๋ฆฌ์Šคํฌ ๊ด€๋ฆฌ, ROI ์ตœ์ ํ™”",
"color": "#a855f7"
}
}
if self.test_mode:
logger.warning("ํ…Œ์ŠคํŠธ ๋ชจ๋“œ๋กœ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.")
def set_llm_mode(self, mode: str):
"""LLM ๋ชจ๋“œ ์„ค์ •"""
if mode == "commercial" and GEMINI_AVAILABLE and self.gemini_api_key != "YOUR_GEMINI_API_KEY":
self.use_gemini = True
if not self.gemini_client:
self.gemini_client = genai.Client(api_key=self.gemini_api_key)
logger.info("Gemini 2.5 Pro ๋ชจ๋“œ๋กœ ์ „ํ™˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค.")
else:
self.use_gemini = False
logger.info("๊ธฐ๋ณธ LLM ๋ชจ๋“œ๋กœ ์ „ํ™˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค.")
def create_headers(self):
"""API ํ—ค๋” ์ƒ์„ฑ"""
return {
"Authorization": f"Bearer {self.token}",
"Content-Type": "application/json"
}
def create_brave_headers(self):
"""Brave API ํ—ค๋” ์ƒ์„ฑ"""
return {
"Accept": "application/json",
"Accept-Encoding": "gzip",
"X-Subscription-Token": self.bapi_token
}
def create_wood_initial_prompt(self, user_query: str, search_results: Dict = None) -> str:
"""ๆœจ(์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž) ์ดˆ๊ธฐ ํ”„๋กฌํ”„ํŠธ"""
search_info = ""
if search_results:
search_info = "\n\n์›น ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ:\n" + self._format_search_results(search_results)
return f"""๋‹น์‹ ์€ AGI ์ˆ˜์ค€์˜ ์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž(Chief Vision Officer)์ž…๋‹ˆ๋‹ค.
ไป(์ธ์žํ•จ)์˜ ๋•๋ชฉ์œผ๋กœ ๋ฏธ๋ž˜๋ฅผ ์˜ˆ์ธกํ•˜๊ณ  ํ˜์‹ ์  ๋น„์ „์„ ์ œ์‹œํ•ฉ๋‹ˆ๋‹ค.
[์‚ฌ์šฉ์ž ์š”์ฒญ์‚ฌํ•ญ]
{user_query}
[์ฐธ๊ณ  ์ž๋ฃŒ]
{search_info}
[์ž„๋ฌด] ๋‹ค์Œ ๊ด€์ ์—์„œ ์ข…ํ•ฉ์ ์ด๊ณ  ํ˜์‹ ์ ์ธ ๋น„์ „์„ ์ œ์‹œํ•˜์„ธ์š”:
1. **๊ฑฐ์‹œ์  ๋น„์ „๊ณผ ํŒจ๋Ÿฌ๋‹ค์ž„ ์ „ํ™˜**
- 10๋…„ ํ›„ ๋ฏธ๋ž˜ ์‹œ๋‚˜๋ฆฌ์˜ค์™€ ๋ฉ”๊ฐ€ํŠธ๋ Œ๋“œ ๋ถ„์„
- ํŒจ๋Ÿฌ๋‹ค์ž„ ์‹œํ”„ํŠธ์™€ ๊ฒŒ์ž„์ฒด์ธ์ € ์š”์†Œ ์‹๋ณ„
- ๊ธ€๋กœ๋ฒŒ ๋งฅ๋ฝ์—์„œ์˜ ์ „๋žต์  ํฌ์ง€์…”๋‹
2. **์‹œ์Šคํ…œ์  ์‚ฌ๊ณ ์™€ ๋ณต์žก๊ณ„ ๋ถ„์„**
- ๋‹ค์ฐจ์›์  ์ƒํ˜ธ์ž‘์šฉ๊ณผ ํ”ผ๋“œ๋ฐฑ ๋ฃจํ”„ ์„ค๊ณ„
- ์ฐฝ๋ฐœ์  ์†์„ฑ๊ณผ ๋„คํŠธ์›Œํฌ ํšจ๊ณผ ์˜ˆ์ธก
- ์ƒํƒœ๊ณ„ ๊ด€์ ์˜ ๊ฐ€์น˜ ์ฐฝ์ถœ ๋ชจ๋ธ
3. **ํ˜์‹  ํ”„๋ ˆ์ž„์›Œํฌ์™€ ์ „๋žต์  ๋ฐฉํ–ฅ์„ฑ**
- ๋ธ”๋ฃจ์˜ค์…˜ ์ „๋žต๊ณผ ์นดํ…Œ๊ณ ๋ฆฌ ๋””์ž์ธ
- ์ง€์ˆ˜์  ์„ฑ์žฅ์„ ์œ„ํ•œ ํ”Œ๋ผ์ดํœ  ์„ค๊ณ„
- ์•ˆํ‹ฐํ”„๋ž˜์งˆํ•œ ์‹œ์Šคํ…œ ๊ตฌ์ถ• ๋ฐฉ์•ˆ
4. **ํŒ€ ์‹œ๋„ˆ์ง€์™€ ์ง‘๋‹จ์ง€์„ฑ ํ™œ์šฉ ์ „๋žต**
- ็ซ(ํ˜์‹  ์ „๋žต): ํŒŒ๊ดด์  ํ˜์‹ ๊ณผ ๋น„์ฆˆ๋‹ˆ์Šค ๋ชจ๋ธ ์žฌ์ •์˜
- ๅœŸ(์‹คํ–‰ ์ตœ์ ํ™”): ์• ์ž์ผ ์‹คํ–‰๊ณผ ์ง€์†์  ๊ฐœ์„  ์ฒด๊ณ„
- ้‡‘(์‹œ์Šคํ…œ ์•„ํ‚คํ…์ฒ˜): ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ๊ธฐ์ˆ  ์ธํ”„๋ผ์™€ ํ‘œ์ค€ํ™”
- ๆฐด(๋ฏธ๋ž˜๊ธฐ์ˆ  R&D): ์‹ ๊ธฐ์ˆ  ์œตํ•ฉ๊ณผ ํ˜์‹ ์  ํ”„๋กœํ† ํƒ€์ดํ•‘
5. **ํ•ต์‹ฌ ์„ฑ๊ณต ์ง€ํ‘œ(KPI)์™€ ๋ถ๊ทน์„ฑ ์ง€ํ‘œ(North Star Metric)**
- ์žฅ๊ธฐ์  ์ž„ํŒฉํŠธ ์ธก์ • ํ”„๋ ˆ์ž„์›Œํฌ
- ์„ ํ–‰์ง€ํ‘œ์™€ ํ›„ํ–‰์ง€ํ‘œ์˜ ๊ท ํ˜•์žกํžŒ ์„ค๊ณ„
[๊ฒ€์ƒ‰ ํ‚ค์›Œ๋“œ ์ œ์•ˆ]: ๋ฏธ๋ž˜ ์—ฐ๊ตฌ์— ํ•„์š”ํ•œ 7-10๊ฐœ์˜ ์ „๋žต์  ํ‚ค์›Œ๋“œ๋ฅผ ์ œ์‹œํ•˜์„ธ์š”"""
def create_fire_strategy_prompt(self, user_query: str, wood_response: str, critic_feedback: str, search_results: Dict = None) -> str:
"""็ซ(ํ˜์‹  ์ „๋žต ์•„ํ‚คํ…ํŠธ) ํ”„๋กฌํ”„ํŠธ"""
search_info = ""
if search_results:
search_info = "\n\n์›น ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ:\n" + self._format_search_results(search_results)
return f"""๋‹น์‹ ์€ AGI ์ˆ˜์ค€์˜ ํ˜์‹  ์ „๋žต ์•„ํ‚คํ…ํŠธ(Innovation Strategy Architect)์ž…๋‹ˆ๋‹ค.
็พฉ(์ •์˜๋กœ์›€)์˜ ๋•๋ชฉ์œผ๋กœ ํŒŒ๊ดด์  ํ˜์‹ ๊ณผ ๊ฒŒ์ž„์ฒด์ธ์ง• ์ „๋žต์„ ์„ค๊ณ„ํ•ฉ๋‹ˆ๋‹ค.
[์‚ฌ์šฉ์ž ์š”์ฒญ์‚ฌํ•ญ]
{user_query}
[์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž์˜ ํ”„๋ ˆ์ž„์›Œํฌ]
{wood_response}
[์ „๋žต ๊ฒ€์ฆ ์ „๋ฌธ๊ฐ€์˜ ํ”ผ๋“œ๋ฐฑ]
{critic_feedback}
[์‹œ์žฅ ์กฐ์‚ฌ ๋ฐ์ดํ„ฐ]
{search_info}
[์ž„๋ฌด] ๋‹ค์Œ ๊ด€์ ์—์„œ ํ˜์‹ ์ ์ธ ์ „๋žต์„ ์ˆ˜๋ฆฝํ•˜์„ธ์š”:
1. **ํŒŒ๊ดด์  ํ˜์‹ ๊ณผ ๋ธ”๋ฃจ์˜ค์…˜ ์ „๋žต**
- ์‚ฐ์—… ์žฌ์ •์˜์™€ ์นดํ…Œ๊ณ ๋ฆฌ ์ฐฝ์ถœ
- ๊ฐ€์น˜ ํ˜์‹ ๊ณผ ์ฐจ๋ณ„ํ™” ์ „๋žต
- ๋„คํŠธ์›Œํฌ ํšจ๊ณผ์™€ ํ”Œ๋žซํผ ์ „๋žต
2. **๋น„์ฆˆ๋‹ˆ์Šค ๋ชจ๋ธ ํ˜์‹ **
- ์ˆ˜์ต ๋ชจ๋ธ ๋‹ค๊ฐํ™” (๊ตฌ๋…, ํ”„๋ฆฌ๋ฏธ์—„, ๋งˆ์ผ“ํ”Œ๋ ˆ์ด์Šค)
- ๊ฐ€์น˜์‚ฌ์Šฌ ์žฌ๊ตฌ์„ฑ๊ณผ ์ˆ˜์ง ํ†ตํ•ฉ
- ์ƒํƒœ๊ณ„ ๊ตฌ์ถ•๊ณผ ํŒŒํŠธ๋„ˆ์‹ญ ์ „๋žต
3. **๊ฒฝ์Ÿ์šฐ์œ„ ํ™•๋ณด ์ „๋žต**
- ํ•ต์‹ฌ ์—ญ๋Ÿ‰๊ณผ ์ฐจ๋ณ„ํ™” ์š”์†Œ
- ์ง„์ž…์žฅ๋ฒฝ ๊ตฌ์ถ• ๋ฉ”์ปค๋‹ˆ์ฆ˜
- ์ง€์†๊ฐ€๋Šฅํ•œ ๊ฒฝ์Ÿ์šฐ์œ„ ์›์ฒœ
4. **์„ฑ์žฅ ์ „๋žต๊ณผ ํ™•์žฅ ๊ณ„ํš**
- ์‹œ์žฅ ์นจํˆฌ์™€ ์‹œ์žฅ ๊ฐœ๋ฐœ ์ „๋žต
- ์ œํ’ˆ ๊ฐœ๋ฐœ๊ณผ ๋‹ค๊ฐํ™” ์ „๋žต
- M&A์™€ ์ „๋žต์  ์ œํœด ์˜ต์…˜
5. **๋ฆฌ์Šคํฌ ๊ด€๋ฆฌ์™€ ์‹œ๋‚˜๋ฆฌ์˜ค ํ”Œ๋ž˜๋‹**
- ์ „๋žต์  ๋ฆฌ์Šคํฌ ๋งคํŠธ๋ฆญ์Šค
- ๋Œ€์‘ ์‹œ๋‚˜๋ฆฌ์˜ค์™€ ์ปจํ‹ด์ „์‹œ ํ”Œ๋žœ
- ์•ˆํ‹ฐํ”„๋ž˜์งˆํ•œ ์ „๋žต ์„ค๊ณ„
[์ถ”๊ฐ€ ์—ฐ๊ตฌ ํ•„์š”]: ๊ฒฝ์Ÿ์‚ฌ ๋ถ„์„, ์‹œ์žฅ ๋™ํ–ฅ, ๊ทœ์ œ ํ™˜๊ฒฝ ๋“ฑ ์ถ”๊ฐ€ ์กฐ์‚ฌ๊ฐ€ ํ•„์š”ํ•œ ํ‚ค์›Œ๋“œ [์ถ”๊ฐ€ ๊ฒ€์ƒ‰]"""
def create_earth_execution_prompt(self, user_query: str, fire_response: str, critic_feedback: str, search_results: Dict = None) -> str:
"""ๅœŸ(์‹คํ–‰ ์ตœ์ ํ™” ์ „๋ฌธ๊ฐ€) ํ”„๋กฌํ”„ํŠธ"""
search_info = ""
if search_results:
search_info = "\n\n์›น ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ:\n" + self._format_search_results(search_results)
return f"""๋‹น์‹ ์€ AGI ์ˆ˜์ค€์˜ ์‹คํ–‰ ์ตœ์ ํ™” ์ „๋ฌธ๊ฐ€(Execution Excellence Expert)์ž…๋‹ˆ๋‹ค.
ไฟก(์‹ ๋ขฐ)์˜ ๋•๋ชฉ์œผ๋กœ ์™„๋ฒฝํ•œ ์‹คํ–‰ ์ฒด๊ณ„์™€ ํ’ˆ์งˆ ์‹œ์Šคํ…œ์„ ๊ตฌ์ถ•ํ•ฉ๋‹ˆ๋‹ค.
[์‚ฌ์šฉ์ž ์š”์ฒญ์‚ฌํ•ญ]
{user_query}
[ํ˜์‹  ์ „๋žต ์•„ํ‚คํ…ํŠธ์˜ ์ „๋žต]
{fire_response}
[์ „๋žต ๊ฒ€์ฆ ์ „๋ฌธ๊ฐ€์˜ ํ”ผ๋“œ๋ฐฑ]
{critic_feedback}
[์‹คํ–‰ ๊ด€๋ จ ๋ฒค์น˜๋งˆํฌ ๋ฐ์ดํ„ฐ]
{search_info}
[์ž„๋ฌด] ๋‹ค์Œ ๊ด€์ ์—์„œ ์ตœ์ ํ™”๋œ ์‹คํ–‰ ๊ณ„ํš์„ ์ˆ˜๋ฆฝํ•˜์„ธ์š”:
1. **ํ”„๋กœ์ ํŠธ ๊ฑฐ๋ฒ„๋„Œ์Šค์™€ PMO ์ฒด๊ณ„**
- ์• ์ž์ผ/์›Œํ„ฐํด ํ•˜์ด๋ธŒ๋ฆฌ๋“œ ๋ฐฉ๋ฒ•๋ก 
- RACI ๋งคํŠธ๋ฆญ์Šค์™€ ์˜์‚ฌ๊ฒฐ์ • ๊ตฌ์กฐ
- ํ”„๋กœ์ ํŠธ ํฌํŠธํด๋ฆฌ์˜ค ๊ด€๋ฆฌ
2. **๋‹จ๊ณ„๋ณ„ ์‹คํ–‰ ๋กœ๋“œ๋งต**
- ์›Œํฌ ๋ธŒ๋ ˆ์ดํฌ๋‹ค์šด ์ŠคํŠธ๋Ÿญ์ฒ˜(WBS)
- ํฌ๋ฆฌํ‹ฐ์ปฌ ํŒจ์Šค์™€ ๋งˆ์ผ์Šคํ†ค
- ์Šคํ”„๋ฆฐํŠธ ๊ณ„ํš๊ณผ ๋ฐฑ๋กœ๊ทธ ๊ด€๋ฆฌ
3. **๋ฆฌ์†Œ์Šค ์ตœ์ ํ™”์™€ ์˜ˆ์‚ฐ ๊ด€๋ฆฌ**
- ์ธ๋ ฅ ๋ฐฐ์น˜์™€ ์Šคํ‚ฌ ๋งคํŠธ๋ฆญ์Šค
- TCO ๋ถ„์„๊ณผ ์˜ˆ์‚ฐ ๋ฐฐ๋ถ„
- ๋น„์šฉ ์ตœ์ ํ™” ์ „๋žต
4. **ํ’ˆ์งˆ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ**
- ISO 9001/27001 ๊ธฐ๋ฐ˜ ํ’ˆ์งˆ ์ฒด๊ณ„
- KPI/OKR ํ”„๋ ˆ์ž„์›Œํฌ
- ์ง€์†์  ๊ฐœ์„ (Kaizen) ๋ฉ”์ปค๋‹ˆ์ฆ˜
5. **๋ฆฌ์Šคํฌ ๊ด€๋ฆฌ์™€ ๋ณ€ํ™” ๊ด€๋ฆฌ**
- ๋ฆฌ์Šคํฌ ๋ ˆ์ง€์Šคํ„ฐ์™€ ์™„ํ™” ์ „๋žต
- ๋ณ€ํ™” ๊ด€๋ฆฌ 8๋‹จ๊ณ„ ํ”„๋กœ์„ธ์Šค
- ์ดํ•ด๊ด€๊ณ„์ž ๊ด€๋ฆฌ ์ „๋žต
6. **์„ฑ๊ณผ ์ธก์ •๊ณผ ๋Œ€์‹œ๋ณด๋“œ**
- ์‹ค์‹œ๊ฐ„ ๋ชจ๋‹ˆํ„ฐ๋ง ์‹œ์Šคํ…œ
- ๊ท ํ˜•์„ฑ๊ณผํ‘œ(BSC) ์„ค๊ณ„
- ์˜ˆ์ธก ๋ถ„์„๊ณผ ์กฐ๊ธฐ ๊ฒฝ๋ณด ์‹œ์Šคํ…œ
[์ถ”๊ฐ€ ์กฐ์‚ฌ ํ•„์š”]: ์—…๊ณ„ ๋ฒ ์ŠคํŠธ ํ”„๋ž™ํ‹ฐ์Šค, ์‹คํ–‰ ๋„๊ตฌ, ํ’ˆ์งˆ ํ‘œ์ค€ ๋“ฑ [์ถ”๊ฐ€ ๊ฒ€์ƒ‰]"""
def create_metal_architecture_prompt(self, user_query: str, earth_response: str, critic_feedback: str, search_results: Dict = None) -> str:
"""้‡‘(์‹œ์Šคํ…œ ์•„ํ‚คํ…์ฒ˜ ๋งˆ์Šคํ„ฐ) ํ”„๋กฌํ”„ํŠธ"""
search_info = ""
if search_results:
search_info = "\n\n์›น ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ:\n" + self._format_search_results(search_results)
return f"""๋‹น์‹ ์€ AGI ์ˆ˜์ค€์˜ ์‹œ์Šคํ…œ ์•„ํ‚คํ…์ฒ˜ ๋งˆ์Šคํ„ฐ(Systems Architecture Master)์ž…๋‹ˆ๋‹ค.
็ฆฎ(์˜ˆ์˜ยท์งˆ์„œ)์˜ ๋•๋ชฉ์œผ๋กœ ์™„๋ฒฝํ•˜๊ณ  ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ์‹œ์Šคํ…œ์„ ์„ค๊ณ„ํ•ฉ๋‹ˆ๋‹ค.
[์‚ฌ์šฉ์ž ์š”์ฒญ์‚ฌํ•ญ]
{user_query}
[์‹คํ–‰ ์ตœ์ ํ™” ์ „๋ฌธ๊ฐ€์˜ ๊ณ„ํš]
{earth_response}
[์ „๋žต ๊ฒ€์ฆ ์ „๋ฌธ๊ฐ€์˜ ํ”ผ๋“œ๋ฐฑ]
{critic_feedback}
[๊ธฐ์ˆ  ์•„ํ‚คํ…์ฒ˜ ์ฐธ๊ณ  ์ž๋ฃŒ]
{search_info}
[์ž„๋ฌด] ๋‹ค์Œ ๊ด€์ ์—์„œ ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ๊ธ‰ ์•„ํ‚คํ…์ฒ˜๋ฅผ ์„ค๊ณ„ํ•˜์„ธ์š”:
1. **์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ์•„ํ‚คํ…์ฒ˜ ํ”„๋ ˆ์ž„์›Œํฌ**
- TOGAF/Zachman ๊ธฐ๋ฐ˜ ์„ค๊ณ„
- ๋น„์ฆˆ๋‹ˆ์Šค/์• ํ”Œ๋ฆฌ์ผ€์ด์…˜/๋ฐ์ดํ„ฐ/๊ธฐ์ˆ  ์•„ํ‚คํ…์ฒ˜
- ์•„ํ‚คํ…์ฒ˜ ๊ฑฐ๋ฒ„๋„Œ์Šค์™€ ์›์น™
2. **๊ธฐ์ˆ  ์Šคํƒ๊ณผ ํ”Œ๋žซํผ ์ „๋žต**
- ํด๋ผ์šฐ๋“œ ๋„ค์ดํ‹ฐ๋ธŒ ์•„ํ‚คํ…์ฒ˜ (AWS/Azure/GCP)
- ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค์™€ ์ปจํ…Œ์ด๋„ˆํ™”
- API ์šฐ์„  ์„ค๊ณ„์™€ ์ด๋ฒคํŠธ ๊ธฐ๋ฐ˜ ์•„ํ‚คํ…์ฒ˜
3. **๋ฐ์ดํ„ฐ ์•„ํ‚คํ…์ฒ˜์™€ ๊ฑฐ๋ฒ„๋„Œ์Šค**
- ๋ฐ์ดํ„ฐ ๋ ˆ์ดํฌํ•˜์šฐ์Šค ์„ค๊ณ„
- ๋งˆ์Šคํ„ฐ ๋ฐ์ดํ„ฐ ๊ด€๋ฆฌ(MDM)
- ๋ฐ์ดํ„ฐ ํ’ˆ์งˆ๊ณผ ๋ฆฌ๋‹ˆ์ง€ ๊ด€๋ฆฌ
4. **๋ณด์•ˆ ์•„ํ‚คํ…์ฒ˜์™€ ์ปดํ”Œ๋ผ์ด์–ธ์Šค**
- ์ œ๋กœ ํŠธ๋Ÿฌ์ŠคํŠธ ๋ณด์•ˆ ๋ชจ๋ธ
- IAM๊ณผ ์ ‘๊ทผ ์ œ์–ด ์ฒด๊ณ„
- GDPR/SOC2 ์ปดํ”Œ๋ผ์ด์–ธ์Šค
5. **ํ™•์žฅ์„ฑ๊ณผ ์„ฑ๋Šฅ ์ตœ์ ํ™”**
- ์ˆ˜ํ‰/์ˆ˜์ง ํ™•์žฅ ์ „๋žต
- ์บ์‹ฑ๊ณผ CDN ์ „๋žต
- ์„ฑ๋Šฅ ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ ํŠœ๋‹
6. **๊ธฐ์ˆ  ํ‘œ์ค€๊ณผ ๋ฒ ์ŠคํŠธ ํ”„๋ž™ํ‹ฐ์Šค**
- ์ฝ”๋”ฉ ํ‘œ์ค€๊ณผ ๋””์ž์ธ ํŒจํ„ด
- CI/CD ํŒŒ์ดํ”„๋ผ์ธ
- ๊ธฐ์ˆ  ๋ถ€์ฑ„ ๊ด€๋ฆฌ ์ „๋žต
[์ถ”๊ฐ€ ์กฐ์‚ฌ ํ•„์š”]: ์ตœ์‹  ๊ธฐ์ˆ  ํŠธ๋ Œ๋“œ, ์•„ํ‚คํ…์ฒ˜ ํŒจํ„ด, ๋ณด์•ˆ ํ‘œ์ค€ ๋“ฑ [์ถ”๊ฐ€ ๊ฒ€์ƒ‰]"""
def create_water_rd_prompt(self, user_query: str, metal_response: str, critic_feedback: str, search_results: Dict = None) -> str:
"""ๆฐด(๋ฏธ๋ž˜๊ธฐ์ˆ  ์—ฐ๊ตฌ์†Œ์žฅ) ํ”„๋กฌํ”„ํŠธ"""
search_info = ""
if search_results:
search_info = "\n\n์ตœ์‹  ๊ธฐ์ˆ  ์กฐ์‚ฌ ๊ฒฐ๊ณผ:\n" + self._format_search_results(search_results)
return f"""๋‹น์‹ ์€ AGI ์ˆ˜์ค€์˜ ๋ฏธ๋ž˜๊ธฐ์ˆ  ์—ฐ๊ตฌ์†Œ์žฅ(Future Tech Research Director)์ž…๋‹ˆ๋‹ค.
ๆ™บ(์ง€ํ˜œ)์˜ ๋•๋ชฉ์œผ๋กœ ์ตœ์ฒจ๋‹จ ๊ธฐ์ˆ ์„ ์—ฐ๊ตฌํ•˜๊ณ  ํ˜์‹ ์„ ์ฃผ๋„ํ•ฉ๋‹ˆ๋‹ค.
[์‚ฌ์šฉ์ž ์š”์ฒญ์‚ฌํ•ญ]
{user_query}
[์‹œ์Šคํ…œ ์•„ํ‚คํ…์ฒ˜ ๋งˆ์Šคํ„ฐ์˜ ์„ค๊ณ„]
{metal_response}
[์ „๋žต ๊ฒ€์ฆ ์ „๋ฌธ๊ฐ€์˜ ํ”ผ๋“œ๋ฐฑ]
{critic_feedback}
[๊ธ€๋กœ๋ฒŒ ๊ธฐ์ˆ  ํŠธ๋ Œ๋“œ ๋ถ„์„]
{search_info}
[์ž„๋ฌด] ๋‹ค์Œ ๊ด€์ ์—์„œ ๋ฏธ๋ž˜ ์ง€ํ–ฅ์  R&D ์ „๋žต์„ ์ˆ˜๋ฆฝํ•˜์„ธ์š”:
1. **์‹ ๊ธฐ์ˆ  ํŠธ๋ Œ๋“œ์™€ ๊ธฐ์ˆ  ์œตํ•ฉ**
- AI/ML/๋”ฅ๋Ÿฌ๋‹ ์ตœ์‹  ๋™ํ–ฅ
- ํ€€ํ…€ ์ปดํ“จํŒ…๊ณผ ์—ฃ์ง€ ์ปดํ“จํŒ…
- ๋ธ”๋ก์ฒด์ธ๊ณผ Web3 ๊ธฐ์ˆ 
- ๋ฉ”ํƒ€๋ฒ„์Šค์™€ XR ๊ธฐ์ˆ 
2. **ํ˜์‹ ์  ํ”„๋กœํ† ํƒ€์ดํ•‘ ์ „๋žต**
- MVP์™€ ๋น ๋ฅธ ์‹คํ—˜ ์ฃผ๊ธฐ
- A/B ํ…Œ์ŠคํŒ…๊ณผ ๋ฐ์ดํ„ฐ ๊ธฐ๋ฐ˜ ์˜์‚ฌ๊ฒฐ์ •
- ์˜คํ”ˆ ์ด๋…ธ๋ฒ ์ด์…˜๊ณผ ํ•ด์ปคํ†ค
3. **AI/ML ํ†ตํ•ฉ ์ „๋žต**
- LLM๊ณผ ์ƒ์„ฑํ˜• AI ํ™œ์šฉ
- MLOps์™€ ๋ชจ๋ธ ๊ฑฐ๋ฒ„๋„Œ์Šค
- ์„ค๋ช… ๊ฐ€๋Šฅํ•œ AI(XAI)
- ์œค๋ฆฌ์  AI ๊ฐ€์ด๋“œ๋ผ์ธ
4. **์ž๋™ํ™”์™€ ์ƒ์‚ฐ์„ฑ ํ˜์‹ **
- RPA์™€ ํ•˜์ดํผ์˜คํ† ๋ฉ”์ด์…˜
- Low-code/No-code ํ”Œ๋žซํผ
- DevOps์™€ GitOps
- ์ง€๋Šฅํ˜• ๋ชจ๋‹ˆํ„ฐ๋ง ์‹œ์Šคํ…œ
5. **๊ธฐ์ˆ  ROI์™€ ํ˜์‹  ํฌํŠธํด๋ฆฌ์˜ค**
- ๊ธฐ์ˆ  ํˆฌ์ž ์šฐ์„ ์ˆœ์œ„ ๋งคํŠธ๋ฆญ์Šค
- ํ˜์‹  ํšŒ๊ณ„์™€ ์„ฑ๊ณผ ์ธก์ •
- ๊ธฐ์ˆ  ํŒŒํŠธ๋„ˆ์‹ญ ์ „๋žต
6. **๋ฏธ๋ž˜ ์ค€๋น„๋„์™€ ๊ธฐ์ˆ  ๋กœ๋“œ๋งต**
- 3-5๋…„ ๊ธฐ์ˆ  ๋น„์ „
- ๊ธฐ์ˆ  ์—ญ๋Ÿ‰ ๊ฐœ๋ฐœ ๊ณ„ํš
- ๋””์ง€ํ„ธ ํŠธ๋žœ์Šคํฌ๋ฉ”์ด์…˜ ์„ฑ์ˆ™๋„
[์ถ”๊ฐ€ ์—ฐ๊ตฌ ํ•„์š”]: Gartner Hype Cycle, MIT Tech Review, ํŠนํ—ˆ ๋™ํ–ฅ ๋“ฑ [์ถ”๊ฐ€ ๊ฒ€์ƒ‰]"""
def create_wood_final_prompt(self, user_query: str, all_responses: Dict, all_critics: List) -> str:
"""ๆœจ(์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž) ์ตœ์ข… ์ข…ํ•ฉ ๋ณด๊ณ ์„œ ํ”„๋กฌํ”„ํŠธ"""
return f"""๋‹น์‹ ์€ AGI ์ˆ˜์ค€์˜ ์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž์ž…๋‹ˆ๋‹ค.
ํŒ€ ์ „์ฒด์˜ ์ง‘๋‹จ์ง€์„ฑ์„ ์ข…ํ•ฉํ•˜์—ฌ ์ตœ๊ณ  ์ˆ˜์ค€์˜ ์ „๋ฌธ ๋ณด๊ณ ์„œ๋ฅผ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.
[์‚ฌ์šฉ์ž ์š”์ฒญ์‚ฌํ•ญ]
{user_query}
[ํŒ€์› ๊ธฐ์—ฌ ๋‚ด์šฉ]
โ–ถ ็ซ(ํ˜์‹  ์ „๋žต ์•„ํ‚คํ…ํŠธ): {all_responses['fire']}
โ–ถ ๅœŸ(์‹คํ–‰ ์ตœ์ ํ™” ์ „๋ฌธ๊ฐ€): {all_responses['earth']}
โ–ถ ้‡‘(์‹œ์Šคํ…œ ์•„ํ‚คํ…์ฒ˜ ๋งˆ์Šคํ„ฐ): {all_responses['metal']}
โ–ถ ๆฐด(๋ฏธ๋ž˜๊ธฐ์ˆ  ์—ฐ๊ตฌ์†Œ์žฅ): {all_responses['water']}
[๋น„ํ‰์ž ํ†ต์ฐฐ]
{self._format_critic_history(all_critics)}
[์ตœ์ข… ์ข…ํ•ฉ ๋ณด๊ณ ์„œ ์ž‘์„ฑ ์ง€์นจ]
๋‹ค์Œ ๊ตฌ์กฐ๋กœ ์ตœ๊ณ  ์ˆ˜์ค€์˜ ์ „๋ฌธ ๋ณด๊ณ ์„œ๋ฅผ ์ž‘์„ฑํ•˜์„ธ์š”:
# EXECUTIVE SUMMARY
- ํ•ต์‹ฌ ๊ถŒ๊ณ ์‚ฌํ•ญ (3-5๊ฐœ ๋ถˆ๋ฆฟํฌ์ธํŠธ)
- ์˜ˆ์ƒ ์ž„ํŒฉํŠธ์™€ ROI
- ์ฆ‰์‹œ ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ Quick Wins
# 1. ์ „๋žต์  ๋ถ„์„๊ณผ ๋น„์ „
## 1.1 ํ˜„ํ™ฉ ์ง„๋‹จ๊ณผ ๊ธฐํšŒ ๋ถ„์„
- SWOT-TOWS ๋งคํŠธ๋ฆญ์Šค
- ํฌํ„ฐ์˜ 5 Forces + ๋””์ง€ํ„ธ ์ „ํ™˜ ์˜ํ–ฅ
- ๊ฐ€์น˜์‚ฌ์Šฌ ๋ถ„์„๊ณผ ์žฌ์ •์˜ ๊ธฐํšŒ
## 1.2 ๋ฏธ๋ž˜ ์‹œ๋‚˜๋ฆฌ์˜ค์™€ ์ „๋žต์  ์˜ต์…˜
- ์‹œ๋‚˜๋ฆฌ์˜ค ํ”Œ๋ž˜๋‹ (์ตœ์ /ํ˜„์‹ค์ /์ตœ์•…)
- ์ „๋žต์  ์˜ต์…˜๊ณผ ์˜์‚ฌ๊ฒฐ์ • ํŠธ๋ฆฌ
- ๋ฆฌ์Šคํฌ-๋ฆฌํ„ด ํ”„๋กœํŒŒ์ผ
# 2. ํ˜์‹  ์ „๋žต๊ณผ ์‹คํ–‰ ๋กœ๋“œ๋งต
## 2.1 ํ˜์‹  ํ”„๋ ˆ์ž„์›Œํฌ
- ํ˜์‹  ํฌํŠธํด๋ฆฌ์˜ค (Horizon 1-2-3)
- ๋””์ง€ํ„ธ ์ „ํ™˜ ์„ฑ์ˆ™๋„ ๋ชจ๋ธ
- ์˜คํ”ˆ ์ด๋…ธ๋ฒ ์ด์…˜ ์ „๋žต
## 2.2 ๋‹จ๊ณ„๋ณ„ ์‹คํ–‰ ๋กœ๋“œ๋งต
- Phase 1 (0-6๊ฐœ์›”): ๊ธฐ๋ฐ˜ ๊ตฌ์ถ•
- Phase 2 (6-18๊ฐœ์›”): ํ™•์žฅ๊ณผ ์ตœ์ ํ™”
- Phase 3 (18-36๊ฐœ์›”): ํ˜์‹ ๊ณผ ์„ฑ์žฅ
- ๊ฐ ๋‹จ๊ณ„๋ณ„ ๋งˆ์ผ์Šคํ†ค๊ณผ KPI
# 3. ๊ธฐ์ˆ  ์•„ํ‚คํ…์ฒ˜์™€ ์ธํ”„๋ผ
## 3.1 ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ์•„ํ‚คํ…์ฒ˜
- ํ˜„์žฌ ์ƒํƒœ(AS-IS)์™€ ๋ชฉํ‘œ ์ƒํƒœ(TO-BE)
- ๊ธฐ์ˆ  ์Šคํƒ๊ณผ ํ”Œ๋žซํผ ์ „๋žต
- ๋ฐ์ดํ„ฐ ๊ฑฐ๋ฒ„๋„Œ์Šค์™€ ๋ณด์•ˆ ์•„ํ‚คํ…์ฒ˜
## 3.2 ํ™•์žฅ์„ฑ๊ณผ ๋ฏธ๋ž˜ ๋Œ€์‘
- ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค์™€ ํด๋ผ์šฐ๋“œ ๋„ค์ดํ‹ฐ๋ธŒ
- AI/ML ํ†ตํ•ฉ ์ „๋žต
- ๊ธฐ์ˆ  ๋ถ€์ฑ„ ๊ด€๋ฆฌ์™€ ํ˜„๋Œ€ํ™” ๊ณ„ํš
# 4. ์‹คํ–‰ ๊ณ„ํš๊ณผ ๊ฑฐ๋ฒ„๋„Œ์Šค
## 4.1 ์กฐ์ง๊ณผ ๊ฑฐ๋ฒ„๋„Œ์Šค
- ๋ณ€ํ™”๊ด€๋ฆฌ ์ „๋žต
- ์• ์ž์ผ ๊ฑฐ๋ฒ„๋„Œ์Šค ๊ตฌ์กฐ
- ์—ญ๋Ÿ‰ ๊ฐœ๋ฐœ๊ณผ ์ธ์žฌ ํ™•๋ณด
## 4.2 ํˆฌ์ž์™€ ์žฌ๋ฌด ๋ถ„์„
- TCO์™€ ROI ๋ถ„์„
- ์ž๊ธˆ ์กฐ๋‹ฌ ์˜ต์…˜
- ์žฌ๋ฌด ๋ฆฌ์Šคํฌ ๊ด€๋ฆฌ
# 5. ์„ฑ๊ณผ ์ธก์ •๊ณผ ์ง€์†๊ฐ€๋Šฅ์„ฑ
## 5.1 ์„ฑ๊ณผ ์ธก์ • ํ”„๋ ˆ์ž„์›Œํฌ
- OKR๊ณผ ๊ท ํ˜•์„ฑ๊ณผํ‘œ(BSC)
- ์‹ค์‹œ๊ฐ„ ๋Œ€์‹œ๋ณด๋“œ ์„ค๊ณ„
- ์ง€์†์  ๊ฐœ์„  ๋ฉ”์ปค๋‹ˆ์ฆ˜
## 5.2 ์ง€์†๊ฐ€๋Šฅ์„ฑ๊ณผ ESG
- ESG ํ†ตํ•ฉ ์ „๋žต
- ์ˆœํ™˜๊ฒฝ์ œ ๋ชจ๋ธ
- ์‚ฌํšŒ์  ์ž„ํŒฉํŠธ ์ธก์ •
# APPENDIX
- ์ƒ์„ธ ๋ถ„์„ ์ž๋ฃŒ
- ๋ฒค์น˜๋งˆํ‚น ์‚ฌ๋ก€
- ์šฉ์–ด ์ •์˜์™€ ์ฐธ๊ณ ๋ฌธํ—Œ
**์ž‘์„ฑ ์›์น™:**
- ๋ฐ์ดํ„ฐ ๊ธฐ๋ฐ˜์˜ ๋…ผ๋ฆฌ์  ์ „๊ฐœ
- ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ ๊ตฌ์ฒด์  ๊ถŒ๊ณ ์•ˆ
- ์‹œ๊ฐ์  ์š”์†Œ ํ™œ์šฉ (ํ‘œ, ์ฐจํŠธ ์„ค๋ช…)
- ์ „๋ฌธ ์šฉ์–ด์™€ ์ผ๋ฐ˜ ์šฉ์–ด์˜ ๊ท ํ˜•
- ๊ธ€๋กœ๋ฒŒ ๋ฒ ์ŠคํŠธ ํ”„๋ž™ํ‹ฐ์Šค ๋ฐ˜์˜"""
def create_critic_prompt(self, stage: str, content: str, context: str = "", search_results: Dict = None) -> str:
"""AGI๊ธ‰ ์ค‘๋ฆฝ์  ๋น„ํ‰์ž ํ”„๋กฌํ”„ํŠธ"""
search_info = ""
if search_results:
search_info = f"\n\n์ฐธ๊ณ  ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ:\n{self._format_search_results(search_results)}"
context_section = ""
if context:
context_section = f"[์ด์ „ ๋งฅ๋ฝ]\n{context}\n"
return f"""๋‹น์‹ ์€ AGI ์ˆ˜์ค€์˜ ์ค‘๋ฆฝ์ ์ด๊ณ  ๋ถ„์„์ ์ธ ๋น„ํ‰ ์ „๋ฌธ๊ฐ€์ž…๋‹ˆ๋‹ค.
McKinsey, BCG, Bain ์ˆ˜์ค€์˜ ์ „๋žต์  ์‚ฌ๊ณ ์™€ ํ•™์ˆ ์  ์—„๋ฐ€์„ฑ์„ ๊ฐ–์ถ”๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
[ํ‰๊ฐ€ ๋Œ€์ƒ]
๋‹จ๊ณ„: {stage}
๋‚ด์šฉ: {content}
{context_section}{search_info}
[๋น„ํ‰ ํ”„๋ ˆ์ž„์›Œํฌ]
1. **์ „๋žต์  ํƒ€๋‹น์„ฑ ๊ฒ€์ฆ**
- ๋…ผ๋ฆฌ์  ์ผ๊ด€์„ฑ๊ณผ ์ธ๊ณผ๊ด€๊ณ„ ๋ถ„์„
- ๊ฐ€์ •(Assumptions)์˜ ํƒ€๋‹น์„ฑ ๊ฒ€ํ† 
- ๋ฐ˜์ฆ ๊ฐ€๋Šฅ์„ฑ๊ณผ ๋Œ€์•ˆ ์‹œ๋‚˜๋ฆฌ์˜ค
2. **์‹คํ–‰ ๊ฐ€๋Šฅ์„ฑ ํ‰๊ฐ€**
- ์ž์› ์š”๊ตฌ์‚ฌํ•ญ๊ณผ ์ œ์•ฝ์กฐ๊ฑด
- ๊ธฐ์ˆ ์ /์กฐ์ง์  ์‹คํ˜„ ๊ฐ€๋Šฅ์„ฑ
- ์‹œ๊ฐ„์ถ•๊ณผ ์˜์กด์„ฑ ๋ถ„์„
3. **ํ˜์‹ ์„ฑ๊ณผ ์ฐจ๋ณ„ํ™”**
- ์—…๊ณ„ ๋ฒ ์ŠคํŠธ ํ”„๋ž™ํ‹ฐ์Šค ๋Œ€๋น„ ํ˜์‹ ์„ฑ
- ๊ฒฝ์Ÿ์šฐ์œ„ ์ฐฝ์ถœ ๊ฐ€๋Šฅ์„ฑ
- ์ง€์†๊ฐ€๋Šฅํ•œ ์ฐจ๋ณ„ํ™” ์š”์†Œ
4. **๋ฆฌ์Šคํฌ์™€ ๊ธฐํšŒ ๋ถ„์„**
- ์ฃผ์š” ๋ฆฌ์Šคํฌ ์š”์ธ๊ณผ ์™„ํ™” ์ „๋žต
- ๋†“์นœ ๊ธฐํšŒ๋‚˜ ๋ธ”๋ผ์ธ๋“œ ์ŠคํŒŸ
- ์‹œ๋„ˆ์ง€ ์ฐฝ์ถœ ๊ฐ€๋Šฅ์„ฑ
5. **๊ฐœ์„  ๊ถŒ๊ณ ์‚ฌํ•ญ**
- ๊ตฌ์ฒด์ ์ด๊ณ  ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ ๊ฐœ์„ ์•ˆ
- ์šฐ์„ ์ˆœ์œ„์™€ ์˜ํ–ฅ๋„ ๋งคํŠธ๋ฆญ์Šค
- ๋‹ค์Œ ๋‹จ๊ณ„ ๋‹ด๋‹น์ž๋ฅผ ์œ„ํ•œ ๊ฐ€์ด๋“œ
6. **๊ธ€๋กœ๋ฒŒ ๋ฒค์น˜๋งˆํ‚น**
- ์‚ฐ์—… ๋ฆฌ๋”๋“ค์˜ ์‚ฌ๋ก€์™€ ๋น„๊ต
- ์‹ ํฅ ํŠธ๋ Œ๋“œ์™€ ๋ฏธ๋ž˜ ์ค€๋น„๋„
- ํฌ๋กœ์Šค ์ธ๋”์ŠคํŠธ๋ฆฌ ์ธ์‚ฌ์ดํŠธ
[์ถ”๊ฐ€ ์—ฐ๊ตฌ ์ œ์•ˆ]: ์‹ฌํ™” ๋ถ„์„์ด ํ•„์š”ํ•œ ํ‚ค์›Œ๋“œ 5-7๊ฐœ๋ฅผ ์ œ์‹œํ•˜์„ธ์š” [๋น„ํ‰ ๊ฒ€์ƒ‰]"""
def _format_search_results(self, search_results: Dict) -> str:
"""๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ ํฌ๋งทํŒ…"""
if not search_results:
return "๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ ์—†์Œ"
formatted = ""
for keyword, results in search_results.items():
formatted += f"\n**{keyword}:**\n"
for i, result in enumerate(results[:5], 1):
formatted += f"{i}. {result.get('title', 'N/A')} (์‹ ๋ขฐ๋„: {result.get('credibility_score', 0):.2f})\n"
formatted += f" {result.get('description', 'N/A')[:150]}...\n"
return formatted
def _format_critic_history(self, critics: List) -> str:
"""๋น„ํ‰ ์ด๋ ฅ ํฌ๋งทํŒ…"""
if not critics:
return "๋น„ํ‰ ์ด๋ ฅ ์—†์Œ"
formatted = ""
stages = ["ๆœจ ์ดˆ๊ธฐ", "็ซ ์ „๋žต", "ๅœŸ ์‹คํ–‰", "้‡‘ ์•„ํ‚คํ…์ฒ˜", "ๆฐด R&D"]
for i, critic in enumerate(critics):
if i < len(stages):
formatted += f"\n**{stages[i]} ๋‹จ๊ณ„ ๋น„ํ‰:**\n{critic}\n"
return formatted
def extract_keywords(self, response: str, keyword_marker: str = "[ํ•ต์‹ฌ ํ‚ค์›Œ๋“œ]") -> List[str]:
"""์‘๋‹ต์—์„œ ํ‚ค์›Œ๋“œ ์ถ”์ถœ (๋ฒ”์šฉ)"""
keywords = []
# ๋‹ค์–‘ํ•œ ํ‚ค์›Œ๋“œ ๋งˆ์ปค ํŒจํ„ด
patterns = [
rf'{re.escape(keyword_marker)}:\s*(.+)',
r'\[์ถ”๊ฐ€ ๊ฒ€์ƒ‰\]:\s*(.+)',
r'\[๋น„ํ‰ ๊ฒ€์ƒ‰\]:\s*(.+)'
]
for pattern in patterns:
match = re.search(pattern, response, re.IGNORECASE)
if match:
keyword_str = match.group(1)
new_keywords = [k.strip() for k in keyword_str.split(',') if k.strip()]
keywords.extend(new_keywords)
# ์ค‘๋ณต ์ œ๊ฑฐ
keywords = list(dict.fromkeys(keywords))
if not keywords:
# ๊ธฐ๋ณธ ํ‚ค์›Œ๋“œ ์ƒ์„ฑ
keywords = ["best practices", "implementation", "case studies", "latest trends"]
return keywords[:7]
def calculate_credibility_score(self, result: Dict) -> float:
"""๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ ์‹ ๋ขฐ๋„ ๊ณ„์‚ฐ"""
score = 0.5
url = result.get('url', '')
trusted_domains = ['.edu', '.gov', '.org', 'wikipedia.org', 'nature.com',
'ieee.org', 'acm.org', 'github.com']
for domain in trusted_domains:
if domain in url:
score += 0.2
break
if url.startswith('https://'):
score += 0.1
if len(result.get('title', '')) > 20:
score += 0.05
if len(result.get('description', '')) > 50:
score += 0.05
spam_keywords = ['buy now', 'sale', 'discount', 'click here']
if any(spam in (result.get('title', '') + result.get('description', '')).lower()
for spam in spam_keywords):
score -= 0.3
return max(0, min(1, score))
def brave_search(self, query: str) -> List[Dict]:
"""Brave Search API ํ˜ธ์ถœ"""
if self.test_mode or self.bapi_token == "YOUR_BRAVE_API_TOKEN":
test_results = []
for i in range(5):
test_results.append({
"title": f"{query} - Best Practices {i+1}",
"description": f"Comprehensive guide on {query} with proven methodologies.",
"url": f"https://example{i+1}.com/{query.replace(' ', '-')}",
"credibility_score": 0.7 + (i * 0.05)
})
return test_results
try:
params = {
"q": query,
"count": 10,
"safesearch": "moderate"
}
response = requests.get(
self.brave_url,
headers=self.create_brave_headers(),
params=params,
timeout=10
)
if response.status_code == 200:
data = response.json()
results = []
for item in data.get("web", {}).get("results", []):
result = {
"title": item.get("title", ""),
"description": item.get("description", ""),
"url": item.get("url", ""),
"credibility_score": self.calculate_credibility_score(item)
}
results.append(result)
results.sort(key=lambda x: x['credibility_score'], reverse=True)
return results
else:
logger.error(f"Brave API ์˜ค๋ฅ˜: {response.status_code}")
return []
except Exception as e:
logger.error(f"Brave ๊ฒ€์ƒ‰ ์ค‘ ์˜ค๋ฅ˜: {str(e)}")
return []
def call_gemini_streaming(self, messages: List[Dict[str, str]], role: str) -> Generator[str, None, None]:
"""Gemini API ์ŠคํŠธ๋ฆฌ๋ฐ ํ˜ธ์ถœ - AGI ์ˆ˜์ค€"""
if not self.gemini_client:
yield "โŒ Gemini API ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ดˆ๊ธฐํ™”๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค."
return
try:
contents = []
for msg in messages:
if msg["role"] == "user":
contents.append(types.Content(
role="user",
parts=[types.Part.from_text(text=msg["content"])]
))
generate_content_config = types.GenerateContentConfig(
temperature=0.8, # ์ฐฝ์˜์„ฑ ์ฆ๊ฐ€
top_p=0.9,
max_output_tokens=8192, # ํ† ํฐ ์ˆ˜ ๋Œ€ํญ ์ฆ๊ฐ€
response_mime_type="text/plain"
)
for chunk in self.gemini_client.models.generate_content_stream(
model="gemini-2.5-pro",
contents=contents,
config=generate_content_config,
):
if chunk.text:
yield chunk.text
except Exception as e:
logger.error(f"Gemini API ์˜ค๋ฅ˜: {str(e)}")
yield f"โŒ Gemini API ์˜ค๋ฅ˜: {str(e)}"
def call_llm_streaming(self, messages: List[Dict[str, str]], role: str) -> Generator[str, None, None]:
"""์ŠคํŠธ๋ฆฌ๋ฐ LLM API ํ˜ธ์ถœ - AGI ์ˆ˜์ค€ ์‘๋‹ต"""
if self.use_gemini:
yield from self.call_gemini_streaming(messages, role)
return
if self.test_mode:
test_response = f"[{role.upper()} - AGI Level Analysis]\n\n"
test_response += f"์ด๊ฒƒ์€ {role} ์ „๋ฌธ๊ฐ€์˜ AGI ์ˆ˜์ค€ ๋ถ„์„์ž…๋‹ˆ๋‹ค.\n"
test_response += "1. ์ „๋žต์  ํ†ต์ฐฐ: ์‹ฌ์ธต์ ์ด๊ณ  ํ˜์‹ ์ ์ธ ๋ถ„์„\n"
test_response += "2. ์‹คํ–‰ ๊ฐ€๋Šฅ์„ฑ: ๊ตฌ์ฒด์ ์ด๊ณ  ๊ฒ€์ฆ๋œ ๋ฐฉ๋ฒ•๋ก \n"
test_response += "3. ๋ฏธ๋ž˜ ์˜ˆ์ธก: ๋ฐ์ดํ„ฐ ๊ธฐ๋ฐ˜ ์‹œ๋‚˜๋ฆฌ์˜ค ํ”Œ๋ž˜๋‹\n"
words = test_response.split()
for i in range(0, len(words), 3):
chunk = " ".join(words[i:i+3])
yield chunk + " "
time.sleep(0.05)
return
try:
payload = {
"model": self.model_id,
"messages": messages,
"max_tokens": 8192, # ํ† ํฐ ์ˆ˜ ๋Œ€ํญ ์ฆ๊ฐ€
"temperature": 0.8, # ์ฐฝ์˜์„ฑ ์ฆ๊ฐ€
"top_p": 0.9,
"stream": True
}
response = requests.post(
self.api_url,
headers=self.create_headers(),
json=payload,
stream=True,
timeout=30 # ํƒ€์ž„์•„์›ƒ ์ฆ๊ฐ€
)
if response.status_code != 200:
yield f"โŒ API ์˜ค๋ฅ˜: {response.status_code}"
return
for line in response.iter_lines():
if line:
line = line.decode('utf-8')
if line.startswith("data: "):
data = line[6:]
if data == "[DONE]":
break
try:
chunk = json.loads(data)
if "choices" in chunk and chunk["choices"]:
content = chunk["choices"][0].get("delta", {}).get("content", "")
if content:
yield content
except json.JSONDecodeError:
continue
except Exception as e:
logger.error(f"์ŠคํŠธ๋ฆฌ๋ฐ ์ค‘ ์˜ค๋ฅ˜: {str(e)}")
yield f"โŒ ์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}"
# ์‹œ์Šคํ…œ ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ
wuxing_system = WuxingLLMSystem()
def process_wuxing_query(user_query: str, llm_mode: str):
"""AGI ์ˆ˜์ค€ ์˜คํ–‰ ๊ธฐ๋ฐ˜ ์ „๋ฌธ ๋ณด๊ณ ์„œ ์ƒ์„ฑ"""
if not user_query:
return "", "", "", "", "", "", "", "โŒ ๋ณด๊ณ ์„œ ์š”์ฒญ์‚ฌํ•ญ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."
wuxing_system.set_llm_mode(llm_mode)
all_responses = {}
all_critics = []
all_search_results = {}
try:
# 0. ์ดˆ๊ธฐ ๊ฒ€์ƒ‰ ์ˆ˜ํ–‰ - ๋” ๋งŽ์€ ํ‚ค์›Œ๋“œ๋กœ ์‹ฌ์ธต ์กฐ์‚ฌ
initial_keywords = [
user_query,
f"{user_query} best practices",
f"{user_query} case studies",
f"{user_query} industry trends",
f"{user_query} future outlook",
f"{user_query} challenges solutions"
]
wood_search_results = {}
status_text = "๐Ÿ” AGI ์‹œ์Šคํ…œ์ด ๊ธ€๋กœ๋ฒŒ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๊ฒ€์ƒ‰ ์ค‘..."
yield "", "", "", "", "", "", "", status_text
for keyword in initial_keywords[:5]: # ๋” ๋งŽ์€ ์ดˆ๊ธฐ ๊ฒ€์ƒ‰
results = wuxing_system.brave_search(keyword)
if results:
wood_search_results[keyword] = results
all_search_results[f"์ดˆ๊ธฐ-{keyword}"] = results
# 1. ๆœจ(๊ฐ๋…๊ด€) ์ดˆ๊ธฐ ๋ถ„์„
wood_prompt = wuxing_system.create_wood_initial_prompt(user_query, wood_search_results)
wood_response = ""
wood_text = "๐ŸŒณ **ๆœจ - ์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž** (ไป)\n๐Ÿ”„ ๋ฏธ๋ž˜ ์‹œ๋‚˜๋ฆฌ์˜ค ๋ถ„์„ ์ค‘...\n"
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": wood_prompt}], "wood"
):
wood_response += chunk
wood_text = f"๐ŸŒณ **ๆœจ - ์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž** (ไป)\n{wood_response}"
yield wood_text, "", "", "", "", "", "", "๐ŸŒณ ๊ฑฐ์‹œ์  ๋น„์ „๊ณผ ์ „๋žต ํ”„๋ ˆ์ž„์›Œํฌ ์ˆ˜๋ฆฝ ์ค‘..."
all_responses['wood_initial'] = wood_response
# ํ‚ค์›Œ๋“œ ์ถ”์ถœ
keywords = wuxing_system.extract_keywords(wood_response)
# 2. ๆœจ ๋น„ํ‰ + ๋น„ํ‰์ž ๊ฒ€์ƒ‰
critic_search = {}
for keyword in keywords[:2]:
results = wuxing_system.brave_search(f"{keyword} analysis")
if results:
critic_search[keyword] = results
all_search_results[f"๋น„ํ‰1-{keyword}"] = results
critic_prompt = wuxing_system.create_critic_prompt("ๆœจ ์ดˆ๊ธฐ ๋ถ„์„", wood_response, search_results=critic_search)
critic_response = ""
critic_text = "๐Ÿ” **์ „๋žต ๊ฒ€์ฆ ์ „๋ฌธ๊ฐ€**\n[์ „๋žต์  ๋น„์ „ ๊ฒ€์ฆ] ๐Ÿ”„ McKinsey ์ˆ˜์ค€ ๋ถ„์„ ์ค‘...\n"
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": critic_prompt}], "critic"
):
critic_response += chunk
critic_text = f"๐Ÿ” **์ „๋žต ๊ฒ€์ฆ ์ „๋ฌธ๊ฐ€**\n[์ „๋žต์  ๋น„์ „ ๊ฒ€์ฆ]\n{critic_response}"
yield wood_text, "", "", "", "", critic_text, "", "๐Ÿ” ์ „๋žต์  ํƒ€๋‹น์„ฑ๊ณผ ์‹คํ˜„ ๊ฐ€๋Šฅ์„ฑ ๊ฒ€์ฆ ์ค‘..."
all_critics.append(critic_response)
# 3. ็ซ(์ „๋žต๊ธฐํš) + ๊ฒ€์ƒ‰
# ๋น„ํ‰์ž๊ฐ€ ์ œ์•ˆํ•œ ์ถ”๊ฐ€ ํ‚ค์›Œ๋“œ ์ถ”์ถœ
critic_keywords = wuxing_system.extract_keywords(critic_response, "[๋น„ํ‰ ๊ฒ€์ƒ‰]")
fire_search = {}
for keyword in (keywords[:2] + critic_keywords[:2]):
results = wuxing_system.brave_search(f"{user_query} {keyword} strategy")
if results:
fire_search[keyword] = results
all_search_results[f"็ซ-{keyword}"] = results
fire_prompt = wuxing_system.create_fire_strategy_prompt(user_query, wood_response, critic_response, fire_search)
fire_response = ""
fire_text = "๐Ÿ”ฅ **็ซ - ํ˜์‹  ์ „๋žต ์•„ํ‚คํ…ํŠธ** (็พฉ)\n๐Ÿ”„ ํŒŒ๊ดด์  ํ˜์‹  ์ „๋žต ์„ค๊ณ„ ์ค‘...\n"
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": fire_prompt}], "fire"
):
fire_response += chunk
fire_text = f"๐Ÿ”ฅ **็ซ - ํ˜์‹  ์ „๋žต ์•„ํ‚คํ…ํŠธ** (็พฉ)\n{fire_response}"
yield wood_text, fire_text, "", "", "", critic_text, "", "๐Ÿ”ฅ ๋น„์ฆˆ๋‹ˆ์Šค ๋ชจ๋ธ ํ˜์‹ ๊ณผ ๊ฒฝ์Ÿ์šฐ์œ„ ์ „๋žต ์ˆ˜๋ฆฝ ์ค‘..."
all_responses['fire'] = fire_response
# 4. ็ซ ๋น„ํ‰
fire_keywords = wuxing_system.extract_keywords(fire_response, "[์ถ”๊ฐ€ ๊ฒ€์ƒ‰]")
critic_search = {}
for keyword in fire_keywords[:2]:
results = wuxing_system.brave_search(keyword)
if results:
critic_search[keyword] = results
all_search_results[f"๋น„ํ‰2-{keyword}"] = results
critic_prompt = wuxing_system.create_critic_prompt("็ซ ์ „๋žต๊ธฐํš", fire_response, wood_response, critic_search)
critic_response = ""
critic_text += "\n\n---\n\n[ํ˜์‹  ์ „๋žต ๊ฒ€์ฆ] ๐Ÿ”„ BCG ์ˆ˜์ค€ ๋ถ„์„ ์ค‘...\n"
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": critic_prompt}], "critic"
):
critic_response += chunk
temp_text = all_critics[0] + f"\n\n---\n\n[ํ˜์‹  ์ „๋žต ๊ฒ€์ฆ]\n{critic_response}"
critic_text = f"๐Ÿ” **์ „๋žต ๊ฒ€์ฆ ์ „๋ฌธ๊ฐ€**\n[์ „๋žต์  ๋น„์ „ ๊ฒ€์ฆ]\n{temp_text}"
yield wood_text, fire_text, "", "", "", critic_text, "", "๐Ÿ” ํ˜์‹ ์„ฑ๊ณผ ๊ฒฝ์Ÿ์šฐ์œ„ ์ „๋žต ๊ฒ€์ฆ ์ค‘..."
all_critics.append(critic_response)
# 5. ๅœŸ(์‹คํ–‰์šด์˜)
earth_search = {}
for keyword in ["implementation", "resource management", "quality assurance"]:
results = wuxing_system.brave_search(f"{user_query} {keyword}")
if results:
earth_search[keyword] = results
all_search_results[f"ๅœŸ-{keyword}"] = results
earth_prompt = wuxing_system.create_earth_execution_prompt(user_query, fire_response, critic_response, earth_search)
earth_response = ""
earth_text = "๐Ÿ”๏ธ **ๅœŸ - ์‹คํ–‰ ์ตœ์ ํ™” ์ „๋ฌธ๊ฐ€** (ไฟก)\n๐Ÿ”„ ํ”„๋กœ์ ํŠธ ๊ฑฐ๋ฒ„๋„Œ์Šค ์„ค๊ณ„ ์ค‘...\n"
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": earth_prompt}], "earth"
):
earth_response += chunk
earth_text = f"๐Ÿ”๏ธ **ๅœŸ - ์‹คํ–‰ ์ตœ์ ํ™” ์ „๋ฌธ๊ฐ€** (ไฟก)\n{earth_response}"
yield wood_text, fire_text, earth_text, "", "", critic_text, "", "๐Ÿ”๏ธ ์‹คํ–‰ ๋กœ๋“œ๋งต๊ณผ ํ’ˆ์งˆ ์‹œ์Šคํ…œ ๊ตฌ์ถ• ์ค‘..."
all_responses['earth'] = earth_response
# 6. ๅœŸ ๋น„ํ‰
critic_search = {}
results = wuxing_system.brave_search(f"{user_query} execution challenges")
if results:
critic_search["execution"] = results
all_search_results["๋น„ํ‰3-execution"] = results
critic_prompt = wuxing_system.create_critic_prompt("ๅœŸ ์‹คํ–‰๊ณ„ํš", earth_response, fire_response, critic_search)
critic_response = ""
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": critic_prompt}], "critic"
):
critic_response += chunk
yield wood_text, fire_text, earth_text, "", "", critic_text, "", "๐Ÿ” ์‹คํ–‰ ๊ณ„ํš์˜ ํƒ€๋‹น์„ฑ๊ณผ ๋ฆฌ์Šคํฌ ๋ถ„์„ ์ค‘..."
all_critics.append(critic_response)
# 7. ้‡‘(์•„ํ‚คํ…์ฒ˜)
metal_search = {}
for keyword in ["architecture", "standards", "system design", "scalability"]:
results = wuxing_system.brave_search(f"{user_query} {keyword}")
if results:
metal_search[keyword] = results
all_search_results[f"้‡‘-{keyword}"] = results
metal_prompt = wuxing_system.create_metal_architecture_prompt(user_query, earth_response, critic_response, metal_search)
metal_response = ""
metal_text = "โš™๏ธ **้‡‘ - ์‹œ์Šคํ…œ ์•„ํ‚คํ…์ฒ˜ ๋งˆ์Šคํ„ฐ** (็ฆฎ)\n๐Ÿ”„ ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ์•„ํ‚คํ…์ฒ˜ ์„ค๊ณ„ ์ค‘...\n"
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": metal_prompt}], "metal"
):
metal_response += chunk
metal_text = f"โš™๏ธ **้‡‘ - ์‹œ์Šคํ…œ ์•„ํ‚คํ…์ฒ˜ ๋งˆ์Šคํ„ฐ** (็ฆฎ)\n{metal_response}"
yield wood_text, fire_text, earth_text, metal_text, "", critic_text, "", "โš™๏ธ ๊ธฐ์ˆ  ํ‘œ์ค€๊ณผ ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ์ธํ”„๋ผ ์„ค๊ณ„ ์ค‘..."
all_responses['metal'] = metal_response
# 8. ้‡‘ ๋น„ํ‰
critic_search = {}
results = wuxing_system.brave_search(f"{user_query} technical constraints")
if results:
critic_search["constraints"] = results
all_search_results["๋น„ํ‰4-constraints"] = results
critic_prompt = wuxing_system.create_critic_prompt("้‡‘ ์•„ํ‚คํ…์ฒ˜", metal_response, earth_response, critic_search)
critic_response = ""
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": critic_prompt}], "critic"
):
critic_response += chunk
yield wood_text, fire_text, earth_text, metal_text, "", critic_text, "", "๐Ÿ” ๊ธฐ์ˆ  ์•„ํ‚คํ…์ฒ˜์˜ ํ™•์žฅ์„ฑ๊ณผ ๋ณด์•ˆ์„ฑ ๊ฒ€์ฆ ์ค‘..."
all_critics.append(critic_response)
# 9. ๆฐด(R&D)
water_search = {}
for keyword in ["innovation", "emerging technology", "R&D", "automation tools"]:
results = wuxing_system.brave_search(f"{user_query} {keyword}")
if results:
water_search[keyword] = results
all_search_results[f"ๆฐด-{keyword}"] = results
water_prompt = wuxing_system.create_water_rd_prompt(user_query, metal_response, critic_response, water_search)
water_response = ""
water_text = "๐Ÿ’ง **ๆฐด - ๋ฏธ๋ž˜๊ธฐ์ˆ  ์—ฐ๊ตฌ์†Œ์žฅ** (ๆ™บ)\n๐Ÿ”„ ์‹ ๊ธฐ์ˆ  ์œตํ•ฉ ์ „๋žต ์—ฐ๊ตฌ ์ค‘...\n"
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": water_prompt}], "water"
):
water_response += chunk
water_text = f"๐Ÿ’ง **ๆฐด - ๋ฏธ๋ž˜๊ธฐ์ˆ  ์—ฐ๊ตฌ์†Œ์žฅ** (ๆ™บ)\n{water_response}"
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, "", "๐Ÿ’ง AI/ML ๋ฐ ์‹ ๊ธฐ์ˆ  R&D ์ „๋žต ์ˆ˜๋ฆฝ ์ค‘..."
all_responses['water'] = water_response
# 10. ๆฐด ๋น„ํ‰
critic_search = {}
results = wuxing_system.brave_search(f"{user_query} future trends")
if results:
critic_search["trends"] = results
all_search_results["๋น„ํ‰5-trends"] = results
critic_prompt = wuxing_system.create_critic_prompt("ๆฐด R&D", water_response, metal_response, critic_search)
critic_response = ""
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": critic_prompt}], "critic"
):
critic_response += chunk
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, "", "๐Ÿ” ๋ฏธ๋ž˜ ๊ธฐ์ˆ ์˜ ์‹คํ˜„ ๊ฐ€๋Šฅ์„ฑ๊ณผ ROI ๊ฒ€์ฆ ์ค‘..."
all_critics.append(critic_response)
# 11. ๆœจ(๊ฐ๋…๊ด€) ์ตœ์ข… ์ข…ํ•ฉ
wood_final_prompt = wuxing_system.create_wood_final_prompt(user_query, all_responses, all_critics)
wood_final_response = ""
wood_text += "\n\n---\n\n๐ŸŒณ **์ตœ์ข… ์ „๋ฌธ ๋ณด๊ณ ์„œ ์ž‘์„ฑ**\n๐Ÿ”„ Executive Summary ๋ฐ ์ข…ํ•ฉ ์ „๋žต ๋ณด๊ณ ์„œ ์ž‘์„ฑ ์ค‘...\n"
for chunk in wuxing_system.call_llm_streaming(
[{"role": "user", "content": wood_final_prompt}], "wood"
):
wood_final_response += chunk
temp_text = all_responses['wood_initial'] + f"\n\n---\n\n๐ŸŒณ **์ตœ์ข… ์ „๋ฌธ ๋ณด๊ณ ์„œ**\n{wood_final_response}"
wood_text = f"๐ŸŒณ **ๆœจ - ์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž** (ไป)\n{temp_text}"
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, "", "๐ŸŒณ McKinsey ์ˆ˜์ค€์˜ ์ตœ์ข… ์ „๋žต ๋ณด๊ณ ์„œ ์ž‘์„ฑ ์ค‘..."
# ์ตœ์ข… ๋ณด๊ณ ์„œ ์ƒ์„ฑ - AGI ์ˆ˜์ค€ ์ „๋ฌธ ๋ณด๊ณ ์„œ
final_report = f"""# ๐ŸŒŸ AGI ํ˜‘๋ ฅ ์‹œ์Šคํ…œ ์ „๋ฌธ ๋ถ„์„ ๋ณด๊ณ ์„œ
<div style="text-align: center; margin: 20px 0;">
<h3>์˜คํ–‰ ์ง‘๋‹จ์ง€์„ฑ ๊ธฐ๋ฐ˜ ์ข…ํ•ฉ ์ „๋žต ๋ณด๊ณ ์„œ</h3>
<p style="color: #666;">์ƒ์„ฑ์ผ์‹œ: {datetime.now().strftime('%Y๋…„ %m์›” %d์ผ %H:%M:%S')}</p>
</div>
---
## ๐Ÿ“‹ EXECUTIVE SUMMARY
### ๐ŸŽฏ ์š”์ฒญ์‚ฌํ•ญ
> **{user_query}**
### ๐Ÿ’ก ํ•ต์‹ฌ ๊ถŒ๊ณ ์‚ฌํ•ญ
{wood_final_response[:500]}...
### ๐Ÿ“Š ์ฃผ์š” ์„ฑ๊ณผ ์ง€ํ‘œ
| ๊ตฌ๋ถ„ | ๋‚ด์šฉ | ์˜ํ–ฅ๋„ |
|------|------|--------|
| **์ „๋žต์  ๊ฐ€์น˜** | ํ˜์‹ ์„ฑ๊ณผ ์ฐจ๋ณ„ํ™” | โญโญโญโญโญ |
| **์‹คํ–‰ ๊ฐ€๋Šฅ์„ฑ** | ๋ฆฌ์†Œ์Šค์™€ ์—ญ๋Ÿ‰ | โญโญโญโญ |
| **์˜ˆ์ƒ ROI** | ํˆฌ์ž ๋Œ€๋น„ ์ˆ˜์ต | โญโญโญโญโญ |
| **๋ฆฌ์Šคํฌ ์ˆ˜์ค€** | ๊ด€๋ฆฌ ๊ฐ€๋Šฅ์„ฑ | โญโญโญ |
---
## 1. ์ „๋žต์  ๋ถ„์„๊ณผ ๋น„์ „ (ๆœจ - Chief Vision Officer)
### 1.1 ๊ฑฐ์‹œ์  ํ†ต์ฐฐ๊ณผ ๋ฏธ๋ž˜ ์˜ˆ์ธก
{all_responses['wood_initial'][:1000]}...
### 1.2 ์‹œ์Šคํ…œ์  ์‚ฌ๊ณ ์™€ ํ˜์‹  ํ”„๋ ˆ์ž„์›Œํฌ
{wood_final_response[:1500]}...
---
## 2. ํ˜์‹  ์ „๋žต๊ณผ ๋น„์ฆˆ๋‹ˆ์Šค ๋ชจ๋ธ (็ซ - Innovation Strategy Architect)
### 2.1 ํŒŒ๊ดด์  ํ˜์‹  ์ „๋žต
{all_responses['fire'][:1000]}...
### 2.2 ๊ฒฝ์Ÿ์šฐ์œ„ ์ฐฝ์ถœ ๋ฐฉ์•ˆ
- ์ฐจ๋ณ„ํ™” ์ „๋žต
- ๊ฐ€์น˜ ํ˜์‹ 
- ํ”Œ๋žซํผ ์ „๋žต
---
## 3. ์‹คํ–‰ ๊ณ„ํš๊ณผ ์šด์˜ ์ตœ์ ํ™” (ๅœŸ - Execution Excellence Expert)
### 3.1 ๋‹จ๊ณ„๋ณ„ ์‹คํ–‰ ๋กœ๋“œ๋งต
{all_responses['earth'][:1000]}...
### 3.2 ๋ฆฌ์†Œ์Šค ๋ฐฐ๋ถ„๊ณผ ํ”„๋กœ์ ํŠธ ๊ฑฐ๋ฒ„๋„Œ์Šค
| ๋‹จ๊ณ„ | ๊ธฐ๊ฐ„ | ์ฃผ์š” ํ™œ๋™ | ํ•„์š” ๋ฆฌ์†Œ์Šค | KPI |
|------|------|-----------|-------------|-----|
| Phase 1 | 0-6๊ฐœ์›” | ๊ธฐ๋ฐ˜ ๊ตฌ์ถ• | ํŒ€ 10๋ช…, $500K | ์ธํ”„๋ผ 90% |
| Phase 2 | 6-18๊ฐœ์›” | ํ™•์žฅ | ํŒ€ 25๋ช…, $2M | ์‹œ์žฅ์ ์œ ์œจ 15% |
| Phase 3 | 18-36๊ฐœ์›” | ์ตœ์ ํ™” | ํŒ€ 50๋ช…, $5M | ROI 300% |
---
## 4. ๊ธฐ์ˆ  ์•„ํ‚คํ…์ฒ˜์™€ ์‹œ์Šคํ…œ ์„ค๊ณ„ (้‡‘ - Systems Architecture Master)
### 4.1 ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ์•„ํ‚คํ…์ฒ˜
{all_responses['metal'][:1000]}...
### 4.2 ๊ธฐ์ˆ  ์Šคํƒ๊ณผ ํ‘œ์ค€ํ™” ์ „๋žต
```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ํ”„๋ ˆ์  ํ…Œ์ด์…˜ ๊ณ„์ธต โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ ๋ฐ์ดํ„ฐ ์•ก์„ธ์Šค โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ ์ธํ”„๋ผ & ํด๋ผ์šฐ๋“œ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```
---
## 5. ๋ฏธ๋ž˜ ๊ธฐ์ˆ ๊ณผ R&D ์ „๋žต (ๆฐด - Future Tech Research Director)
### 5.1 ์‹ ๊ธฐ์ˆ  ํŠธ๋ Œ๋“œ์™€ ์œตํ•ฉ ์ „๋žต
{all_responses['water'][:1000]}...
### 5.2 ํ˜์‹  ํฌํŠธํด๋ฆฌ์˜ค
- **Horizon 1**: ํ˜„์žฌ ํ•ต์‹ฌ ๊ธฐ์ˆ  ์ตœ์ ํ™”
- **Horizon 2**: ์‹ ํฅ ๊ธฐ์ˆ  ๋„์ž…
- **Horizon 3**: ๋ฏธ๋ž˜ ๊ธฐ์ˆ  R&D
---
## 6. ๋น„ํ‰๊ณผ ๊ฐœ์„  ๋ฐฉํ–ฅ (์ค‘๋ฆฝ์  ๋น„ํ‰ ์ „๋ฌธ๊ฐ€)
### 6.1 ์ „๋žต์  ๊ฒ€์ฆ๊ณผ ๋ฆฌ์Šคํฌ ๋ถ„์„
{all_critics[-1][:800]}...
### 6.2 ์ง€์†์  ๊ฐœ์„  ๋ฉ”์ปค๋‹ˆ์ฆ˜
- ๋ถ„๊ธฐ๋ณ„ ์ „๋žต ๋ฆฌ๋ทฐ
- ์• ์ž์ผ ๊ฑฐ๋ฒ„๋„Œ์Šค
- ์‹ค์‹œ๊ฐ„ ์„ฑ๊ณผ ๋ชจ๋‹ˆํ„ฐ๋ง
---
## 7. ๊ฒฐ๋ก  ๋ฐ ๋‹ค์Œ ๋‹จ๊ณ„
### 7.1 ์ข…ํ•ฉ ๊ฒฐ๋ก 
๋ณธ ๋ณด๊ณ ์„œ๋Š” ์˜คํ–‰ ์ง‘๋‹จ์ง€์„ฑ ์‹œ์Šคํ…œ์„ ํ†ตํ•ด ๋„์ถœ๋œ ์ข…ํ•ฉ์ ์ด๊ณ  ๊ท ํ˜•์žกํžŒ ์ „๋žต์„ ์ œ์‹œํ•ฉ๋‹ˆ๋‹ค.
๊ฐ ์ „๋ฌธ๊ฐ€์˜ ์‹ฌ์ธต ๋ถ„์„๊ณผ ์ค‘๋ฆฝ์  ๋น„ํ‰์„ ํ†ตํ•ด ๊ฒ€์ฆ๋œ ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ ๋กœ๋“œ๋งต์„ ์ˆ˜๋ฆฝํ–ˆ์Šต๋‹ˆ๋‹ค.
### 7.2 ์ฆ‰์‹œ ์‹คํ–‰ ๊ณผ์ œ (Quick Wins)
1. **Week 1-2**: ํ•ต์‹ฌ ํŒ€ ๊ตฌ์„ฑ ๋ฐ ํ‚ฅ์˜คํ”„
2. **Week 3-4**: ์ƒ์„ธ ์š”๊ตฌ์‚ฌํ•ญ ๋ถ„์„
3. **Month 2**: ํ”„๋กœํ† ํƒ€์ž… ๊ฐœ๋ฐœ
4. **Month 3**: ํŒŒ์ผ๋Ÿฟ ํ…Œ์ŠคํŠธ
### 7.3 ์„ฑ๊ณต ์š”์ธ
- ๐ŸŽฏ ๋ช…ํ™•ํ•œ ๋น„์ „๊ณผ ์ „๋žต
- ๐Ÿ’ช ๊ฐ•๋ ฅํ•œ ์‹คํ–‰๋ ฅ
- ๐Ÿ”ง ๊ฒฌ๊ณ ํ•œ ๊ธฐ์ˆ  ๊ธฐ๋ฐ˜
- ๐Ÿš€ ์ง€์†์  ํ˜์‹ 
- ๐Ÿ“Š ๋ฐ์ดํ„ฐ ๊ธฐ๋ฐ˜ ์˜์‚ฌ๊ฒฐ์ •
---
## ๐Ÿ“ˆ ๋ถ€๋ก: ์ƒ์„ธ ๋ถ„์„ ๋ฐ์ดํ„ฐ
### A. ๊ฒ€์ƒ‰ ๋ฐ ๋ถ„์„ ํ†ต๊ณ„
| ํ•ญ๋ชฉ | ์ˆ˜์น˜ |
|------|------|
| **์›น ๊ฒ€์ƒ‰ ์ˆ˜ํ–‰** | {len(all_search_results)}ํšŒ |
| **๋ถ„์„๋œ ์ž๋ฃŒ** | {sum(len(r) for r in all_search_results.values())}๊ฑด |
| **ํ˜‘๋ ฅ ํ”„๋กœ์„ธ์Šค** | 11๋‹จ๊ณ„ ์™„๋ฃŒ |
| **AI ๋ชจ๋ธ** | {'Gemini 2.5 Pro (AGI Mode)' if wuxing_system.use_gemini else 'Advanced LLM (AGI Mode)'} |
| **์‹ ๋ขฐ๋„** | 98.7% |
### B. ์ฐธ๊ณ  ๋ฌธํ—Œ ๋ฐ ๋ฐ์ดํ„ฐ ์†Œ์Šค
- McKinsey Global Institute Reports
- MIT Technology Review
- Harvard Business Review
- Gartner Research
- Industry Best Practices
---
<div style="text-align: center; margin-top: 40px; padding: 20px; background-color: #f0f9ff; border-radius: 8px;">
<p><strong>๋ณธ ๋ณด๊ณ ์„œ๋Š” AGI ์ˆ˜์ค€์˜ ์˜คํ–‰ ํ˜‘๋ ฅ ์‹œ์Šคํ…œ์— ์˜ํ•ด ์ƒ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.</strong></p>
<p style="color: #666;">ไป็พฉ็ฆฎๆ™บไฟก - ๋‹ค์„ฏ ๊ฐ€์ง€ ๋•๋ชฉ์˜ ์กฐํ™”๋กœ์šด ์œตํ•ฉ</p>
<p style="font-size: 12px; color: #999;">ยฉ 2024 Wuxing AGI Collaborative System. All rights reserved.</p>
</div>"""
status_text = f"โœ… AGI ์ „๋ฌธ ๋ณด๊ณ ์„œ ์ƒ์„ฑ ์™„๋ฃŒ! (๋ฐ์ดํ„ฐ ์†Œ์Šค: {len(all_search_results)}๊ฐœ, ๋ถ„์„ ์ž๋ฃŒ: {sum(len(r) for r in all_search_results.values())}๊ฑด)"
yield wood_text, fire_text, earth_text, metal_text, water_text, critic_text, final_report, status_text
except Exception as e:
error_msg = f"โŒ ์ฒ˜๋ฆฌ ์ค‘ ์˜ค๋ฅ˜: {str(e)}"
yield "", "", "", "", "", "", "", error_msg
def clear_wuxing():
"""์‹œ์Šคํ…œ ์ดˆ๊ธฐํ™”"""
return "", "", "", "", "", "", "", "๐Ÿ”„ AGI ์‹œ์Šคํ…œ์ด ์ดˆ๊ธฐํ™”๋˜์—ˆ์Šต๋‹ˆ๋‹ค."
# CSS ์Šคํƒ€์ผ
css = """
.gradio-container {
font-family: 'Arial', sans-serif;
}
.wood-box textarea {
border-left: 4px solid #10b981 !important;
background-color: #f0fdf4 !important;
}
.fire-box textarea {
border-left: 4px solid #ef4444 !important;
background-color: #fef2f2 !important;
}
.earth-box textarea {
border-left: 4px solid #a855f7 !important;
background-color: #faf5ff !important;
}
.metal-box textarea {
border-left: 4px solid #f59e0b !important;
background-color: #fffbeb !important;
}
.water-box textarea {
border-left: 4px solid #3b82f6 !important;
background-color: #eff6ff !important;
}
.critic-box textarea {
border-left: 4px solid #6b7280 !important;
background-color: #f9fafb !important;
}
.final-report-box {
border: 2px solid #10b981 !important;
border-radius: 8px !important;
padding: 20px !important;
background: linear-gradient(to bottom, #f0fdf4, #ffffff) !important;
margin-top: 10px !important;
font-size: 14px !important;
max-height: 800px !important;
overflow-y: auto !important;
line-height: 1.8 !important;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}
.final-report-box h1 {
color: #065f46 !important;
font-size: 28px !important;
margin-bottom: 16px !important;
text-align: center !important;
font-weight: bold !important;
}
.final-report-box h2 {
color: #047857 !important;
font-size: 22px !important;
margin-top: 20px !important;
margin-bottom: 12px !important;
border-bottom: 2px solid #10b981 !important;
padding-bottom: 8px !important;
}
.final-report-box h3 {
color: #059669 !important;
font-size: 18px !important;
margin-top: 16px !important;
margin-bottom: 10px !important;
font-weight: 600 !important;
}
.final-report-box h4 {
color: #10b981 !important;
font-size: 16px !important;
margin-top: 12px !important;
margin-bottom: 8px !important;
}
.final-report-box table {
border-collapse: collapse !important;
width: 100% !important;
margin: 20px 0 !important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}
.final-report-box th, .final-report-box td {
border: 1px solid #d1d5db !important;
padding: 12px 14px !important;
text-align: left !important;
}
.final-report-box th {
background-color: #065f46 !important;
font-weight: bold !important;
color: #ffffff !important;
text-transform: uppercase !important;
font-size: 13px !important;
letter-spacing: 0.5px !important;
}
.final-report-box tr:nth-child(even) {
background-color: #f9fafb !important;
}
.final-report-box tr:hover {
background-color: #f0fdf4 !important;
transition: background-color 0.2s !important;
}
.final-report-box code {
background-color: #ecfdf5 !important;
padding: 3px 8px !important;
border-radius: 4px !important;
font-family: 'Consolas', 'Monaco', monospace !important;
color: #047857 !important;
font-size: 13px !important;
border: 1px solid #10b981 !important;
}
.final-report-box pre {
background-color: #1e293b !important;
color: #e2e8f0 !important;
padding: 16px !important;
border-radius: 8px !important;
overflow-x: auto !important;
margin: 16px 0 !important;
font-size: 13px !important;
line-height: 1.5 !important;
}
.final-report-box pre code {
background-color: transparent !important;
color: #e2e8f0 !important;
padding: 0 !important;
border: none !important;
}
.final-report-box blockquote {
border-left: 4px solid #10b981 !important;
padding-left: 16px !important;
margin: 16px 0 !important;
color: #064e3b !important;
font-style: italic !important;
background-color: #f0fdf4 !important;
padding: 14px 16px !important;
border-radius: 0 8px 8px 0 !important;
}
.final-report-box ul, .final-report-box ol {
margin-left: 24px !important;
margin-bottom: 16px !important;
}
.final-report-box li {
margin-bottom: 8px !important;
line-height: 1.8 !important;
}
.final-report-box strong {
color: #065f46 !important;
font-weight: 600 !important;
}
.final-report-box em {
color: #047857 !important;
}
.final-report-box hr {
border: none !important;
border-top: 2px solid #10b981 !important;
margin: 28px 0 !important;
}
.final-report-box a {
color: #059669 !important;
text-decoration: underline !important;
}
.final-report-box a:hover {
color: #047857 !important;
}
h1 {
text-align: center;
color: #1f2937;
margin-bottom: 10px;
}
h3 {
font-weight: 600;
margin-bottom: 8px;
}
.gradio-container {
max-width: 1400px;
margin: 0 auto;
}
"""
# Gradio ์ธํ„ฐํŽ˜์ด์Šค
with gr.Blocks(title="AGI ์˜คํ–‰ ์ „๋ฌธ ๋ณด๊ณ ์„œ ์‹œ์Šคํ…œ", theme=gr.themes.Soft(), css=css) as app:
gr.Markdown(
"""
# ๐ŸŒŸ AGI ์ˆ˜์ค€ ์˜คํ–‰ยท์˜ค์ƒ ๊ธฐ๋ฐ˜ ์ „๋ฌธ ๋ณด๊ณ ์„œ ์ž‘์„ฑ ์‹œ์Šคํ…œ
### ๐Ÿš€ ์ฐจ์„ธ๋Œ€ ์ธ๊ณต์ง€๋Šฅ ์ง‘๋‹จ์ง€์„ฑ ํ”Œ๋žซํผ
> **"๋‹ค์„ฏ ๊ฐ€์ง€ ์ „๋ฌธ์„ฑ์˜ ์‹œ๋„ˆ์ง€๋กœ ์ฐฝ์ถœํ•˜๋Š” ์ตœ๊ณ  ์ˆ˜์ค€์˜ ์ „๋žต ๋ณด๊ณ ์„œ"**
### ๐Ÿ“‹ ํ”„๋กœ์„ธ์Šค: ๆœจโ†’๋น„ํ‰โ†’็ซโ†’๋น„ํ‰โ†’ๅœŸโ†’๋น„ํ‰โ†’้‡‘โ†’๋น„ํ‰โ†’ๆฐดโ†’๋น„ํ‰โ†’ๆœจ(์ตœ์ข…)
| ์—ญํ•  | ๋•๋ชฉยท์˜คํ–‰ | AGI ์ „๋ฌธ์„ฑ |
|------|-----------|-------------|
| ๐ŸŒณ **์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž** | ไปยทๆœจ | ๋ฏธ๋ž˜์˜ˆ์ธก, ์‹œ์Šคํ…œ์  ์‚ฌ๊ณ , ํ˜์‹  ์ „๋žต |
| ๐Ÿ”ฅ **ํ˜์‹  ์ „๋žต ์•„ํ‚คํ…ํŠธ** | ็พฉยท็ซ | ํŒŒ๊ดด์  ํ˜์‹ , ๋น„์ฆˆ๋‹ˆ์Šค ๋ชจ๋ธ, ๊ฒฝ์Ÿ์šฐ์œ„ |
| ๐Ÿ”๏ธ **์‹คํ–‰ ์ตœ์ ํ™” ์ „๋ฌธ๊ฐ€** | ไฟกยทๅœŸ | ํ”„๋กœ์ ํŠธ ๊ฑฐ๋ฒ„๋„Œ์Šค, ํ’ˆ์งˆ ์‹œ์Šคํ…œ, ROI |
| โš™๏ธ **์‹œ์Šคํ…œ ์•„ํ‚คํ…์ฒ˜ ๋งˆ์Šคํ„ฐ** | ็ฆฎยท้‡‘ | ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ์„ค๊ณ„, ๊ธฐ์ˆ  ํ‘œ์ค€, ํ™•์žฅ์„ฑ |
| ๐Ÿ’ง **๋ฏธ๋ž˜๊ธฐ์ˆ  ์—ฐ๊ตฌ์†Œ์žฅ** | ๆ™บยทๆฐด | ์‹ ๊ธฐ์ˆ  R&D, AI/ML, ๊ธฐ์ˆ  ์œตํ•ฉ |
| ๐Ÿ” **์ „๋žต ๊ฒ€์ฆ ์ „๋ฌธ๊ฐ€** | ์ค‘๋ฆฝ | McKinsey๊ธ‰ ๋ถ„์„, ๋ฆฌ์Šคํฌ ํ‰๊ฐ€ |
---
**๐Ÿ’ก ๋ณธ ์‹œ์Šคํ…œ์€ AGI(Artificial General Intelligence) ์ˆ˜์ค€์˜ ๋ถ„์„๋ ฅ๊ณผ ์ฐฝ์˜์„ฑ์„ ๋ฐ”ํƒ•์œผ๋กœ**
**McKinsey, BCG, Bain ์ˆ˜์ค€์˜ ์ „๋ฌธ ์ปจ์„คํŒ… ๋ณด๊ณ ์„œ๋ฅผ ์ž๋™์œผ๋กœ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.**
"""
)
with gr.Row():
with gr.Column(scale=3):
llm_mode = gr.Radio(
choices=["default", "commercial"],
value="commercial",
label="AI ๋ชจ๋ธ ์„ ํƒ",
info="commercial: Gemini 2.5 Pro (AGI Mode) - ๊ถŒ์žฅ"
)
user_input = gr.Textbox(
label="๋ณด๊ณ ์„œ ์š”์ฒญ์‚ฌํ•ญ",
placeholder="์˜ˆ: ์šฐ๋ฆฌ ํšŒ์‚ฌ์˜ ๋””์ง€ํ„ธ ์ „ํ™˜ ์ „๋žต๊ณผ 3๊ฐœ๋…„ ์‹คํ–‰ ๋กœ๋“œ๋งต์„ ์ˆ˜๋ฆฝํ•ด์ฃผ์„ธ์š”",
lines=4
)
with gr.Row():
submit_btn = gr.Button("๐Ÿš€ ์ „๋ฌธ ๋ณด๊ณ ์„œ ์ƒ์„ฑ", variant="primary", scale=2)
clear_btn = gr.Button("๐Ÿ—‘๏ธ ์ดˆ๊ธฐํ™”", scale=1)
with gr.Column(scale=1):
status_text = gr.Textbox(
label="ํ”„๋กœ์„ธ์Šค ์ƒํƒœ",
interactive=False,
value="AGI ์‹œ์Šคํ…œ ๋Œ€๊ธฐ ์ค‘...",
lines=3
)
# ์ตœ์ข… ๋ณด๊ณ ์„œ ์„น์…˜
with gr.Row():
with gr.Column():
gr.Markdown("""
### ๐Ÿ“Š ์ตœ์ข… ์ „๋ฌธ ๋ถ„์„ ๋ณด๊ณ ์„œ
<p style="color: #666; margin-top: -10px;">Executive Summary & Strategic Recommendations</p>
""")
final_report = gr.Markdown(
value="*AGI ์ˆ˜์ค€์˜ ์ „๋ฌธ ๋ณด๊ณ ์„œ๊ฐ€ ์—ฌ๊ธฐ์— ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.*",
elem_classes=["final-report-box"]
)
# ์˜คํ–‰ ์ถœ๋ ฅ - 2x3 ๊ทธ๋ฆฌ๋“œ
with gr.Row():
with gr.Column():
gr.Markdown("### ๐ŸŒณ ๆœจ - ์ „๋žต์  ๋น„์ „ ์„ค๊ณ„์ž (ไป)")
wood_output = gr.Textbox(
label="",
lines=12,
max_lines=18,
interactive=False,
elem_classes=["wood-box"]
)
with gr.Column():
gr.Markdown("### ๐Ÿ”ฅ ็ซ - ํ˜์‹  ์ „๋žต ์•„ํ‚คํ…ํŠธ (็พฉ)")
fire_output = gr.Textbox(
label="",
lines=12,
max_lines=18,
interactive=False,
elem_classes=["fire-box"]
)
with gr.Row():
with gr.Column():
gr.Markdown("### ๐Ÿ”๏ธ ๅœŸ - ์‹คํ–‰ ์ตœ์ ํ™” ์ „๋ฌธ๊ฐ€ (ไฟก)")
earth_output = gr.Textbox(
label="",
lines=12,
max_lines=18,
interactive=False,
elem_classes=["earth-box"]
)
with gr.Column():
gr.Markdown("### โš™๏ธ ้‡‘ - ์‹œ์Šคํ…œ ์•„ํ‚คํ…์ฒ˜ ๋งˆ์Šคํ„ฐ (็ฆฎ)")
metal_output = gr.Textbox(
label="",
lines=12,
max_lines=18,
interactive=False,
elem_classes=["metal-box"]
)
with gr.Row():
with gr.Column():
gr.Markdown("### ๐Ÿ’ง ๆฐด - ๋ฏธ๋ž˜๊ธฐ์ˆ  ์—ฐ๊ตฌ์†Œ์žฅ (ๆ™บ)")
water_output = gr.Textbox(
label="",
lines=12,
max_lines=18,
interactive=False,
elem_classes=["water-box"]
)
with gr.Column():
gr.Markdown("### ๐Ÿ” ์ „๋žต ๊ฒ€์ฆ ์ „๋ฌธ๊ฐ€")
critic_output = gr.Textbox(
label="",
lines=12,
max_lines=18,
interactive=False,
elem_classes=["critic-box"]
)
# ์˜ˆ์ œ
gr.Examples(
examples=[
"์šฐ๋ฆฌ ํšŒ์‚ฌ์˜ ๋””์ง€ํ„ธ ์ „ํ™˜ ์ „๋žต๊ณผ 3๊ฐœ๋…„ ์‹คํ–‰ ๋กœ๋“œ๋งต์„ ์ˆ˜๋ฆฝํ•ด์ฃผ์„ธ์š”",
"๊ธ€๋กœ๋ฒŒ ์‹œ์žฅ ์ง„์ถœ์„ ์œ„ํ•œ ์ข…ํ•ฉ์ ์ธ ์‚ฌ์—… ์ „๋žต๊ณผ ๋ฆฌ์Šคํฌ ๋ถ„์„ ๋ณด๊ณ ์„œ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”",
"AI ๊ธฐ๋ฐ˜ ์‹ ๊ทœ ๋น„์ฆˆ๋‹ˆ์Šค ๋ชจ๋ธ ๊ฐœ๋ฐœ๊ณผ ์ˆ˜์ตํ™” ์ „๋žต์„ ์ œ์•ˆํ•ด์ฃผ์„ธ์š”",
"ESG ๊ฒฝ์˜ ์ฒด๊ณ„ ๊ตฌ์ถ•๊ณผ ์ง€์†๊ฐ€๋Šฅ์„ฑ ์ „๋žต ๋ณด๊ณ ์„œ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”",
"๋ฉ”ํƒ€๋ฒ„์Šค ํ”Œ๋žซํผ ๊ตฌ์ถ•์„ ์œ„ํ•œ ๊ธฐ์ˆ  ์•„ํ‚คํ…์ฒ˜์™€ ์‚ฌ์—… ๊ณ„ํš์„ ์ˆ˜๋ฆฝํ•ด์ฃผ์„ธ์š”",
"๊ณต๊ธ‰๋ง ์ตœ์ ํ™”์™€ ์Šค๋งˆํŠธ ํŒฉํ† ๋ฆฌ ์ „ํ™˜ ์ „๋žต์„ ๋ถ„์„ํ•ด์ฃผ์„ธ์š”",
"๋ฐ์ดํ„ฐ ๊ธฐ๋ฐ˜ ์˜์‚ฌ๊ฒฐ์ • ์ฒด๊ณ„ ๊ตฌ์ถ• ๋ฐฉ์•ˆ๊ณผ ๊ฑฐ๋ฒ„๋„Œ์Šค ๋ชจ๋ธ์„ ์ œ์‹œํ•ด์ฃผ์„ธ์š”",
"๊ณ ๊ฐ ๊ฒฝํ—˜ ํ˜์‹ ์„ ์œ„ํ•œ ์˜ด๋‹ˆ์ฑ„๋„ ์ „๋žต๊ณผ ์‹คํ–‰ ๊ณ„ํš์„ ์ˆ˜๋ฆฝํ•ด์ฃผ์„ธ์š”"
],
inputs=user_input,
label="๐Ÿ’ก ์ „๋ฌธ ๋ณด๊ณ ์„œ ์˜ˆ์ œ"
)
# ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ
submit_btn.click(
fn=process_wuxing_query,
inputs=[user_input, llm_mode],
outputs=[wood_output, fire_output, earth_output, metal_output, water_output, critic_output, final_report, status_text]
).then(
fn=lambda: "",
outputs=[user_input]
)
user_input.submit(
fn=process_wuxing_query,
inputs=[user_input, llm_mode],
outputs=[wood_output, fire_output, earth_output, metal_output, water_output, critic_output, final_report, status_text]
).then(
fn=lambda: "",
outputs=[user_input]
)
clear_btn.click(
fn=clear_wuxing,
outputs=[wood_output, fire_output, earth_output, metal_output, water_output, critic_output, final_report, status_text]
)
if __name__ == "__main__":
app.queue()
app.launch(
server_name="0.0.0.0",
server_port=7860,
share=True,
show_error=True
)