Spaces:
Runtime error
Runtime error
Upload src/app.py with huggingface_hub
Browse files- src/app.py +603 -56
src/app.py
CHANGED
|
@@ -1,67 +1,614 @@
|
|
| 1 |
|
| 2 |
-
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import streamlit as st
|
| 4 |
from openai import OpenAI
|
| 5 |
|
| 6 |
-
#
|
|
|
|
|
|
|
| 7 |
client = OpenAI()
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
st.
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
# STT: ์์ฑ โ ํ
์คํธ
|
| 49 |
-
transcript = client.audio.transcriptions.create(
|
| 50 |
-
model="whisper-1",
|
| 51 |
-
file=("audio.wav", audio_value, "audio/wav"))
|
| 52 |
-
|
| 53 |
-
# ์ฌ์ฉ์ ๋ฉ์์ง
|
| 54 |
-
input_messages.append({"role": "user", "content": transcript.text})
|
| 55 |
-
|
| 56 |
-
# LLM ํธ์ถ ๋ฐ ์๋ต ๋ฃ๊ธฐ
|
| 57 |
-
with st.spinner("๋ต๋ณ์ ์ค๋นํ๊ณ ์์ต๋๋ค..."):
|
| 58 |
-
# LLM ํธ์ถ
|
| 59 |
-
response = client.responses.create(
|
| 60 |
-
model="gpt-4o-mini",
|
| 61 |
-
input=input_messages
|
| 62 |
)
|
| 63 |
-
answer = response.output_text
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
+
import os
|
| 3 |
+
import io
|
| 4 |
+
import json
|
| 5 |
+
import re
|
| 6 |
+
import requests
|
| 7 |
+
from datetime import datetime
|
| 8 |
+
|
| 9 |
import streamlit as st
|
| 10 |
from openai import OpenAI
|
| 11 |
|
| 12 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 13 |
+
# ๊ธฐ๋ณธ ์ค์
|
| 14 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 15 |
client = OpenAI()
|
| 16 |
|
| 17 |
+
st.set_page_config(
|
| 18 |
+
page_title="MeetingAI | KT Enterprise",
|
| 19 |
+
page_icon="๐๏ธ",
|
| 20 |
+
layout="wide",
|
| 21 |
+
initial_sidebar_state="expanded",
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 25 |
+
# CSS (์ ์ ์์ ์ ์ฉ โ ๋์ HTML์ inline style ์ฌ์ฉ)
|
| 26 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 27 |
+
st.markdown("""
|
| 28 |
+
<style>
|
| 29 |
+
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&family=Rajdhani:wght@500;600;700&display=swap');
|
| 30 |
+
|
| 31 |
+
html, body, [data-testid="stAppViewContainer"] {
|
| 32 |
+
background: #1A1A2E !important;
|
| 33 |
+
font-family: 'Noto Sans KR', sans-serif !important;
|
| 34 |
+
color: #FFFFFF !important;
|
| 35 |
+
}
|
| 36 |
+
[data-testid="stSidebar"] {
|
| 37 |
+
background: #16213E !important;
|
| 38 |
+
border-right: 1px solid #2A3550;
|
| 39 |
+
}
|
| 40 |
+
[data-testid="stMainBlockContainer"] { padding-top: 24px !important; }
|
| 41 |
+
|
| 42 |
+
/* ์
๋ ฅ ์ปจํ
์ด๋ */
|
| 43 |
+
.input-title {
|
| 44 |
+
background: #16213E;
|
| 45 |
+
border: 1px solid #2A3550;
|
| 46 |
+
border-bottom: none;
|
| 47 |
+
border-radius: 12px 12px 0 0;
|
| 48 |
+
padding: 14px 22px 10px 22px;
|
| 49 |
+
font-size: 0.74rem; font-weight: 600;
|
| 50 |
+
color: #8892A4; letter-spacing: 1.5px; text-transform: uppercase;
|
| 51 |
+
}
|
| 52 |
+
[data-testid="stVerticalBlockBorderWrapper"] {
|
| 53 |
+
background: #16213E !important;
|
| 54 |
+
border: 1px solid #2A3550 !important;
|
| 55 |
+
border-top: none !important;
|
| 56 |
+
border-radius: 0 0 12px 12px !important;
|
| 57 |
+
padding: 16px 20px 20px !important;
|
| 58 |
+
margin-bottom: 14px !important;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/* ์ฌ์ด๋๋ฐ ๋ผ๋ฒจ */
|
| 62 |
+
.sb-label {
|
| 63 |
+
font-size: 0.7rem; color: #8892A4;
|
| 64 |
+
letter-spacing: 1.2px; text-transform: uppercase;
|
| 65 |
+
margin: 4px 0 8px 0;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/* Streamlit ์์ ฏ */
|
| 69 |
+
[data-testid="stButton"] > button {
|
| 70 |
+
background: #E3000B !important; color: white !important;
|
| 71 |
+
border: none !important; border-radius: 8px !important;
|
| 72 |
+
font-family: 'Noto Sans KR', sans-serif !important;
|
| 73 |
+
font-weight: 600 !important; font-size: 0.9rem !important;
|
| 74 |
+
padding: 10px 24px !important; transition: all 0.2s !important;
|
| 75 |
+
}
|
| 76 |
+
[data-testid="stButton"] > button:hover {
|
| 77 |
+
background: #c0000a !important;
|
| 78 |
+
box-shadow: 0 4px 16px rgba(227,0,11,0.4) !important;
|
| 79 |
+
transform: translateY(-1px) !important;
|
| 80 |
+
}
|
| 81 |
+
[data-testid="stTextArea"] textarea,
|
| 82 |
+
[data-testid="stTextInput"] input {
|
| 83 |
+
background: rgba(15,33,62,0.9) !important;
|
| 84 |
+
border: 1px solid #2A3550 !important;
|
| 85 |
+
color: #FFFFFF !important; border-radius: 8px !important;
|
| 86 |
+
font-family: 'Noto Sans KR', sans-serif !important;
|
| 87 |
+
}
|
| 88 |
+
[data-testid="stTextArea"] textarea:focus,
|
| 89 |
+
[data-testid="stTextInput"] input:focus {
|
| 90 |
+
border-color: #E3000B !important;
|
| 91 |
+
box-shadow: 0 0 0 2px rgba(227,0,11,0.2) !important;
|
| 92 |
+
}
|
| 93 |
+
[data-testid="stFileUploader"] {
|
| 94 |
+
border: 1.5px dashed #2A3550 !important;
|
| 95 |
+
border-radius: 8px !important; background: rgba(15,33,62,0.5) !important;
|
| 96 |
+
}
|
| 97 |
+
[data-testid="stTabs"] [data-baseweb="tab-list"] {
|
| 98 |
+
background: #16213E !important; border-bottom: 1px solid #2A3550 !important;
|
| 99 |
+
}
|
| 100 |
+
[data-testid="stTabs"] [data-baseweb="tab"] {
|
| 101 |
+
background: transparent !important; color: #8892A4 !important;
|
| 102 |
+
font-family: 'Noto Sans KR', sans-serif !important;
|
| 103 |
+
font-size: 0.875rem !important; font-weight: 500 !important;
|
| 104 |
+
padding: 10px 18px !important;
|
| 105 |
+
}
|
| 106 |
+
[data-testid="stTabs"] [aria-selected="true"] {
|
| 107 |
+
background: rgba(227,0,11,0.08) !important;
|
| 108 |
+
color: #FFFFFF !important; border-bottom: 2px solid #E3000B !important;
|
| 109 |
+
}
|
| 110 |
+
[data-testid="stExpander"] {
|
| 111 |
+
background: rgba(15,52,96,0.3) !important;
|
| 112 |
+
border: 1px solid #2A3550 !important; border-radius: 8px !important;
|
| 113 |
+
}
|
| 114 |
+
label, [data-testid="stWidgetLabel"] p {
|
| 115 |
+
color: #8892A4 !important; font-size: 0.82rem !important;
|
| 116 |
+
}
|
| 117 |
+
p, .stMarkdown p { color: #F0F4F8 !important; }
|
| 118 |
+
h1,h2,h3 { color: #FFFFFF !important; }
|
| 119 |
+
[data-testid="stRadio"] label { color: #F0F4F8 !important; font-size: 0.88rem !important; }
|
| 120 |
+
[data-testid="stToggle"] p { color: #F0F4F8 !important; font-size: 0.88rem !important; }
|
| 121 |
+
|
| 122 |
+
/* Hugging Face Space ์๋จ ์ฌ๋ฐฑ & ํฐ์ ํค๋ ์ ๊ฑฐ */
|
| 123 |
+
[data-testid="stAppViewContainer"] > .main { padding-top: 1rem !important; }
|
| 124 |
+
[data-testid="stHeader"] { background: #1A1A2E !important; border-bottom: none !important; }
|
| 125 |
+
[data-testid="stToolbar"] { background: #1A1A2E !important; }
|
| 126 |
+
[data-testid="stDecoration"] { background: #1A1A2E !important; }
|
| 127 |
+
</style>
|
| 128 |
+
""", unsafe_allow_html=True)
|
| 129 |
+
|
| 130 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 131 |
+
# ์ธ๋ผ์ธ ์คํ์ผ ์์ (๋์ HTML์์ ํด๋์ค ๋์ ์ฌ์ฉ)
|
| 132 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 133 |
+
S = {
|
| 134 |
+
"card": (
|
| 135 |
+
"background:#16213E;border:1px solid #2A3550;border-radius:12px;"
|
| 136 |
+
"padding:20px 24px;margin-bottom:14px;box-shadow:0 4px 24px rgba(0,0,0,0.35);"
|
| 137 |
+
),
|
| 138 |
+
"card_title": (
|
| 139 |
+
"font-size:0.74rem;font-weight:600;color:#8892A4;"
|
| 140 |
+
"letter-spacing:1.5px;text-transform:uppercase;margin-bottom:14px;"
|
| 141 |
+
),
|
| 142 |
+
"timeline_row": "display:flex;gap:12px;margin-bottom:10px;align-items:flex-start;",
|
| 143 |
+
"timeline_dot": (
|
| 144 |
+
"width:9px;height:9px;border-radius:50%;background:#E3000B;"
|
| 145 |
+
"margin-top:5px;flex-shrink:0;"
|
| 146 |
+
),
|
| 147 |
+
"timeline_text": "font-size:0.875rem;color:#F0F4F8;line-height:1.6;",
|
| 148 |
+
"badge_high": "display:inline-block;padding:2px 9px;border-radius:20px;font-size:0.7rem;font-weight:600;background:rgba(227,0,11,0.15);color:#E3000B;border:1px solid rgba(227,0,11,0.3);",
|
| 149 |
+
"badge_med": "display:inline-block;padding:2px 9px;border-radius:20px;font-size:0.7rem;font-weight:600;background:rgba(255,184,0,0.12);color:#FFB800;border:1px solid rgba(255,184,0,0.3);",
|
| 150 |
+
"badge_low": "display:inline-block;padding:2px 9px;border-radius:20px;font-size:0.7rem;font-weight:600;background:rgba(0,200,151,0.12);color:#00C897;border:1px solid rgba(0,200,151,0.3);",
|
| 151 |
+
"badge_gray": "display:inline-block;padding:2px 9px;border-radius:20px;font-size:0.7rem;font-weight:600;background:rgba(136,146,164,0.12);color:#8892A4;border:1px solid rgba(136,146,164,0.3);",
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
PRIORITY_LABEL = {"high": "๐ด ๋์", "medium": "๐ก ๋ณดํต", "low": "๐ข ๋ฎ์"}
|
| 155 |
+
PRIORITY_BADGE_KEY = {"high": "badge_high", "medium": "badge_med", "low": "badge_low"}
|
| 156 |
+
PRIORITY_BORDER = {"high": "#FF4444", "medium": "#FFB800", "low": "#00C897"}
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 160 |
+
# ์ธ์
์ํ
|
| 161 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 162 |
+
for k, v in {
|
| 163 |
+
"transcript": "", "analysis": None,
|
| 164 |
+
"audio_bytes": None, "mail_body": "", "tts_bytes": None,
|
| 165 |
+
}.items():
|
| 166 |
+
if k not in st.session_state:
|
| 167 |
+
st.session_state[k] = v
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 171 |
+
# ํฌํผ ํจ์
|
| 172 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 173 |
+
SECURE_KEYWORDS = ["๋ณด์", "๊ธฐ๋ฐ", "๋์ธ๋น", "๊ตฐ์ฌ", "๋น๋ฐ", "๋ด๋ถ์๋ฃ", "confidential"]
|
| 174 |
+
SENSITIVE_PATTERNS = [
|
| 175 |
+
(r"๊ธฐ๋ฐ|๋น๋ฐ|๋์ธ๋น|๋ด๋ถ.*๋ณด์|๋ณด์.*์ ์ง|confidential", "๊ธฐ๋ฐ/๋์ธ๋น ํํ"),
|
| 176 |
+
(r"๊ธ์ฌ|์ฐ๋ด|์๊ธ|salary", "๊ธ์ฌยท์ธ์ฌ ์ ๋ณด"),
|
| 177 |
+
(r"๊ฐ์ธ์ ๋ณด|์ฃผ๋ฏผ|์๋
์์ผ", "๊ฐ์ธ์ ๋ณด"),
|
| 178 |
+
(r"\d{3}-\d{4}-\d{4}", "์ ํ๋ฒํธ ํจํด"),
|
| 179 |
+
(r"\d{6}-\d{7}", "์ฃผ๋ฏผ๋ฒํธ ํจํด"),
|
| 180 |
+
(r"๊ณ์ฝ๊ธ|๋จ๊ฐ|์์ฐ.*์ต|์์ฐ.*์ฒ๋ง", "๊ธ์กยท๊ณ์ฝ ์ ๋ณด"),
|
| 181 |
+
]
|
| 182 |
+
|
| 183 |
+
def is_secure_content(text):
|
| 184 |
+
return any(kw in text for kw in SECURE_KEYWORDS)
|
| 185 |
+
|
| 186 |
+
def detect_sensitive(text):
|
| 187 |
+
return list({label for pat, label in SENSITIVE_PATTERNS
|
| 188 |
+
if re.search(pat, text, re.IGNORECASE)})
|
| 189 |
+
|
| 190 |
+
def stt(audio_file):
|
| 191 |
+
return client.audio.transcriptions.create(
|
| 192 |
+
model="whisper-1", file=audio_file, language="ko"
|
| 193 |
+
).text
|
| 194 |
+
|
| 195 |
+
SYS_ROLE = """
|
| 196 |
+
## ์ญํ
|
| 197 |
+
๋น์ ์ KT Enterprise IT๊ธฐ์ ํ์ ํ DX Consulting์ AI ํ์ ๋น์์
๋๋ค.
|
| 198 |
+
ํ์ ๋ด์ฉ์ ์ ํํ๊ณ ์ ์ํ๊ฒ ๋ถ์ยท์ ๋ฆฌํฉ๋๋ค. ๋ชจ๋ ์๋ต์ ํ๊ตญ์ด๋ก ์์ฑํฉ๋๋ค.
|
| 199 |
|
| 200 |
+
## ํ์๋ก ์ ๋ฆฌ ๊ท์น
|
| 201 |
+
1. ํ์ ๊ฐ์ โ ์ ๋ชฉ / ๋ชฉ์ / ์ฃผ์ ์๊ฑด
|
| 202 |
+
2. ๊ฒฐ์ ๋ ์ฌํญ โ ํต์ฌ ๊ฒฐ์ ๋ง ๊ฐ๊ฒฐํ๊ฒ
|
| 203 |
+
3. ๋ด๋น ์
๋ฌด(Action Items) โ [๋ด๋น์]:[์
๋ฌด]/๊ธฐํ/์ฐ์ ์์
|
| 204 |
+
4. ์ผ์ ์์ฝ โ ๋ง๊ฐ ๊ธฐํ ์๊ฐ์ ์ ๋ฆฌ
|
| 205 |
+
|
| 206 |
+
## ์ฃผ์์ฌํญ
|
| 207 |
+
- ํ์๋ก์ ์๋ ๋ด์ฉ์ ์ถ๊ฐํ์ง ์์ต๋๋ค.
|
| 208 |
+
- ๋ถ๋ช
ํํ ๋ด์ฉ์ 'ํ์ธ ํ์'๋ก ํ์ํฉ๋๋ค.
|
| 209 |
+
"""
|
| 210 |
+
|
| 211 |
+
def analyze_meeting(text):
|
| 212 |
+
today = datetime.now().strftime("%Y๋
%m์ %d์ผ")
|
| 213 |
+
prompt = f"""
|
| 214 |
+
๋ค์์ ์ค๋({today}) ์งํ๋ ํ์ ๋ด์ฉ์
๋๋ค.
|
| 215 |
+
์๋ JSON ํ์์ผ๋ก ๋ถ์ํ์ธ์. ๋ฐ๋์ JSON๋ง ์ถ๋ ฅํ์ธ์.
|
| 216 |
+
|
| 217 |
+
ํ์ ๋ด๏ฟฝ๏ฟฝ:
|
| 218 |
+
{text}
|
| 219 |
+
|
| 220 |
+
{{
|
| 221 |
+
"meeting_title": "ํ์ ์ ๋ชฉ",
|
| 222 |
+
"purpose": "ํ์ ๋ชฉ์ (2-3๋ฌธ์ฅ)",
|
| 223 |
+
"decisions": ["๊ฒฐ์ ์ฌํญ 1", "๊ฒฐ์ ์ฌํญ 2"],
|
| 224 |
+
"tasks": [
|
| 225 |
+
{{"person":"๋ด๋น์","task":"์
๋ฌด ๋ด์ฉ","deadline":"๊ธฐํ ๋๋ null","priority":"high|medium|low"}}
|
| 226 |
+
],
|
| 227 |
+
"agenda_items": ["์๊ฑด 1", "์๊ฑด 2"],
|
| 228 |
+
"next_meeting": "๋ค์ ํ์ ์ผ์ ๋๋ null",
|
| 229 |
+
"summary": "์ ์ฒด ์์ฝ (4-5๋ฌธ์ฅ)",
|
| 230 |
+
"keywords": ["ํค์๋1", "ํค์๋2", "ํค์๋3"]
|
| 231 |
+
}}
|
| 232 |
"""
|
| 233 |
+
resp = client.chat.completions.create(
|
| 234 |
+
model="gpt-4o",
|
| 235 |
+
messages=[{"role":"system","content":SYS_ROLE},
|
| 236 |
+
{"role":"user", "content":prompt}],
|
| 237 |
+
temperature=0.2,
|
| 238 |
+
)
|
| 239 |
+
raw = re.sub(r"^```json\s*|```\s*$", "", resp.choices[0].message.content.strip())
|
| 240 |
+
return json.loads(raw)
|
| 241 |
+
|
| 242 |
+
def generate_tts(text):
|
| 243 |
+
resp = client.audio.speech.create(model="gpt-4o-mini-tts", voice="nova", input=text)
|
| 244 |
+
buf = io.BytesIO()
|
| 245 |
+
for chunk in resp.iter_bytes():
|
| 246 |
+
buf.write(chunk)
|
| 247 |
+
buf.seek(0)
|
| 248 |
+
return buf.read()
|
| 249 |
+
|
| 250 |
+
def generate_email_body(analysis, recipient_name):
|
| 251 |
+
tasks_txt = "\n".join(
|
| 252 |
+
f" - [{t['person']}] {t['task']}" + (f" (๊ธฐํ:{t['deadline']})" if t.get("deadline") else "")
|
| 253 |
+
for t in analysis.get("tasks", [])
|
| 254 |
+
)
|
| 255 |
+
decisions_txt = "\n".join(f" โข {d}" for d in analysis.get("decisions", []))
|
| 256 |
+
resp = client.chat.completions.create(
|
| 257 |
+
model="gpt-4o-mini",
|
| 258 |
+
messages=[{"role":"user","content":f"""
|
| 259 |
+
{recipient_name}์๊ฒ ๋ณด๋ด๋ ๊ณต์ ๋ฆฌ๋ง์ธ๋ ์ด๋ฉ์ผ์ ์์ฑํ์ธ์.
|
| 260 |
+
KT Enterprise IT๊ธฐ์ ํ์ ํ DX Consulting ์์ ์ง์ ํ์์ผ๋ก ์์ฑํ์ธ์.
|
| 261 |
+
ํ์ ์ ๋ชฉ: {analysis.get('meeting_title','ํ์')}
|
| 262 |
+
๊ฒฐ์ ์ฌํญ:\n{decisions_txt}
|
| 263 |
+
๋ด๋น ์
๋ฌด:\n{tasks_txt}
|
| 264 |
+
์ด๋ฉ์ผ ๋ณธ๋ฌธ๋ง ์ถ๋ ฅํ์ธ์ (์ ๋ชฉ ์ ์ธ).
|
| 265 |
+
"""}],
|
| 266 |
+
temperature=0.4,
|
| 267 |
+
)
|
| 268 |
+
return resp.choices[0].message.content.strip()
|
| 269 |
+
|
| 270 |
+
def send_email(to, subject, body):
|
| 271 |
+
if is_secure_content(body) or is_secure_content(subject):
|
| 272 |
+
return {"status":"blocked","reason":"๋ณด์ ํค์๋ ํฌํจ์ผ๋ก ์๋ ์ฐจ๋จ๋จ"}
|
| 273 |
+
api_key = os.getenv("SENDGRID_API_KEY","")
|
| 274 |
+
sender = os.getenv("EMAIL_ADDRESS","")
|
| 275 |
+
resp = requests.post(
|
| 276 |
+
"https://api.sendgrid.com/v3/mail/send",
|
| 277 |
+
headers={"Authorization":f"Bearer {api_key}","Content-Type":"application/json"},
|
| 278 |
+
json={"personalizations":[{"to":[{"email":to}],"subject":subject}],
|
| 279 |
+
"from":{"email":sender},
|
| 280 |
+
"content":[{"type":"text/plain","value":body}]},
|
| 281 |
+
)
|
| 282 |
+
return {"status":"success"} if resp.status_code==202 \
|
| 283 |
+
else {"status":"failed","error":resp.text}
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 287 |
+
# ์ฌ์ด๋๋ฐ
|
| 288 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 289 |
+
with st.sidebar:
|
| 290 |
+
st.markdown("""
|
| 291 |
+
<div style="padding:14px 0 6px 0;">
|
| 292 |
+
<div style="font-family:'Rajdhani',sans-serif;font-size:1.7rem;font-weight:700;
|
| 293 |
+
color:#E3000B;letter-spacing:2px;">KT</div>
|
| 294 |
+
<div style="font-size:0.8rem;color:#8892A4;margin-top:2px;">IT๊ธฐ์ ํ์ ํ ยท DX Consulting</div>
|
| 295 |
+
</div>
|
| 296 |
+
<div style="height:1px;background:#2A3550;margin:12px 0 18px 0;"></div>
|
| 297 |
+
""", unsafe_allow_html=True)
|
| 298 |
+
|
| 299 |
+
st.markdown('<div class="sb-label">์
๋ ฅ ๋ฐฉ์</div>', unsafe_allow_html=True)
|
| 300 |
+
input_mode = st.radio("์
๋ ฅ๋ฐฉ์", ["๐๏ธ ์์ฑ ๋
น์","๐ ํ์ผ ์
๋ก๋","๐ ํ
์คํธ ์ง์ ์
๋ ฅ"],
|
| 301 |
+
label_visibility="collapsed")
|
| 302 |
+
|
| 303 |
+
st.markdown('<div style="height:1px;background:#2A3550;margin:14px 0;"></div>', unsafe_allow_html=True)
|
| 304 |
+
st.markdown('<div class="sb-label">์ด๋ฉ์ผ ์ค์ </div>', unsafe_allow_html=True)
|
| 305 |
+
email_enabled = st.toggle("๋ฆฌ๋ง์ธ๋ ๋ฉ์ผ ๋ฐ์ก", value=False)
|
| 306 |
+
email_recipient, email_name = "", ""
|
| 307 |
+
if email_enabled:
|
| 308 |
+
email_recipient = st.text_input("์์ ์ ์ด๋ฉ์ผ", placeholder="kim@kt.com")
|
| 309 |
+
email_name = st.text_input("์์ ์ ์ด๋ฆ", placeholder="๊น๋๋ฆฌ")
|
| 310 |
+
|
| 311 |
+
st.markdown('<div style="height:1px;background:#2A3550;margin:14px 0;"></div>', unsafe_allow_html=True)
|
| 312 |
+
st.markdown('<div class="sb-label">๋ถ์ ์ต์
</div>', unsafe_allow_html=True)
|
| 313 |
+
show_sensitive = st.toggle("๋ฏผ๊ฐ์ ๋ณด ๊ฐ์ง", value=True)
|
| 314 |
+
show_priority = st.toggle("์ฐ์ ์์ ์ ๋ ฌ", value=True)
|
| 315 |
+
tts_enabled = st.toggle("์์ฑ ๋ต๋ณ (TTS)", value=False)
|
| 316 |
+
|
| 317 |
+
st.markdown('<div style="margin-top:40px;font-size:0.7rem;color:#2A3550;">MeetingAI v1.3 ยท KT Enterprise</div>',
|
| 318 |
+
unsafe_allow_html=True)
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 322 |
+
# ํค๋
|
| 323 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 324 |
+
st.markdown("""
|
| 325 |
+
<div style="display:flex;align-items:center;gap:14px;padding:18px 24px;
|
| 326 |
+
background:linear-gradient(135deg,#16213E 0%,#0F3460 100%);
|
| 327 |
+
border-bottom:2px solid #E3000B;border-radius:12px;margin-bottom:20px;">
|
| 328 |
+
<div style="font-family:'Rajdhani',sans-serif;font-size:2.2rem;font-weight:700;
|
| 329 |
+
color:#E3000B;letter-spacing:2px;line-height:1;">KT</div>
|
| 330 |
+
<div>
|
| 331 |
+
<div style="font-size:1.1rem;font-weight:600;color:#fff;line-height:1.3;">
|
| 332 |
+
MeetingAI ยท ํ์ ๋ถ์ ์ด์์คํดํธ</div>
|
| 333 |
+
<div style="font-size:0.76rem;color:#8892A4;letter-spacing:0.5px;">
|
| 334 |
+
IT๊ธฐ์ ํ์ ํ DX Consulting ยท AI ๊ธฐ๋ฐ ํ์ ์๋ํ ์๋น์ค</div>
|
| 335 |
+
</div>
|
| 336 |
+
</div>
|
| 337 |
+
""", unsafe_allow_html=True)
|
| 338 |
|
| 339 |
+
|
| 340 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 341 |
+
# ์
๋ ฅ ์์ญ
|
| 342 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 343 |
+
st.markdown('<div class="input-title">๐ ํ์ ๋ด์ฉ ์
๋ ฅ</div>', unsafe_allow_html=True)
|
| 344 |
+
|
| 345 |
+
transcript_input = ""
|
| 346 |
+
with st.container(border=True):
|
| 347 |
+
if input_mode == "๐๏ธ ์์ฑ ๋
น์":
|
| 348 |
+
audio_value = st.audio_input("์์ฑ์ผ๋ก ํ์ ๋ด์ฉ์ ์
๋ ฅํ์ธ์")
|
| 349 |
+
if audio_value:
|
| 350 |
+
st.session_state.audio_bytes = audio_value
|
| 351 |
+
|
| 352 |
+
elif input_mode == "๐ ํ์ผ ์
๋ก๋":
|
| 353 |
+
ca, cb = st.columns(2)
|
| 354 |
+
with ca:
|
| 355 |
+
audio_file = st.file_uploader("์์ฑ ํ์ผ (mp3/wav/m4a/ogg)",
|
| 356 |
+
type=["mp3","wav","m4a","ogg"])
|
| 357 |
+
with cb:
|
| 358 |
+
text_file = st.file_uploader("ํ
์คํธ ํ์ผ (txt)", type=["txt"])
|
| 359 |
+
if audio_file: st.session_state.audio_bytes = audio_file
|
| 360 |
+
if text_file: transcript_input = text_file.read().decode("utf-8")
|
| 361 |
+
|
| 362 |
+
else:
|
| 363 |
+
transcript_input = st.text_area(
|
| 364 |
+
"ํ์ ๋ด์ฉ", height=180, label_visibility="collapsed",
|
| 365 |
+
placeholder="์) ํ์ฅ: ์ค๋ ํ์ ์ฃผ์ ๋ ์ ์ ํ ์ถ์ ๋ง์ผํ
์ ๋ต์
๋๋ค...",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
)
|
|
|
|
| 367 |
|
| 368 |
+
st.button("๐ ํ์ ๋ถ์ ์์", use_container_width=True, key="analyze_btn")
|
| 369 |
+
|
| 370 |
+
|
| 371 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 372 |
+
# ๋ถ์ ์คํ
|
| 373 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 374 |
+
if st.session_state.get("analyze_btn"):
|
| 375 |
+
final_text = transcript_input.strip()
|
| 376 |
+
|
| 377 |
+
if not final_text and st.session_state.audio_bytes:
|
| 378 |
+
with st.spinner("๐๏ธ ์์ฑ์ ํ
์คํธ๋ก ๋ณํํ๋ ์ค..."):
|
| 379 |
+
try:
|
| 380 |
+
src = st.session_state.audio_bytes
|
| 381 |
+
fname = getattr(src, "name", "audio.wav")
|
| 382 |
+
ext = fname.rsplit(".",1)[-1].lower() if "." in fname else "wav"
|
| 383 |
+
mime = {"mp3":"audio/mpeg","wav":"audio/wav",
|
| 384 |
+
"m4a":"audio/mp4","ogg":"audio/ogg"}.get(ext,"audio/wav")
|
| 385 |
+
final_text = stt((fname, src, mime))
|
| 386 |
+
st.session_state.transcript = final_text
|
| 387 |
+
except Exception as e:
|
| 388 |
+
st.error(f"STT ์ค๋ฅ: {e}"); st.stop()
|
| 389 |
+
elif final_text:
|
| 390 |
+
st.session_state.transcript = final_text
|
| 391 |
+
|
| 392 |
+
if not st.session_state.transcript:
|
| 393 |
+
st.warning("โ ๏ธ ์์ฑ ๋๋ ํ
์คํธ๏ฟฝ๏ฟฝ ๋จผ์ ์
๋ ฅํด ์ฃผ์ธ์."); st.stop()
|
| 394 |
+
|
| 395 |
+
with st.spinner("๐ค ํ์ ๋ด์ฉ์ ๋ถ์ํ๋ ์ค..."):
|
| 396 |
+
try:
|
| 397 |
+
st.session_state.analysis = analyze_meeting(st.session_state.transcript)
|
| 398 |
+
st.session_state.mail_body = ""
|
| 399 |
+
st.session_state.tts_bytes = None
|
| 400 |
+
except Exception as e:
|
| 401 |
+
st.error(f"๋ถ์ ์ค๋ฅ: {e}"); st.stop()
|
| 402 |
+
|
| 403 |
+
if tts_enabled and st.session_state.analysis:
|
| 404 |
+
with st.spinner("๐ ์์ฑ ๋ต๋ณ ์์ฑ ์ค..."):
|
| 405 |
+
try:
|
| 406 |
+
st.session_state.tts_bytes = generate_tts(
|
| 407 |
+
st.session_state.analysis.get("summary",""))
|
| 408 |
+
except Exception as e:
|
| 409 |
+
st.warning(f"TTS ์ค๋ฅ: {e}")
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 413 |
+
# ๊ฒฐ๊ณผ ์ถ๋ ฅ
|
| 414 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 415 |
+
if st.session_state.analysis:
|
| 416 |
+
a = st.session_state.analysis
|
| 417 |
+
|
| 418 |
+
if st.session_state.tts_bytes:
|
| 419 |
+
st.audio(st.session_state.tts_bytes, format="audio/mp3", autoplay=True)
|
| 420 |
+
|
| 421 |
+
# ๋ฏผ๊ฐ์ ๋ณด ๊ฒฝ๊ณ
|
| 422 |
+
if show_sensitive:
|
| 423 |
+
hits = detect_sensitive(st.session_state.transcript)
|
| 424 |
+
if hits:
|
| 425 |
+
labels = " | ".join(f"โ ๏ธ {s}" for s in hits)
|
| 426 |
+
st.markdown(
|
| 427 |
+
f'<div style="background:rgba(255,68,68,0.07);border:1px solid rgba(255,68,68,0.35);'
|
| 428 |
+
f'border-radius:12px;padding:14px 20px;margin-bottom:16px;">'
|
| 429 |
+
f'<div style="font-size:0.85rem;font-weight:700;color:#FF4444;margin-bottom:6px;">๐ ๋ฏผ๊ฐ์ ๋ณด ๊ฐ์ง๋จ</div>'
|
| 430 |
+
f'<div style="font-size:0.82rem;color:#ffaaaa;line-height:1.6;">{labels}<br>'
|
| 431 |
+
f'์ธ๋ถ ๊ณต์ ์ ๋ด๋ถ ๋ณด์ ์ ์ฑ
์ ๋ฐ๋ผ ์ฒ๋ฆฌํ์ธ์. ์ด๋ฉ์ผ ๋ฐ์ก ์ ๋ณด์ ํค์๋ ํฌํจ ๋ด์ฉ์ ์๋ ์ฐจ๋จ๋ฉ๋๋ค.</div>'
|
| 432 |
+
f'</div>',
|
| 433 |
+
unsafe_allow_html=True,
|
| 434 |
+
)
|
| 435 |
+
|
| 436 |
+
tab1, tab2, tab3, tab4 = st.tabs([
|
| 437 |
+
"๐ ํ์ ์์ฝ","โ
ํ ์ผ & ์ฐ์ ์์","๐ ์๋ฌธ & ํค์๋","โ๏ธ ๋ฆฌ๋ง์ธ๋ ๋ฉ์ผ"
|
| 438 |
+
])
|
| 439 |
+
|
| 440 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 441 |
+
# ํญ1: ํ์ ์์ฝ โ ๋ชจ๋ HTML์ inline style๋ก, st.markdown ์ต์ ํธ์ถ
|
| 442 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 443 |
+
with tab1:
|
| 444 |
+
# ํ์ ๊ฐ์
|
| 445 |
+
st.markdown(
|
| 446 |
+
f'<div style="{S["card"]}">'
|
| 447 |
+
f'<div style="{S["card_title"]}">๐ ํ์ ๊ฐ์</div>'
|
| 448 |
+
f'<div style="font-size:1.1rem;font-weight:700;color:#fff;margin-bottom:10px;">'
|
| 449 |
+
f'{a.get("meeting_title","โ")}</div>'
|
| 450 |
+
f'<div style="font-size:0.875rem;color:#C8D0DC;line-height:1.75;">'
|
| 451 |
+
f'{a.get("purpose","โ")}</div>'
|
| 452 |
+
f'</div>',
|
| 453 |
+
unsafe_allow_html=True,
|
| 454 |
+
)
|
| 455 |
+
|
| 456 |
+
# ๊ฒฐ์ ๋ ์ฌํญ HTML ์กฐ๋ฆฝ
|
| 457 |
+
dec_rows = "".join(
|
| 458 |
+
f'<div style="{S["timeline_row"]}">'
|
| 459 |
+
f'<div style="{S["timeline_dot"]}"></div>'
|
| 460 |
+
f'<div style="{S["timeline_text"]}">{d}</div>'
|
| 461 |
+
f'</div>'
|
| 462 |
+
for d in a.get("decisions", [])
|
| 463 |
+
) or f'<div style="color:#8892A4;font-size:0.85rem;">๊ฒฐ์ ์ฌํญ ์์</div>'
|
| 464 |
+
|
| 465 |
+
# ์ฃผ์ ์๊ฑด HTML ์กฐ๋ฆฝ (๊ฒฐ์ ๋ ์ฌํญ๊ณผ ๋์ผํ ๋นจ๊ฐ ์ํ ์ )
|
| 466 |
+
ag_rows = "".join(
|
| 467 |
+
f'<div style="{S["timeline_row"]}">'
|
| 468 |
+
f'<div style="{S["timeline_dot"]}"></div>'
|
| 469 |
+
f'<div style="{S["timeline_text"]}">{ag}</div>'
|
| 470 |
+
f'</div>'
|
| 471 |
+
for ag in a.get("agenda_items", [])
|
| 472 |
+
) or f'<div style="color:#8892A4;font-size:0.85rem;">์๊ฑด ์์</div>'
|
| 473 |
+
|
| 474 |
+
next_html = ""
|
| 475 |
+
if a.get("next_meeting"):
|
| 476 |
+
next_html = (
|
| 477 |
+
f'<div style="margin-top:14px;padding:9px 14px;'
|
| 478 |
+
f'background:rgba(0,200,151,0.08);border-radius:8px;'
|
| 479 |
+
f'border:1px solid rgba(0,200,151,0.22);">'
|
| 480 |
+
f'<span style="font-size:0.76rem;color:#00C897;font-weight:600;">๐
๋ค์ ํ์</span>'
|
| 481 |
+
f'<div style="font-size:0.85rem;color:#C8D0DC;margin-top:3px;">{a["next_meeting"]}</div>'
|
| 482 |
+
f'</div>'
|
| 483 |
+
)
|
| 484 |
+
|
| 485 |
+
# ๊ฒฐ์ ๋ ์ฌํญ + ์ฃผ์ ์๊ฑด: CSS grid 2์ด, st.markdown 1ํ
|
| 486 |
+
st.markdown(
|
| 487 |
+
f'<div style="display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:14px;">'
|
| 488 |
+
f'<div style="{S["card"]}margin-bottom:0;">'
|
| 489 |
+
f'<div style="{S["card_title"]}">โ
๊ฒฐ์ ๋ ์ฌํญ</div>{dec_rows}</div>'
|
| 490 |
+
f'<div style="{S["card"]}margin-bottom:0;">'
|
| 491 |
+
f'<div style="{S["card_title"]}">๐ ์ฃผ์ ์๊ฑด</div>{ag_rows}{next_html}</div>'
|
| 492 |
+
f'</div>',
|
| 493 |
+
unsafe_allow_html=True,
|
| 494 |
+
)
|
| 495 |
+
|
| 496 |
+
# ์ ์ฒด ์์ฝ
|
| 497 |
+
st.markdown(
|
| 498 |
+
f'<div style="{S["card"]}">'
|
| 499 |
+
f'<div style="{S["card_title"]}">๐ฌ ์ ์ฒด ์์ฝ</div>'
|
| 500 |
+
f'<div style="font-size:0.9rem;color:#C8D0DC;line-height:1.85;'
|
| 501 |
+
f'border-left:3px solid #E3000B;padding-left:16px;">'
|
| 502 |
+
f'{a.get("summary","โ")}</div>'
|
| 503 |
+
f'</div>',
|
| 504 |
+
unsafe_allow_html=True,
|
| 505 |
+
)
|
| 506 |
+
|
| 507 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 508 |
+
# ํญ2: ํ ์ผ & ์ฐ์ ์์
|
| 509 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 510 |
+
with tab2:
|
| 511 |
+
tasks = list(a.get("tasks", []))
|
| 512 |
+
if show_priority:
|
| 513 |
+
tasks = sorted(tasks,
|
| 514 |
+
key=lambda t: {"high":0,"medium":1,"low":2}.get(t.get("priority","low"),3))
|
| 515 |
+
|
| 516 |
+
n_h = sum(1 for t in tasks if t.get("priority")=="high")
|
| 517 |
+
n_m = sum(1 for t in tasks if t.get("priority")=="medium")
|
| 518 |
+
n_l = sum(1 for t in tasks if t.get("priority")=="low")
|
| 519 |
+
|
| 520 |
+
st.markdown(
|
| 521 |
+
f'<div style="display:flex;gap:10px;flex-wrap:wrap;margin-bottom:16px;">'
|
| 522 |
+
f'<span style="{S["badge_high"]}">๐ด ๋์ {n_h}๊ฑด</span>'
|
| 523 |
+
f'<span style="{S["badge_med"]}">๐ก ๋ณดํต {n_m}๊ฑด</span>'
|
| 524 |
+
f'<span style="{S["badge_low"]}">๐ข ๋ฎ์ {n_l}๊ฑด</span>'
|
| 525 |
+
f'<span style="{S["badge_gray"]}">์ ์ฒด {len(tasks)}๊ฑด</span>'
|
| 526 |
+
f'</div>',
|
| 527 |
+
unsafe_allow_html=True,
|
| 528 |
+
)
|
| 529 |
+
|
| 530 |
+
if tasks:
|
| 531 |
+
tasks_html = ""
|
| 532 |
+
for t in tasks:
|
| 533 |
+
p = t.get("priority","low")
|
| 534 |
+
border = PRIORITY_BORDER.get(p,"#E3000B")
|
| 535 |
+
bkey = PRIORITY_BADGE_KEY.get(p,"badge_gray")
|
| 536 |
+
dl = (f'<div style="font-size:0.72rem;color:#FFB800;white-space:nowrap;margin-top:2px;">โฐ {t["deadline"]}</div>'
|
| 537 |
+
if t.get("deadline") else "")
|
| 538 |
+
tasks_html += (
|
| 539 |
+
f'<div style="display:flex;align-items:flex-start;gap:14px;padding:12px 16px;'
|
| 540 |
+
f'background:rgba(15,52,96,0.45);border-left:3px solid {border};'
|
| 541 |
+
f'border-radius:0 8px 8px 0;margin-bottom:8px;">'
|
| 542 |
+
f'<div style="min-width:72px;">'
|
| 543 |
+
f'<div style="font-size:0.78rem;font-weight:700;color:#fff;margin-bottom:4px;">{t.get("person","โ")}</div>'
|
| 544 |
+
f'<span style="{S[bkey]}">{PRIORITY_LABEL.get(p,"โ")}</span>'
|
| 545 |
+
f'</div>'
|
| 546 |
+
f'<div style="font-size:0.875rem;color:#F0F4F8;flex:1;line-height:1.55;">{t.get("task","โ")}</div>'
|
| 547 |
+
f'{dl}'
|
| 548 |
+
f'</div>'
|
| 549 |
+
)
|
| 550 |
+
st.markdown(tasks_html, unsafe_allow_html=True)
|
| 551 |
+
else:
|
| 552 |
+
st.markdown(
|
| 553 |
+
'<div style="padding:24px;text-align:center;color:#8892A4;font-size:0.875rem;">ํ ๋น๋ ์
๋ฌด๊ฐ ์์ต๋๋ค.</div>',
|
| 554 |
+
unsafe_allow_html=True,
|
| 555 |
+
)
|
| 556 |
+
|
| 557 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 558 |
+
# ํญ3: ์๋ฌธ & ํค์๋
|
| 559 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 560 |
+
with tab3:
|
| 561 |
+
keywords = a.get("keywords", [])
|
| 562 |
+
if keywords:
|
| 563 |
+
kw_html = "".join(
|
| 564 |
+
f'<span style="{S["badge_gray"]}margin:3px 2px;">{k}</span>'
|
| 565 |
+
for k in keywords
|
| 566 |
+
)
|
| 567 |
+
st.markdown(
|
| 568 |
+
f'<div style="{S["card"]}">'
|
| 569 |
+
f'<div style="{S["card_title"]}">๐ ํต์ฌ ํค์๋</div>'
|
| 570 |
+
f'<div style="display:flex;flex-wrap:wrap;gap:2px;line-height:2.2;">{kw_html}</div>'
|
| 571 |
+
f'</div>',
|
| 572 |
+
unsafe_allow_html=True,
|
| 573 |
+
)
|
| 574 |
+
|
| 575 |
+
with st.expander("๐ ์ ์ฌ ์๋ฌธ ๋ณด๊ธฐ", expanded=False):
|
| 576 |
+
st.text_area("์๋ฌธ", value=st.session_state.transcript,
|
| 577 |
+
height=300, disabled=True, label_visibility="collapsed")
|
| 578 |
+
|
| 579 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 580 |
+
# ํญ4: ๋ฆฌ๋ง์ธ๋ ๋ฉ์ผ
|
| 581 |
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 582 |
+
with tab4:
|
| 583 |
+
if not email_enabled:
|
| 584 |
+
st.markdown(
|
| 585 |
+
'<div style="padding:40px;text-align:center;color:#8892A4;">'
|
| 586 |
+
'<div style="font-size:3rem;margin-bottom:14px;">โ๏ธ</div>'
|
| 587 |
+
'<div style="font-size:0.9rem;">์ฌ์ด๋๋ฐ์์ <b style="color:#fff;">๋ฆฌ๋ง์ธ๋ ๋ฉ์ผ ๋ฐ์ก</b>์ ํ์ฑํํ์ธ์.</div>'
|
| 588 |
+
'</div>',
|
| 589 |
+
unsafe_allow_html=True,
|
| 590 |
+
)
|
| 591 |
+
else:
|
| 592 |
+
st.button("๐ง ๋ฉ์ผ ์ด์ ์์ฑ", key="gen_mail_btn")
|
| 593 |
+
if st.session_state.get("gen_mail_btn"):
|
| 594 |
+
with st.spinner("๋ฉ์ผ ์ด์ ์์ฑ ์ค..."):
|
| 595 |
+
st.session_state.mail_body = generate_email_body(a, email_name or "๋ด๋น์")
|
| 596 |
+
|
| 597 |
+
if st.session_state.mail_body:
|
| 598 |
+
edited_body = st.text_area("๋ฉ์ผ ๋ณธ๋ฌธ (์์ ๊ฐ๋ฅ)",
|
| 599 |
+
value=st.session_state.mail_body, height=280)
|
| 600 |
+
mail_subject = st.text_input("๋ฉ์ผ ์ ๋ชฉ",
|
| 601 |
+
value=f"[ํ์ ๊ฒฐ๊ณผ ๊ณต์ ] {a.get('meeting_title','ํ์')}")
|
| 602 |
+
st.button("๐ค ๋ฉ์ผ ๋ฐ์ก", key="send_mail_btn")
|
| 603 |
+
if st.session_state.get("send_mail_btn"):
|
| 604 |
+
if not email_recipient:
|
| 605 |
+
st.warning("์์ ์ ์ด๋ฉ์ผ์ ์ฌ์ด๋๋ฐ์์ ์
๋ ฅํด์ฃผ์ธ์.")
|
| 606 |
+
else:
|
| 607 |
+
with st.spinner("๋ฐ์ก ์ค..."):
|
| 608 |
+
result = send_email(email_recipient, mail_subject, edited_body)
|
| 609 |
+
if result["status"] == "success":
|
| 610 |
+
st.success(f"โ
{email_recipient} ์ผ๋ก ๋ฉ์ผ์ ๋ฐ์กํ์ต๋๋ค.")
|
| 611 |
+
elif result["status"] == "blocked":
|
| 612 |
+
st.error(f"โ ๋ฐ์ก ์ฐจ๋จ: {result.get('reason','๋ณด์ ์ ์ฑ
')}")
|
| 613 |
+
else:
|
| 614 |
+
st.error(f"๋ฐ์ก ์คํจ: {result.get('error','์ ์ ์๋ ์ค๋ฅ')}")
|