feat: 优化文章优化Tab
This commit is contained in:
+32
-33
@@ -798,41 +798,40 @@ with tab3:
|
|||||||
with st.container(border=True):
|
with st.container(border=True):
|
||||||
st.markdown("粘贴或上传已写文章,一键提升 GEO 效果(结构化、可引用、自然植入品牌)")
|
st.markdown("粘贴或上传已写文章,一键提升 GEO 效果(结构化、可引用、自然植入品牌)")
|
||||||
|
|
||||||
with st.form("opt_form", clear_on_submit=False):
|
# 输入方式与文章内容放在表单外,以便粘贴/上传后能触发重跑,从而正确更新「开始优化」按钮的可用状态
|
||||||
input_mode = st.radio(
|
input_mode = st.radio(
|
||||||
"输入方式",
|
"输入方式",
|
||||||
["粘贴文本", "上传文件(TXT/MD)"],
|
["粘贴文本", "上传文件(TXT/MD)"],
|
||||||
horizontal=True,
|
horizontal=True,
|
||||||
key="opt_input_mode",
|
key="opt_input_mode",
|
||||||
|
)
|
||||||
|
if input_mode == "粘贴文本":
|
||||||
|
original_article = st.text_area(
|
||||||
|
"粘贴文章内容", height=360, key="opt_text"
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
uploaded = st.file_uploader(
|
||||||
|
"上传 TXT 或 MD 文件",
|
||||||
|
type=["txt", "md"],
|
||||||
|
key="opt_uploader",
|
||||||
|
)
|
||||||
|
original_article = ""
|
||||||
|
if uploaded:
|
||||||
|
try:
|
||||||
|
original_article = safe_decode_uploaded(uploaded) or ""
|
||||||
|
except Exception as e:
|
||||||
|
st.error(f"上传文件解析失败:{e}")
|
||||||
|
original_article = ""
|
||||||
|
if original_article:
|
||||||
|
st.text_area(
|
||||||
|
"上传内容预览",
|
||||||
|
original_article,
|
||||||
|
height=200,
|
||||||
|
disabled=True,
|
||||||
|
key="opt_upload_preview",
|
||||||
|
)
|
||||||
|
|
||||||
if input_mode == "粘贴文本":
|
with st.form("opt_form", clear_on_submit=False):
|
||||||
original_article = st.text_area(
|
|
||||||
"粘贴文章内容", height=360, key="opt_text"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
uploaded = st.file_uploader(
|
|
||||||
"上传 TXT 或 MD 文件",
|
|
||||||
type=["txt", "md"],
|
|
||||||
key="opt_uploader",
|
|
||||||
)
|
|
||||||
original_article = ""
|
|
||||||
if uploaded:
|
|
||||||
try:
|
|
||||||
original_article = safe_decode_uploaded(uploaded) or ""
|
|
||||||
except Exception as e:
|
|
||||||
st.error(f"上传文件解析失败:{e}")
|
|
||||||
original_article = ""
|
|
||||||
|
|
||||||
if original_article:
|
|
||||||
st.text_area(
|
|
||||||
"上传内容预览",
|
|
||||||
original_article,
|
|
||||||
height=200,
|
|
||||||
disabled=True,
|
|
||||||
key="opt_upload_preview",
|
|
||||||
)
|
|
||||||
|
|
||||||
target_platform = st.selectbox(
|
target_platform = st.selectbox(
|
||||||
"目标平台(影响文风,可选)",
|
"目标平台(影响文风,可选)",
|
||||||
[
|
[
|
||||||
|
|||||||
+15
-15
@@ -52,33 +52,33 @@ div[data-testid="stButton"] button[kind="primary"],
|
|||||||
div[data-testid="stFormSubmitButton"] button[kind="primary"] {
|
div[data-testid="stFormSubmitButton"] button[kind="primary"] {
|
||||||
# background-color: var(--primary) !important;
|
# background-color: var(--primary) !important;
|
||||||
# color: white !important;
|
# color: white !important;
|
||||||
border-radius: var(--radius) !important;
|
# border-radius: var(--radius) !important;
|
||||||
# border: none !important;
|
# border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
button[kind="secondary"],
|
# button[kind="secondary"],
|
||||||
div[data-testid="stButton"] button[kind="secondary"] {
|
# div[data-testid="stButton"] button[kind="secondary"] {
|
||||||
background: #FFFFFF !important;
|
# background: #FFFFFF !important;
|
||||||
border: 1px solid var(--border) !important;
|
# border: 1px solid var(--border) !important;
|
||||||
# color: var(--text) !important;
|
# # color: var(--text) !important;
|
||||||
border-radius: var(--radius) !important;
|
# border-radius: var(--radius) !important;
|
||||||
}
|
# }
|
||||||
|
|
||||||
button:focus, button:focus-visible {
|
# button:focus, button:focus-visible {
|
||||||
box-shadow: 0 0 0 3px rgba(37,99,235,0.12) !important;
|
# box-shadow: 0 0 0 3px rgba(37,99,235,0.12) !important;
|
||||||
outline: none !important;
|
# outline: none !important;
|
||||||
}
|
# }
|
||||||
|
|
||||||
/* 输入 */
|
/* 输入 */
|
||||||
.stTextInput input, .stTextArea textarea, .stSelectbox div[data-baseweb="select"] {
|
.stTextInput input, .stTextArea textarea, .stSelectbox div[data-baseweb="select"] {
|
||||||
border-radius: 10px !important;
|
border-radius: 10px !important;
|
||||||
}
|
}
|
||||||
.stTextInput input, .stTextArea textarea {
|
.stTextInput input, .stTextArea textarea {
|
||||||
border: 1px solid var(--border) !important;
|
# border: 1px solid var(--border) !important;
|
||||||
padding: 0.75rem !important;
|
padding: 0.75rem !important;
|
||||||
}
|
}
|
||||||
.stTextInput input:focus, .stTextArea textarea:focus {
|
.stTextInput input:focus, .stTextArea textarea:focus {
|
||||||
border-color: var(--primary) !important;
|
# border-color: var(--primary) !important;
|
||||||
box-shadow: 0 0 0 3px rgba(37,99,235,0.12) !important;
|
box-shadow: 0 0 0 3px rgba(37,99,235,0.12) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ button:focus, button:focus-visible {
|
|||||||
.stTabs [role="tab"]:focus-visible {
|
.stTabs [role="tab"]:focus-visible {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
border: none !important;
|
# border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tabs 产品化 */
|
/* Tabs 产品化 */
|
||||||
|
|||||||
Reference in New Issue
Block a user