Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
•
cff018d
1
Parent(s):
0f2f299
优化UI
Browse files- ChuanhuChatbot.py +6 -6
- utils.py +1 -1
ChuanhuChatbot.py
CHANGED
@@ -116,7 +116,7 @@ with gr.Blocks(
|
|
116 |
# background_fill_primary="#F7F7F7",
|
117 |
# background_fill_primary_dark="#1F1F1F",
|
118 |
block_title_text_color="*primary_500",
|
119 |
-
block_title_background_fill
|
120 |
input_background_fill="#F6F6F6",
|
121 |
),
|
122 |
) as demo:
|
@@ -178,7 +178,7 @@ with gr.Blocks(
|
|
178 |
label="System prompt",
|
179 |
value=initial_prompt,
|
180 |
lines=10,
|
181 |
-
).style(container=
|
182 |
with gr.Accordion(label="加载Prompt模板", open=True):
|
183 |
with gr.Column():
|
184 |
with gr.Row():
|
@@ -188,7 +188,7 @@ with gr.Blocks(
|
|
188 |
choices=get_template_names(plain=True),
|
189 |
multiselect=False,
|
190 |
value=get_template_names(plain=True)[0],
|
191 |
-
)
|
192 |
with gr.Column(scale=1):
|
193 |
templateRefreshBtn = gr.Button("🔄 刷新")
|
194 |
with gr.Row():
|
@@ -202,7 +202,7 @@ with gr.Blocks(
|
|
202 |
value=load_template(
|
203 |
get_template_names(plain=True)[0], mode=1
|
204 |
)[0],
|
205 |
-
)
|
206 |
|
207 |
with gr.Tab(label="保存/加载"):
|
208 |
with gr.Accordion(label="保存/加载对话历史记录", open=True):
|
@@ -291,7 +291,7 @@ with gr.Blocks(
|
|
291 |
use_streaming_checkbox,
|
292 |
model_select_dropdown,
|
293 |
use_websearch_checkbox,
|
294 |
-
index_files
|
295 |
],
|
296 |
[chatbot, history, status_display, token_count],
|
297 |
show_progress=True,
|
@@ -312,7 +312,7 @@ with gr.Blocks(
|
|
312 |
use_streaming_checkbox,
|
313 |
model_select_dropdown,
|
314 |
use_websearch_checkbox,
|
315 |
-
index_files
|
316 |
],
|
317 |
[chatbot, history, status_display, token_count],
|
318 |
show_progress=True,
|
|
|
116 |
# background_fill_primary="#F7F7F7",
|
117 |
# background_fill_primary_dark="#1F1F1F",
|
118 |
block_title_text_color="*primary_500",
|
119 |
+
block_title_background_fill="*primary_100",
|
120 |
input_background_fill="#F6F6F6",
|
121 |
),
|
122 |
) as demo:
|
|
|
178 |
label="System prompt",
|
179 |
value=initial_prompt,
|
180 |
lines=10,
|
181 |
+
).style(container=False)
|
182 |
with gr.Accordion(label="加载Prompt模板", open=True):
|
183 |
with gr.Column():
|
184 |
with gr.Row():
|
|
|
188 |
choices=get_template_names(plain=True),
|
189 |
multiselect=False,
|
190 |
value=get_template_names(plain=True)[0],
|
191 |
+
).style(container=False)
|
192 |
with gr.Column(scale=1):
|
193 |
templateRefreshBtn = gr.Button("🔄 刷新")
|
194 |
with gr.Row():
|
|
|
202 |
value=load_template(
|
203 |
get_template_names(plain=True)[0], mode=1
|
204 |
)[0],
|
205 |
+
).style(container=False)
|
206 |
|
207 |
with gr.Tab(label="保存/加载"):
|
208 |
with gr.Accordion(label="保存/加载对话历史记录", open=True):
|
|
|
291 |
use_streaming_checkbox,
|
292 |
model_select_dropdown,
|
293 |
use_websearch_checkbox,
|
294 |
+
index_files,
|
295 |
],
|
296 |
[chatbot, history, status_display, token_count],
|
297 |
show_progress=True,
|
|
|
312 |
use_streaming_checkbox,
|
313 |
model_select_dropdown,
|
314 |
use_websearch_checkbox,
|
315 |
+
index_files,
|
316 |
],
|
317 |
[chatbot, history, status_display, token_count],
|
318 |
show_progress=True,
|
utils.py
CHANGED
@@ -288,7 +288,7 @@ def get_geoip():
|
|
288 |
response = requests.get('https://ipapi.co/json/', timeout=5)
|
289 |
data = response.json()
|
290 |
if "error" in data.keys():
|
291 |
-
logging.
|
292 |
if data['reason'] == "RateLimited":
|
293 |
return f"获取IP地理位置失败,因为达到了检测IP的速率限制。聊天功能可能仍然可用,但请注意,如果您的IP地址在不受支持的地区,您可能会遇到问题。"
|
294 |
else:
|
|
|
288 |
response = requests.get('https://ipapi.co/json/', timeout=5)
|
289 |
data = response.json()
|
290 |
if "error" in data.keys():
|
291 |
+
logging.warning(f"无法获取IP地址信息。\n{data}")
|
292 |
if data['reason'] == "RateLimited":
|
293 |
return f"获取IP地理位置失败,因为达到了检测IP的速率限制。聊天功能可能仍然可用,但请注意,如果您的IP地址在不受支持的地区,您可能会遇到问题。"
|
294 |
else:
|