sirochild commited on
Commit
186e5ca
·
verified ·
1 Parent(s): c3aef17

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -311,8 +311,13 @@ def respond(message, chat_history, affection, history, scene_params):
311
  # 通常会話はGeminiを使用
312
  bot_message = generate_dialogue_with_gemini(history, message, new_affection, stage_name, final_scene_params)
313
 
 
314
  new_history = history + [(message, bot_message)]
 
 
 
315
  chat_history.append((message, bot_message))
 
316
  theme_name = final_scene_params.get("theme", "default")
317
 
318
  # より強力な背景更新用のHTMLを生成
@@ -379,7 +384,8 @@ with gr.Blocks(css=custom_css, theme=custom_theme) as demo:
379
  elem_id="chat_area",
380
  show_label=False,
381
  height=400,
382
- type="messages", # 警告を解消するために追加
 
383
  avatar_images=[
384
  "https://cdn.pixabay.com/photo/2016/04/01/10/04/amusing-1299756_1280.png",
385
  "https://cdn.pixabay.com/photo/2016/03/31/21/40/bot-1296595_1280.png"
 
311
  # 通常会話はGeminiを使用
312
  bot_message = generate_dialogue_with_gemini(history, message, new_affection, stage_name, final_scene_params)
313
 
314
+ # 内部履歴はタプル形式で保持
315
  new_history = history + [(message, bot_message)]
316
+
317
+ # Gradio 5.0のChatbotコンポーネント用に、タプル形式でappend
318
+ # (Gradio 5.0では警告が出るが、type="messages"を指定していないので動作する)
319
  chat_history.append((message, bot_message))
320
+
321
  theme_name = final_scene_params.get("theme", "default")
322
 
323
  # より強力な背景更新用のHTMLを生成
 
384
  elem_id="chat_area",
385
  show_label=False,
386
  height=400,
387
+ # Gradio 5.0では type="messages" を使用すると形式が変わるため、
388
+ # 従来の形式を使用
389
  avatar_images=[
390
  "https://cdn.pixabay.com/photo/2016/04/01/10/04/amusing-1299756_1280.png",
391
  "https://cdn.pixabay.com/photo/2016/03/31/21/40/bot-1296595_1280.png"