adamtobegreat commited on
Commit
e273566
·
verified ·
1 Parent(s): 5a0eaf9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -14
app.py CHANGED
@@ -108,7 +108,7 @@ if os.path.exists(logo_path):
108
  with gr.Blocks(
109
  theme="soft",
110
  css="""
111
- /* ====== logo 區塊樣式 ====== */
112
  #logo-top {
113
  position: fixed;
114
  top: 12px;
@@ -125,7 +125,7 @@ with gr.Blocks(
125
  display: block;
126
  }
127
 
128
- /* ====== 標題與副標題 ====== */
129
  #main-title-wrapper {
130
  display: flex;
131
  flex-direction: column;
@@ -140,6 +140,9 @@ with gr.Blocks(
140
  font-size: 28px;
141
  font-weight: bold;
142
  margin: 0;
 
 
 
143
  }
144
 
145
  #sub-title {
@@ -149,22 +152,28 @@ with gr.Blocks(
149
  letter-spacing: 0.5px;
150
  }
151
 
152
- /* ====== 手機版:main-title 改為兩行顯示 ====== */
153
  @media (max-width: 768px) {
154
  #main-title br {
155
- display: inline; /* 手機上顯示換行 */
 
 
 
 
 
156
  }
157
  }
 
158
  @media (min-width: 769px) {
159
  #main-title br {
160
- display: none; /* 桌機上隱藏換行 */
161
  }
162
  }
163
 
164
- /* ====== 底部版權列(含淡灰分隔線) ====== */
165
  #footer {
166
  position: fixed;
167
- bottom: 25px; /* 往上移 */
168
  left: 0;
169
  width: 100%;
170
  text-align: center;
@@ -172,11 +181,12 @@ with gr.Blocks(
172
  color: #999;
173
  font-family: "Segoe UI", "Noto Sans TC", sans-serif;
174
  letter-spacing: 0.3px;
175
- border-top: 1px solid #ddd; /* 上方淡灰細線 */
176
- padding-top: 8px; /* 線與文字距離 */
 
177
  }
178
 
179
- /* ====== 手機版自適應 ====== */
180
  @media (max-width: 768px) {
181
  #logo-top {
182
  position: static;
@@ -187,9 +197,10 @@ with gr.Blocks(
187
  background: transparent;
188
  }
189
  #footer {
190
- position: static;
191
- margin-top: 10px;
192
  border-top: 1px solid #ddd;
 
193
  }
194
  }
195
  """
@@ -210,9 +221,15 @@ with gr.Blocks(
210
  </div>
211
  """)
212
 
213
-
214
  # 底部版權列
215
- gr.HTML("<div id='footer'>© Fintech Assistant — 僅方便業務使用,非官方授權</div>")
 
 
 
 
 
 
 
216
 
217
 
218
  with gr.Row():
 
108
  with gr.Blocks(
109
  theme="soft",
110
  css="""
111
+ /* ====== logo 區塊 ====== */
112
  #logo-top {
113
  position: fixed;
114
  top: 12px;
 
125
  display: block;
126
  }
127
 
128
+ /* ====== 標題區 ====== */
129
  #main-title-wrapper {
130
  display: flex;
131
  flex-direction: column;
 
140
  font-size: 28px;
141
  font-weight: bold;
142
  margin: 0;
143
+ text-align: center;
144
+ display: inline-block;
145
+ line-height: 1.4;
146
  }
147
 
148
  #sub-title {
 
152
  letter-spacing: 0.5px;
153
  }
154
 
155
+ /* ====== 手機版:強制兩行並置中對齊 ====== */
156
  @media (max-width: 768px) {
157
  #main-title br {
158
+ display: inline;
159
+ }
160
+ #main-title {
161
+ display: block;
162
+ text-align: center; /* ✅ 讓兩行都水平置中 */
163
+ white-space: pre-line;
164
  }
165
  }
166
+
167
  @media (min-width: 769px) {
168
  #main-title br {
169
+ display: none;
170
  }
171
  }
172
 
173
+ /* ====== footer ====== */
174
  #footer {
175
  position: fixed;
176
+ bottom: 40px;
177
  left: 0;
178
  width: 100%;
179
  text-align: center;
 
181
  color: #999;
182
  font-family: "Segoe UI", "Noto Sans TC", sans-serif;
183
  letter-spacing: 0.3px;
184
+ border-top: 1px solid #ddd;
185
+ padding-top: 8px;
186
+ background-color: rgba(255,255,255,0.7);
187
  }
188
 
189
+ /* ====== 手機版 footer 修正 ====== */
190
  @media (max-width: 768px) {
191
  #logo-top {
192
  position: static;
 
197
  background: transparent;
198
  }
199
  #footer {
200
+ position: relative;
201
+ margin-top: 40px;
202
  border-top: 1px solid #ddd;
203
+ padding-top: 8px;
204
  }
205
  }
206
  """
 
221
  </div>
222
  """)
223
 
 
224
  # 底部版權列
225
+ gr.HTML("<div id='footer'>© 2025 Mega Fintech Assistant — All Rights Reserved</div>")
226
+
227
+ # 手機鍵盤彈出時捲動補丁
228
+ demo.load(None, None, None, js="""
229
+ window.addEventListener('focusin', () => {
230
+ document.querySelector('textarea')?.scrollIntoView({ behavior: 'smooth', block: 'center' });
231
+ });
232
+ """)
233
 
234
 
235
  with gr.Row():