Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -848,6 +848,132 @@ input[disabled] {
|
|
| 848 |
border: 1px solid rgba(94, 74, 40, .45) !important;
|
| 849 |
}
|
| 850 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 851 |
"""
|
| 852 |
|
| 853 |
HEADER_HTML = """
|
|
@@ -1014,7 +1140,8 @@ def create_interface():
|
|
| 1014 |
with gr.Accordion("▸ 查看檢索到的文本片段", open=False):
|
| 1015 |
src = gr.Textbox(label="檢索到的文本片段", lines=10, interactive=False)
|
| 1016 |
|
| 1017 |
-
gr.
|
|
|
|
| 1018 |
|
| 1019 |
# ── 事件綁定 ──────────────────────────────────
|
| 1020 |
apply_key_btn.click(fn=apply_api_key, inputs=[api_key_input], outputs=[api_key_status])
|
|
|
|
| 848 |
border: 1px solid rgba(94, 74, 40, .45) !important;
|
| 849 |
}
|
| 850 |
|
| 851 |
+
/* ===== 修正右下方 Accordion / Details 標題太暗 ===== */
|
| 852 |
+
.gradio-container details,
|
| 853 |
+
.gradio-container .gr-accordion,
|
| 854 |
+
.gradio-container [data-testid="accordion"],
|
| 855 |
+
.gradio-container [class*="accordion"] {
|
| 856 |
+
background: #241f1d !important;
|
| 857 |
+
border: 1px solid rgba(184, 138, 66, 0.55) !important;
|
| 858 |
+
border-radius: 8px !important;
|
| 859 |
+
color: #fff2c7 !important;
|
| 860 |
+
}
|
| 861 |
+
|
| 862 |
+
.gradio-container details summary,
|
| 863 |
+
.gradio-container .gr-accordion summary,
|
| 864 |
+
.gradio-container [data-testid="accordion"] summary,
|
| 865 |
+
.gradio-container [class*="accordion"] summary,
|
| 866 |
+
.gradio-container details summary *,
|
| 867 |
+
.gradio-container .gr-accordion summary *,
|
| 868 |
+
.gradio-container [data-testid="accordion"] summary *,
|
| 869 |
+
.gradio-container [class*="accordion"] summary * {
|
| 870 |
+
background: #241f1d !important;
|
| 871 |
+
color: #fff2c7 !important;
|
| 872 |
+
opacity: 1 !important;
|
| 873 |
+
font-weight: 800 !important;
|
| 874 |
+
text-shadow: none !important;
|
| 875 |
+
}
|
| 876 |
+
|
| 877 |
+
.gradio-container details summary::marker {
|
| 878 |
+
color: #fff2c7 !important;
|
| 879 |
+
}
|
| 880 |
+
|
| 881 |
+
.gradio-container details svg,
|
| 882 |
+
.gradio-container .gr-accordion svg,
|
| 883 |
+
.gradio-container [data-testid="accordion"] svg {
|
| 884 |
+
color: #fff2c7 !important;
|
| 885 |
+
fill: #fff2c7 !important;
|
| 886 |
+
stroke: #fff2c7 !important;
|
| 887 |
+
}
|
| 888 |
+
|
| 889 |
+
/* 範例問法標題不要太白或太淡 */
|
| 890 |
+
.gradio-container .gr-examples,
|
| 891 |
+
.gradio-container .gr-examples *,
|
| 892 |
+
.gradio-container [data-testid="examples"],
|
| 893 |
+
.gradio-container [data-testid="examples"] *,
|
| 894 |
+
.gradio-container .examples,
|
| 895 |
+
.gradio-container .examples * {
|
| 896 |
+
color: #1c2433 !important;
|
| 897 |
+
opacity: 1 !important;
|
| 898 |
+
}
|
| 899 |
+
|
| 900 |
+
.gradio-container .gr-examples > label,
|
| 901 |
+
.gradio-container .gr-examples .label-wrap,
|
| 902 |
+
.gradio-container .gr-examples .label-wrap *,
|
| 903 |
+
.gradio-container [data-testid="examples"] label,
|
| 904 |
+
.gradio-container [data-testid="examples"] .label-wrap,
|
| 905 |
+
.gradio-container [data-testid="examples"] .label-wrap * {
|
| 906 |
+
color: #9a6b28 !important;
|
| 907 |
+
font-weight: 800 !important;
|
| 908 |
+
}
|
| 909 |
+
|
| 910 |
+
/* 深色框內的輸出/文字標籤統一亮金色 */
|
| 911 |
+
.gradio-container .gr-textbox label,
|
| 912 |
+
.gradio-container .gr-textbox label *,
|
| 913 |
+
.gradio-container .gr-file label,
|
| 914 |
+
.gradio-container .gr-file label *,
|
| 915 |
+
.gradio-container .file-preview,
|
| 916 |
+
.gradio-container .file-preview *,
|
| 917 |
+
.gradio-container [data-testid="file"] label,
|
| 918 |
+
.gradio-container [data-testid="file"] label * {
|
| 919 |
+
color: #fff2c7 !important;
|
| 920 |
+
opacity: 1 !important;
|
| 921 |
+
font-weight: 800 !important;
|
| 922 |
+
}
|
| 923 |
+
|
| 924 |
+
|
| 925 |
+
|
| 926 |
+
/* ===== 範例問法標題修正:改用獨立標題,避免 Gradio label 變淡 ===== */
|
| 927 |
+
.examples-title {
|
| 928 |
+
display: flex;
|
| 929 |
+
align-items: center;
|
| 930 |
+
gap: 10px;
|
| 931 |
+
margin: 14px 0 10px;
|
| 932 |
+
color: #1c2433 !important;
|
| 933 |
+
opacity: 1 !important;
|
| 934 |
+
font-size: 14px;
|
| 935 |
+
font-weight: 900;
|
| 936 |
+
letter-spacing: .12em;
|
| 937 |
+
text-shadow: none !important;
|
| 938 |
+
}
|
| 939 |
+
.examples-title::after {
|
| 940 |
+
content: '';
|
| 941 |
+
flex: 1;
|
| 942 |
+
height: 1px;
|
| 943 |
+
background: linear-gradient(90deg, rgba(184,138,66,.45), rgba(184,138,66,0));
|
| 944 |
+
}
|
| 945 |
+
|
| 946 |
+
/* 隱藏 Gradio Examples 內建淡色 label,保留上方自訂標題 */
|
| 947 |
+
.gradio-container .gr-examples > label,
|
| 948 |
+
.gradio-container .gr-examples .label-wrap,
|
| 949 |
+
.gradio-container [data-testid="examples"] > label,
|
| 950 |
+
.gradio-container [data-testid="examples"] .label-wrap,
|
| 951 |
+
.gradio-container .examples > label,
|
| 952 |
+
.gradio-container .examples .label-wrap {
|
| 953 |
+
display: none !important;
|
| 954 |
+
}
|
| 955 |
+
|
| 956 |
+
/* 範例按鈕:維持紙面深色文字,避免被全域亮字覆蓋 */
|
| 957 |
+
.gradio-container .gr-examples button,
|
| 958 |
+
.gradio-container .gr-examples button *,
|
| 959 |
+
.gradio-container [data-testid="examples"] button,
|
| 960 |
+
.gradio-container [data-testid="examples"] button *,
|
| 961 |
+
.gradio-container .examples button,
|
| 962 |
+
.gradio-container .examples button * {
|
| 963 |
+
color: #21170f !important;
|
| 964 |
+
-webkit-text-fill-color: #21170f !important;
|
| 965 |
+
opacity: 1 !important;
|
| 966 |
+
font-weight: 700 !important;
|
| 967 |
+
text-shadow: none !important;
|
| 968 |
+
}
|
| 969 |
+
|
| 970 |
+
.gradio-container .gr-examples button,
|
| 971 |
+
.gradio-container [data-testid="examples"] button,
|
| 972 |
+
.gradio-container .examples button {
|
| 973 |
+
background: rgba(255, 248, 234, .98) !important;
|
| 974 |
+
border: 1px solid rgba(66, 49, 26, .55) !important;
|
| 975 |
+
border-radius: 8px !important;
|
| 976 |
+
}
|
| 977 |
"""
|
| 978 |
|
| 979 |
HEADER_HTML = """
|
|
|
|
| 1140 |
with gr.Accordion("▸ 查看檢索到的文本片段", open=False):
|
| 1141 |
src = gr.Textbox(label="檢索到的文本片段", lines=10, interactive=False)
|
| 1142 |
|
| 1143 |
+
gr.HTML("<div class='examples-title'>三 範例問法</div>")
|
| 1144 |
+
gr.Examples(examples=EXAMPLE_QS, inputs=qin, label="")
|
| 1145 |
|
| 1146 |
# ── 事件綁定 ──────────────────────────────────
|
| 1147 |
apply_key_btn.click(fn=apply_api_key, inputs=[api_key_input], outputs=[api_key_status])
|