Spaces:
Sleeping
Sleeping
Update css.py
Browse files
css.py
CHANGED
|
@@ -32,7 +32,7 @@ def render_message(
|
|
| 32 |
by_word: bool = False, # ๋จ์ด ๋จ์ ์ถ๋ ฅ
|
| 33 |
) -> str | None:
|
| 34 |
import re, time
|
| 35 |
-
# โข
|
| 36 |
palette = _get_colors()
|
| 37 |
show_time = st.session_state.get("show_time", False) and sender == "bot"
|
| 38 |
|
|
@@ -42,15 +42,11 @@ def render_message(
|
|
| 42 |
fsz = "13px"
|
| 43 |
|
| 44 |
message = str(message).rstrip()
|
| 45 |
-
|
| 46 |
-
ts_html = (
|
| 47 |
-
f'<div style="font-size:11px;color:#888;margin-top:4px;">{datetime.now().strftime("%H:%M")}</div>'
|
| 48 |
-
if show_time else ""
|
| 49 |
-
)
|
| 50 |
|
| 51 |
# ๊ณตํต ํ์ ๋ํผ
|
| 52 |
-
# โ
|
| 53 |
-
def _wrap(html_inner: str
|
| 54 |
bubble = (
|
| 55 |
f'''<span style="background:{color}; padding:{pad}; border-radius:12px;'''
|
| 56 |
f'''display:inline-block; max-width:80%; font-size:{fsz}; line-height:1.45;'''
|
|
@@ -58,15 +54,10 @@ def render_message(
|
|
| 58 |
)
|
| 59 |
ts = (
|
| 60 |
f'''<span style="font-size:11px;color:#888;white-space:nowrap;'''
|
| 61 |
-
f'''align-self:flex-end;margin:0 2px 2px;">{
|
| 62 |
-
) if
|
| 63 |
-
|
| 64 |
-
# bot: ์๊ฐ + ๋ฒ๋ธ / user: ๋ฒ๋ธ + ์๊ฐ
|
| 65 |
inner = (ts + bubble) if sender != "user" else (bubble + ts)
|
| 66 |
-
return
|
| 67 |
-
f'''<div style="display:flex;align-items:flex-end;justify-content:{align};'''
|
| 68 |
-
f'''gap:6px;margin:6px 0;">{inner}</div>'''
|
| 69 |
-
)
|
| 70 |
|
| 71 |
if not animated:
|
| 72 |
st.markdown(_wrap(message), unsafe_allow_html=True)
|
|
|
|
| 32 |
by_word: bool = False, # ๋จ์ด ๋จ์ ์ถ๋ ฅ
|
| 33 |
) -> str | None:
|
| 34 |
import re, time
|
| 35 |
+
# โข ํ
๋ง ๊ฐ ์ฝ๊ธฐ
|
| 36 |
palette = _get_colors()
|
| 37 |
show_time = st.session_state.get("show_time", False) and sender == "bot"
|
| 38 |
|
|
|
|
| 42 |
fsz = "13px"
|
| 43 |
|
| 44 |
message = str(message).rstrip()
|
| 45 |
+
ts_text = datetime.now().strftime("%H:%M") if show_time else ""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
# ๊ณตํต ํ์ ๋ํผ
|
| 48 |
+
# โ
์นดํก ์คํ์ผ: ์๊ฐ์ ๋งํ์ '๋ฐ' (์ผ์ชฝ: ๋ด=์๊ฐ+๋ฒ๋ธ, ์ค๋ฅธ์ชฝ: ์ ์ =๋ฒ๋ธ+์๊ฐ)
|
| 49 |
+
def _wrap(html_inner: str, ts_text_local: str = ts_text):
|
| 50 |
bubble = (
|
| 51 |
f'''<span style="background:{color}; padding:{pad}; border-radius:12px;'''
|
| 52 |
f'''display:inline-block; max-width:80%; font-size:{fsz}; line-height:1.45;'''
|
|
|
|
| 54 |
)
|
| 55 |
ts = (
|
| 56 |
f'''<span style="font-size:11px;color:#888;white-space:nowrap;'''
|
| 57 |
+
f'''align-self:flex-end;margin:0 2px 2px;">{ts_text_local}</span>'''
|
| 58 |
+
) if ts_text_local else ""
|
|
|
|
|
|
|
| 59 |
inner = (ts + bubble) if sender != "user" else (bubble + ts)
|
| 60 |
+
return f'''<div style="display:flex;align-items:flex-end;justify-content:{align};gap:6px;margin:6px 0;">{inner}</div>'''
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
if not animated:
|
| 63 |
st.markdown(_wrap(message), unsafe_allow_html=True)
|