zzc0208 commited on
Commit
27f9849
·
verified ·
1 Parent(s): 32a87bd

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +6 -2
  2. useapi.py +2 -1
app.py CHANGED
@@ -362,8 +362,12 @@ async def update_preset_prompt(char_id, language):
362
  response = requests.get(avatar_image_url)
363
  image = Image.open(io.BytesIO(response.content))
364
  resized_image = image.resize((256, 256))
365
- return gr.update(choices=preset_prompts), resized_image
366
-
 
 
 
 
367
 
368
  def update_chat_and_avatar(moment):
369
  opening = [(None, moment["opening"])]
 
362
  response = requests.get(avatar_image_url)
363
  image = Image.open(io.BytesIO(response.content))
364
  resized_image = image.resize((256, 256))
365
+ # 直接在这里设置 preset_prompt 的默认值为第一个选项
366
+ if preset_prompts:
367
+ preset_prompt_update = gr.update(choices=preset_prompts, value=preset_prompts[0][1])
368
+ else:
369
+ preset_prompt_update = gr.update(choices=[], value=None)
370
+ return preset_prompt_update, resized_image
371
 
372
  def update_chat_and_avatar(moment):
373
  opening = [(None, moment["opening"])]
useapi.py CHANGED
@@ -33,7 +33,8 @@ def create_headers(language):
33
  'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
34
  'Authorization': auth,
35
  'Accept': '*/*',
36
- 'Connection': 'keep-alive'
 
37
  }
38
 
39
  def recommand_character(language):
 
33
  'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
34
  'Authorization': auth,
35
  'Accept': '*/*',
36
+ 'Connection': 'keep-alive',
37
+ 'X-nsfw': '1'
38
  }
39
 
40
  def recommand_character(language):