WinstonDeng commited on
Commit
0bf6104
·
verified ·
1 Parent(s): c8aeeb9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -2
app.py CHANGED
@@ -11,6 +11,24 @@ STEPFUN_API_KEY = os.environ.get("STEPFUN_API_KEY", "")
11
  STEPFUN_BASE_URL = "https://api.stepfun.com/v1"
12
  MODEL_NAME = "step-3.5-flash"
13
  HF_CONFIG_URL = "https://huggingface.co/stepfun-ai/Step-3.5-Flash/raw/main/config.json"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  st.set_page_config(
16
  page_title="Step-3.5-Flash",
@@ -176,7 +194,7 @@ def main():
176
  with st.chat_message("user"):
177
  st.markdown(msg["content"])
178
  elif msg["role"] == "assistant":
179
- with st.chat_message("assistant", avatar="🚀"):
180
  # 思考内容用 expander
181
  if msg.get("thinking"):
182
  render_thinking_expander(msg["thinking"], is_streaming=False)
@@ -212,7 +230,7 @@ def main():
212
  st.markdown(prompt)
213
 
214
  # 助手回复
215
- with st.chat_message("assistant", avatar="🚀"):
216
  # 思考内容占位符
217
  thinking_placeholder = st.empty()
218
  # 回答内容占位符
 
11
  STEPFUN_BASE_URL = "https://api.stepfun.com/v1"
12
  MODEL_NAME = "step-3.5-flash"
13
  HF_CONFIG_URL = "https://huggingface.co/stepfun-ai/Step-3.5-Flash/raw/main/config.json"
14
+ STEPFUN_LOGO_URL = "https://huggingface.co/stepfun-ai/Step-3.5-Flash/resolve/main/stepfun.svg"
15
+ STEPFUN_LOGO_PATH = "/tmp/stepfun_logo.svg"
16
+
17
+
18
+ def download_logo():
19
+ """下载 StepFun logo 到本地"""
20
+ if not os.path.exists(STEPFUN_LOGO_PATH):
21
+ try:
22
+ response = httpx.get(STEPFUN_LOGO_URL, timeout=10.0)
23
+ if response.status_code == 200:
24
+ with open(STEPFUN_LOGO_PATH, "wb") as f:
25
+ f.write(response.content)
26
+ except:
27
+ pass
28
+
29
+
30
+ # 启动时下载 logo
31
+ download_logo()
32
 
33
  st.set_page_config(
34
  page_title="Step-3.5-Flash",
 
194
  with st.chat_message("user"):
195
  st.markdown(msg["content"])
196
  elif msg["role"] == "assistant":
197
+ with st.chat_message("assistant", avatar=STEPFUN_LOGO_PATH):
198
  # 思考内容用 expander
199
  if msg.get("thinking"):
200
  render_thinking_expander(msg["thinking"], is_streaming=False)
 
230
  st.markdown(prompt)
231
 
232
  # 助手回复
233
+ with st.chat_message("assistant", avatar=STEPFUN_LOGO_PATH):
234
  # 思考内容占位符
235
  thinking_placeholder = st.empty()
236
  # 回答内容占位符