leonsimon23 commited on
Commit
60fe0d9
·
verified ·
1 Parent(s): feb5622

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -18
app.py CHANGED
@@ -140,13 +140,12 @@ def create_chat_interface():
140
  min-height: 400px; /* 设置最小高度 */
141
  overflow-y: auto;
142
  padding: 15px;
143
- display: flex;
144
- flex-direction: column;
145
  }
146
  .chatbot-row {
147
  margin-bottom: 10px;
148
  display: flex;
149
  align-items: start; /* 对齐消息气泡顶部 */
 
150
  }
151
  .chatbot .user {
152
  justify-content: flex-end;
@@ -166,28 +165,17 @@ def create_chat_interface():
166
  background-color: #dcf8c6; /* 更清新的用户消息背景 */
167
  color: #333;
168
  border-top-right-radius: 5px;
 
169
  }
170
  .chatbot .bot-message {
171
  background-color: #e1e1eb; /* 更柔和的Bot消息背景 */
172
  color: #333;
173
  border-top-left-radius: 5px;
 
174
  }
 
175
  .chatbot .avatar {
176
- width: 30px;
177
- height: 30px;
178
- border-radius: 50%;
179
- background-color: #ccc;
180
- color: #fff;
181
- display: flex;
182
- align-items: center;
183
- justify-content: center;
184
- margin: 0 10px;
185
- }
186
- .chatbot .user .avatar {
187
- background-color: #007bff;
188
- }
189
- .chatbot .bot .avatar {
190
- background-color: #6c757d;
191
  }
192
  .chatbot :last-child {
193
  margin-bottom: 0;
@@ -258,7 +246,7 @@ def create_chat_interface():
258
  elem_classes="chatbot",
259
  show_label=False,
260
  bubble_full_width=False,
261
- avatar_images=("👤", "🤖")
262
  )
263
 
264
  with gr.Column(elem_classes="input-container"):
@@ -302,4 +290,6 @@ def create_chat_interface():
302
 
303
  if __name__ == "__main__":
304
  demo = create_chat_interface()
 
 
305
  demo.launch(debug=True)
 
140
  min-height: 400px; /* 设置最小高度 */
141
  overflow-y: auto;
142
  padding: 15px;
 
 
143
  }
144
  .chatbot-row {
145
  margin-bottom: 10px;
146
  display: flex;
147
  align-items: start; /* 对齐消息气泡顶部 */
148
+ gap: 10px; /* 消息之间的间距 */
149
  }
150
  .chatbot .user {
151
  justify-content: flex-end;
 
165
  background-color: #dcf8c6; /* 更清新的用户消息背景 */
166
  color: #333;
167
  border-top-right-radius: 5px;
168
+ margin-left: auto; /* 将用户消息推到右边 */
169
  }
170
  .chatbot .bot-message {
171
  background-color: #e1e1eb; /* 更柔和的Bot消息背景 */
172
  color: #333;
173
  border-top-left-radius: 5px;
174
+ margin-right: auto; /* 将 Bot 消息推到左边 */
175
  }
176
+ /* 移除头像 */
177
  .chatbot .avatar {
178
+ display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
180
  .chatbot :last-child {
181
  margin-bottom: 0;
 
246
  elem_classes="chatbot",
247
  show_label=False,
248
  bubble_full_width=False,
249
+ avatar_images=None # 禁用头像
250
  )
251
 
252
  with gr.Column(elem_classes="input-container"):
 
290
 
291
  if __name__ == "__main__":
292
  demo = create_chat_interface()
293
+ # 请检查您的 FASTGPT_API_KEY 和 FASTGPT_BASE_URL 环境变量是否已正确配置
294
+ # 另外,请确保您的网络连接正常,以便能够调用 API。
295
  demo.launch(debug=True)