Spaces:
Runtime error
Runtime error
Upload src/app.py with huggingface_hub
Browse files- src/app.py +207 -72
src/app.py
CHANGED
|
@@ -1,86 +1,221 @@
|
|
| 1 |
-
|
| 2 |
-
import os
|
| 3 |
import streamlit as st
|
| 4 |
from openai import OpenAI
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
st.title("๋ํํ AI ์๋น์ค '์์ด๋ธ'")
|
| 12 |
-
st.write("์ด์ ๋ํ๋ฅผ ๊ธฐ์ตํ๋ฉฐ ๋ต๋ณํด ๋๋ฆฝ๋๋ค. (์ต๊ทผ 10๊ฐ ๊ธฐ๋ก ์ ์ง)")
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
# 1
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
if "messages" not in st.session_state:
|
|
|
|
| 19 |
st.session_state.messages = []
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
file_context = ""
|
| 39 |
-
if uploaded_file is not None:
|
| 40 |
-
file_context = uploaded_file.read().decode("utf-8")
|
| 41 |
-
|
| 42 |
-
# ---------------------------------------------------------
|
| 43 |
-
# ๋ต๋ณ ์์ฑ ๊ณตํต ํจ์
|
| 44 |
-
# ---------------------------------------------------------
|
| 45 |
-
def generate_answer(user_text):
|
| 46 |
-
# 1. ์ฌ์ฉ์ ๋ฉ์์ง ์ถ๊ฐ ๋ฐ ํ๋ฉด ์ถ๋ ฅ
|
| 47 |
-
st.session_state.messages.append({"role": "user", "content": user_text})
|
| 48 |
-
with st.chat_message("user"):
|
| 49 |
-
st.markdown(user_text)
|
| 50 |
-
|
| 51 |
-
# 2. LLM ํธ์ถ์ฉ ๋ฉ์์ง ๊ตฌ์ฑ
|
| 52 |
-
full_messages = [{"role": "system", "content": sys_role + (f"\n์ฐธ๊ณ ๋ฌธ์: {file_context}" if file_context else "")}]
|
| 53 |
-
full_messages.extend(st.session_state.messages)
|
| 54 |
-
|
| 55 |
-
# 3. LLM ํธ์ถ
|
| 56 |
-
with st.chat_message("assistant"):
|
| 57 |
-
with st.spinner("๋ต๋ณ์ ์๊ฐ ์ค์
๋๏ฟฝ๏ฟฝ๏ฟฝ..."):
|
| 58 |
-
response = client.chat.completions.create(
|
| 59 |
-
model="gpt-4o-mini",
|
| 60 |
-
messages=full_messages
|
| 61 |
-
)
|
| 62 |
-
answer = response.choices[0].message.content
|
| 63 |
-
st.markdown(answer)
|
| 64 |
-
|
| 65 |
-
# 4. AI ์๋ต ์ ์ฅ ๋ฐ ๊ธฐ๋ก ๊ด๋ฆฌ
|
| 66 |
-
st.session_state.messages.append({"role": "assistant", "content": answer})
|
| 67 |
if len(st.session_state.messages) > 10:
|
| 68 |
st.session_state.messages = st.session_state.messages[-10:]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
#
|
| 71 |
-
|
| 72 |
-
#
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
generate_answer(transcript.text)
|
| 82 |
-
|
| 83 |
-
# (๋ฐฉ๋ฒ 2) ์ฑํ
์
๋ ฅ์ด ๋ค์ด์์ ๋ (์๋ก ์ถ๊ฐ๋ ๊ธฐ๋ฅ)
|
| 84 |
-
user_chat_input = st.chat_input("๋ฉ์์ง๋ฅผ ์
๋ ฅํ์ธ์...")
|
| 85 |
-
if user_chat_input:
|
| 86 |
-
generate_answer(user_chat_input)
|
|
|
|
| 1 |
+
import os, json, re, io
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
from openai import OpenAI
|
| 4 |
+
from PIL import Image
|
| 5 |
+
from datetime import datetime
|
| 6 |
|
| 7 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 8 |
+
# 1. ์ด๊ธฐ ์ค์ ๋ฐ CSS ๋ก๋
|
| 9 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 10 |
+
def local_css(file_name):
|
| 11 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 12 |
+
css_path = os.path.join(current_dir, file_name)
|
| 13 |
+
if os.path.exists(css_path):
|
| 14 |
+
with open(css_path, encoding="utf-8") as f:
|
| 15 |
+
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
|
| 16 |
|
| 17 |
+
st.set_page_config(page_title="MeetingAI | KT Enterprise", page_icon="๐๏ธ", layout="wide")
|
| 18 |
+
local_css("style.css")
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
# ๊ฒฝ๋ก ๋ฐ ํด๋ผ์ด์ธํธ ์ค์
|
| 21 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 22 |
+
img_path = os.path.join(current_dir, "kt.png")
|
| 23 |
+
client = OpenAI()
|
| 24 |
|
| 25 |
+
# [์์ ์์น 1] ์ธ์
์ํ ์ด๊ธฐํ (๋ฉํฐํด ๋ฐ ํ์คํ ๋ฆฌ ๊ด๋ฆฌ)
|
| 26 |
+
if "analysis_result" not in st.session_state:
|
| 27 |
+
st.session_state.analysis_result = None
|
| 28 |
+
if "transcript" not in st.session_state:
|
| 29 |
+
st.session_state.transcript = ""
|
| 30 |
if "messages" not in st.session_state:
|
| 31 |
+
# ๋ํ ํ์คํ ๋ฆฌ๋ฅผ ์ ์ฅํ ๋ฆฌ์คํธ (Role๊ณผ Content ํฌํจ)
|
| 32 |
st.session_state.messages = []
|
| 33 |
|
| 34 |
+
# ์ฐ์ ์์ ๋ผ๋ฒจ ์ค์
|
| 35 |
+
PRIORITY_LABEL = {"high": "๐ด ๋์", "medium": "๐ก ๋ณดํต", "low": "๐ข ๋ฎ์"}
|
| 36 |
+
|
| 37 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 38 |
+
# 2. ๋ฐฑ์๋ ํต์ฌ ํจ์ (๋ฏผ๊ฐ์ ๋ณด ๊ฐ์ง, ๋ถ์)
|
| 39 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 40 |
+
|
| 41 |
+
def detect_sensitive(text):
|
| 42 |
+
SENSITIVE_PATTERNS = [
|
| 43 |
+
(r"๊ธฐ๋ฐ|๋น๋ฐ|๋์ธ๋น|๋ด๋ถ.*๋ณด์|๋ณด์.*์ ์ง|confidential", "๊ธฐ๋ฐ/๋์ธ๋น ํํ"),
|
| 44 |
+
(r"๊ธ์ฌ|์ฐ๋ด|์๊ธ|salary", "๊ธ์ฌยท์ธ์ฌ ์ ๋ณด"),
|
| 45 |
+
(r"๊ฐ์ธ์ ๋ณด|์ฃผ๋ฏผ|์๋
์์ผ", "๊ฐ์ธ์ ๋ณด"),
|
| 46 |
+
(r"\d{3}-\d{4}-\d{4}", "์ ํ๋ฒํธ ํจํด"),
|
| 47 |
+
(r"\d{6}-\d{7}", "์ฃผ๋ฏผ๋ฒํธ ํจํด"),
|
| 48 |
+
]
|
| 49 |
+
return list({label for pat, label in SENSITIVE_PATTERNS if re.search(pat, text, re.IGNORECASE)})
|
| 50 |
|
| 51 |
+
sys_role = """
|
| 52 |
+
## ์ญํ
|
| 53 |
+
๋น์ ์ KT Enterprise IT๊ธฐ์ ํ์ ํ DX Consulting์ AI ํ์ ๋น์์
๋๋ค.
|
| 54 |
+
ํ์ ๋ด์ฉ์ ์ ํํ๊ณ ์ ์ํ๊ฒ ๋ถ์ยท์ ๋ฆฌํฉ๋๋ค. ๋ชจ๋ ์๋ต์ ํ๊ตญ์ด๋ก ์์ฑํฉ๋๋ค.
|
| 55 |
+
|
| 56 |
+
## ํ์๋ก ์ ๋ฆฌ ๊ท์น
|
| 57 |
+
1. ํ์ ๊ฐ์ โ ์ ๋ชฉ / ๋ชฉ์ / ์ฃผ์ ์๊ฑด
|
| 58 |
+
2. ๊ฒฐ์ ๋ ์ฌํญ โ ํต์ฌ ๊ฒฐ์ ๋ง ๊ฐ๊ฒฐํ๊ฒ
|
| 59 |
+
3. ๋ด๋น ์
๋ฌด(Action Items) โ [๋ด๋น์]:[์
๋ฌด]/๊ธฐํ/์ฐ์ ์์
|
| 60 |
+
4. ์ผ์ ์์ฝ โ ๋ง๊ฐ ๊ธฐํ ์๊ฐ์ ์ ๋ฆฌ
|
| 61 |
+
"""
|
| 62 |
+
|
| 63 |
+
# [์์ ์์น 2] ๋ถ์ ํจ์ ๋ณ๊ฒฝ (ํ์คํ ๋ฆฌ ํฌํจ ๋ฉํฐํด ๊ตฌํ)
|
| 64 |
+
def analyze_meeting(text):
|
| 65 |
+
today = datetime.now().strftime("%Y๋
%m์ %d์ผ")
|
| 66 |
|
| 67 |
+
# 1. ํ์ฌ ์ฌ์ฉ์ ๋ฉ์์ง ์ถ๊ฐ
|
| 68 |
+
user_message = {"role": "user", "content": f"ํ์ ๋ด์ฉ:\n{text}\n\n์ ๋ด์ฉ์ JSON ํ์์ผ๋ก ๋ถ์ํด์ค."}
|
| 69 |
+
|
| 70 |
+
# 2. ํ์คํ ๋ฆฌ ๊ด๋ฆฌ (์ต๋ 10๊ฐ ์ ์ง: ์ง๋ฌธ+๋ต๋ณ ์ ๊ณ ๋ ค ์ 20๊ฐ ์์๊ฐ ๋ ์ ์์ผ๋,
|
| 71 |
+
# ์ฌ๊ธฐ์๋ '๋ํ ํ์ฐจ' ๊ธฐ์ค์ผ๋ก ์ต๊ทผ 10๊ฐ๋ฅผ ์ ์งํ๋๋ก ์ฌ๋ผ์ด์ฑ)
|
| 72 |
+
st.session_state.messages.append(user_message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
if len(st.session_state.messages) > 10:
|
| 74 |
st.session_state.messages = st.session_state.messages[-10:]
|
| 75 |
+
|
| 76 |
+
# 3. ํ๋กฌํํธ ๊ตฌ์ฑ (์์คํ
์ญํ + ํ์คํ ๋ฆฌ)
|
| 77 |
+
full_messages = [{"role": "system", "content": sys_role + f"\n์ค๋ ๋ ์ง: {today}. ๋ฐ๋์ JSON๋ง ์ถ๋ ฅํ์ธ์."}] + st.session_state.messages
|
| 78 |
+
|
| 79 |
+
resp = client.chat.completions.create(
|
| 80 |
+
model="gpt-4o",
|
| 81 |
+
messages=full_messages,
|
| 82 |
+
temperature=0.2,
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
ai_content = resp.choices[0].message.content.strip()
|
| 86 |
+
|
| 87 |
+
# 4. AI ์๋ต์ ํ์คํ ๋ฆฌ์ ์ ์ฅ
|
| 88 |
+
st.session_state.messages.append({"role": "assistant", "content": ai_content})
|
| 89 |
+
|
| 90 |
+
# JSON ํ์ฑ
|
| 91 |
+
raw = re.sub(r"^```json\s*|```\s*$", "", ai_content)
|
| 92 |
+
return json.loads(raw)
|
| 93 |
+
|
| 94 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 95 |
+
# 3. UI ๋ ์ด์์ ๊ตฌ์ฑ (ํค๋ ๋ฐ ์
๋ ฅ๋ถ)
|
| 96 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 97 |
+
|
| 98 |
+
# ์๋จ ํค๋ ์์ญ (ํฌ๊ธฐ ํ๋ ๋ฒ์ )
|
| 99 |
+
st.markdown("""
|
| 100 |
+
<div style="display:flex;align-items:center;gap:20px;padding:25px 30px;
|
| 101 |
+
background:linear-gradient(135deg,#16213E 0%,#0F3460 100%);
|
| 102 |
+
border-bottom:4px solid #E3000B;border-radius:15px;margin-bottom:25px;">
|
| 103 |
+
<div style="font-family:'Rajdhani',sans-serif;font-size:3.5rem;font-weight:800;
|
| 104 |
+
color:#E3000B;letter-spacing:1px;line-height:1;">KT</div>
|
| 105 |
+
<div class="title-container">
|
| 106 |
+
<div class="main-title" style="font-size:2.2rem; font-weight:700; color:#FFFFFF;">Meeting AI ํ์ ๋ถ์ ์ด์์คํดํธ</div>
|
| 107 |
+
<div class="sub-title" style="font-size:1.0rem; color:#E0E0E0; margin-top:5px;">IT๊ธฐ์ ํ์ ํ DX Consulting ยท Intelligent Meeting Solution</div>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
""", unsafe_allow_html=True)
|
| 111 |
+
|
| 112 |
+
col1, col2 = st.columns([1, 2], gap="large")
|
| 113 |
+
|
| 114 |
+
with col1:
|
| 115 |
+
try:
|
| 116 |
+
st.image(Image.open(img_path), caption="KT DX Assistant", use_container_width=True)
|
| 117 |
+
except:
|
| 118 |
+
st.info("์ด๋ฏธ์ง(kt.png)๋ฅผ ๋ถ๋ฌ์ฌ ์ ์์ต๋๋ค.")
|
| 119 |
+
|
| 120 |
+
with col2:
|
| 121 |
+
st.subheader("ํ์๋ก์ ์
๋ก๋ํ์๋ฉด ์์ฝํด๋๋ฆฌ๊ฒ ์ต๋๋ค.")
|
| 122 |
+
with st.container(border=True):
|
| 123 |
+
uploaded_file = st.file_uploader("๐ ํ์ ๋ด์ฉ ํ
์คํธ ํ์ผ ์
๋ก๋", type=["txt"])
|
| 124 |
+
|
| 125 |
+
st.write("**์์ฒญ ๋ฐฉ์ ์ ํ**")
|
| 126 |
+
input_mode = st.radio("์์ฒญ ๋ฐฉ์", ["๐๏ธ ์ค์๊ฐ ๋
น์", "๐ ์์ฑ ํ์ผ ์
๋ก๋", "๐ ํ
์คํธ ์
๋ ฅ"], horizontal=True, label_visibility="collapsed")
|
| 127 |
+
|
| 128 |
+
audio_value = None
|
| 129 |
+
uploaded_audio_file = None
|
| 130 |
+
text_input = ""
|
| 131 |
+
|
| 132 |
+
if input_mode == "๐๏ธ ์ค์๊ฐ ๋
น์":
|
| 133 |
+
audio_value = st.audio_input("์์ฑ์ผ๋ก ๋ด์ฉ์ ๋งํด์ฃผ์ธ์.")
|
| 134 |
+
elif input_mode == "๐ ์์ฑ ํ์ผ ์
๋ก๋":
|
| 135 |
+
uploaded_audio_file = st.file_uploader("์์ฑ ํ์ผ ์
๋ก๋", type=["mp3", "wav", "m4a"])
|
| 136 |
+
else:
|
| 137 |
+
text_input = st.text_area("๋ด์ฉ์ ์ง์ ์
๋ ฅํ์ธ์.", height=150)
|
| 138 |
+
|
| 139 |
+
submit = st.button("๐ ํ์ ๋ถ์ ์์", use_container_width=True)
|
| 140 |
+
|
| 141 |
+
if submit:
|
| 142 |
+
meeting_text = ""
|
| 143 |
+
if uploaded_file:
|
| 144 |
+
meeting_text = uploaded_file.read().decode("utf-8")
|
| 145 |
+
|
| 146 |
+
with st.spinner("AI๊ฐ ๋ด์ฉ์ ๋ถ์ ์ค์
๋๋ค..."):
|
| 147 |
+
try:
|
| 148 |
+
user_req = ""
|
| 149 |
+
if audio_value:
|
| 150 |
+
user_req = client.audio.transcriptions.create(model="whisper-1", file=("audio.wav", audio_value, "audio/wav")).text
|
| 151 |
+
elif uploaded_audio_file:
|
| 152 |
+
user_req = client.audio.transcriptions.create(model="whisper-1", file=(uploaded_audio_file.name, uploaded_audio_file, uploaded_audio_file.type)).text
|
| 153 |
+
else:
|
| 154 |
+
user_req = text_input
|
| 155 |
+
|
| 156 |
+
final_content = (meeting_text + "\n" + user_req).strip()
|
| 157 |
+
|
| 158 |
+
if not final_content:
|
| 159 |
+
st.warning("๋ถ์ํ ๋ด์ฉ์ด ์์ต๋๋ค.")
|
| 160 |
+
else:
|
| 161 |
+
st.session_state.transcript = final_content
|
| 162 |
+
st.session_state.analysis_result = analyze_meeting(final_content)
|
| 163 |
+
st.rerun()
|
| 164 |
+
except Exception as e:
|
| 165 |
+
st.error(f"์ค๋ฅ ๋ฐ์: {e}")
|
| 166 |
+
|
| 167 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 168 |
+
# 4. ๊ฒฐ๊ณผ ์ถ๋ ฅ ์์ญ (Tabs ํ์ฉ)
|
| 169 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 170 |
+
if st.session_state.analysis_result:
|
| 171 |
+
res = st.session_state.analysis_result
|
| 172 |
+
hits = detect_sensitive(st.session_state.transcript)
|
| 173 |
+
if hits:
|
| 174 |
+
st.error(f"๐ ๋ฏผ๊ฐ์ ๋ณด ๊ฐ์ง: {', '.join(hits)} ํญ๋ชฉ ์ฃผ์")
|
| 175 |
+
|
| 176 |
+
tab1, tab2, tab3,tab4 = st.tabs(["๐ ํ์ ์์ฝ", "โ
ํ ์ผ & ์ฐ์ ์์", "๐ ์๋ฌธ ๋ณด๊ธฐ"],"๐ ํ์คํ ๋ฆฌ")
|
| 177 |
+
|
| 178 |
+
with tab1:
|
| 179 |
+
st.markdown(f"### ๐ {res.get('meeting_title', 'ํ์ ๊ฒฐ๊ณผ')}")
|
| 180 |
+
st.info(f"**ํ์ ๋ชฉ์ :** {res.get('purpose', '๋ด์ฉ ์์')}")
|
| 181 |
+
|
| 182 |
+
c1, c2 = st.columns(2)
|
| 183 |
+
with c1:
|
| 184 |
+
st.subheader("โ
๊ฒฐ์ ์ฌํญ")
|
| 185 |
+
for d in res.get('decisions', []): st.write(f"- {d}")
|
| 186 |
+
with c2:
|
| 187 |
+
st.subheader("๐ ์ฃผ์ ์๊ฑด")
|
| 188 |
+
for a in res.get('agenda_items', []): st.write(f"- {a}")
|
| 189 |
+
|
| 190 |
+
st.divider()
|
| 191 |
+
st.subheader("๐ฌ ์ ์ฒด ์์ฝ")
|
| 192 |
+
st.write(res.get('summary', '์์ฝ ๋ด์ฉ ์์'))
|
| 193 |
+
|
| 194 |
+
with tab2:
|
| 195 |
+
tasks = res.get('tasks', [])
|
| 196 |
+
if not tasks:
|
| 197 |
+
st.write("๋ฐฐ์ ๋ ํ ์ผ์ด ์์ต๋๋ค.")
|
| 198 |
+
else:
|
| 199 |
+
for t in tasks:
|
| 200 |
+
p = t.get('priority', 'low').lower()
|
| 201 |
+
label = PRIORITY_LABEL.get(p, "๐ข ๋ฎ์")
|
| 202 |
+
deadline = f" (๊ธฐํ: {t['deadline']})" if t.get('deadline') and t['deadline'] != "null" else ""
|
| 203 |
+
st.markdown(f"**{label} [{t.get('person', '๋ฏธ์ง์ ')}]** : {t.get('task')}{deadline}")
|
| 204 |
+
|
| 205 |
+
with tab3:
|
| 206 |
+
st.markdown("#### ๐ ํต์ฌ ํค์๋")
|
| 207 |
+
st.write(", ".join([f"#{k}" for k in res.get('keywords', [])]))
|
| 208 |
+
st.divider()
|
| 209 |
+
st.text_area("์ ์ฌ ์๋ฌธ", st.session_state.transcript, height=300)
|
| 210 |
|
| 211 |
+
# [์ถ๊ฐ] 4๋ฒ์งธ ํญ: ๋ํ ํ์คํ ๋ฆฌ ์๊ฐํ
|
| 212 |
+
with tab4:
|
| 213 |
+
st.markdown("#### ๐ ์ต๊ทผ ๋ํ ๊ธฐ๋ก (์ต๋ 10๊ฐ)")
|
| 214 |
+
for i, msg in enumerate(st.session_state.messages):
|
| 215 |
+
role = "๐ค ์ฌ์ฉ์" if msg["role"] == "user" else "๐ค AI ๋น์"
|
| 216 |
+
with st.chat_message(msg["role"]):
|
| 217 |
+
st.write(f"**{role}**")
|
| 218 |
+
if msg["role"] == "assistant":
|
| 219 |
+
st.caption("JSON ๋ฐ์ดํฐ๊ฐ ์ ์ฅ๋์์ต๋๋ค.")
|
| 220 |
+
else:
|
| 221 |
+
st.write(msg["content"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|