jostlebot Claude Opus 4.5 commited on
Commit
2c70f0f
·
1 Parent(s): e3f7330

Downgrade to Gradio 4.44.0 to fix compatibility bug

Browse files

Revert to Gradio 4.x which is stable with the Chatbot component.
Use default tuple format for chat history.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +7 -22
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🌱
4
  colorFrom: yellow
5
  colorTo: pink
6
  sdk: gradio
7
- sdk_version: 5.9.1
8
  app_file: app.py
9
  pinned: false
10
  ---
 
4
  colorFrom: yellow
5
  colorTo: pink
6
  sdk: gradio
7
+ sdk_version: 4.44.0
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -881,8 +881,7 @@ def create_app():
881
  height=500,
882
  show_label=True,
883
  elem_id="chatbot",
884
- bubble_full_width=False,
885
- type="messages"
886
  )
887
 
888
  # Needs selector (hidden until stage 5)
@@ -1004,10 +1003,7 @@ def create_app():
1004
 
1005
  if stage == 5 and not sel_needs:
1006
  bot_response = "Please take a moment to select your needs from the list above, then click 'Confirm My Needs' to continue."
1007
- history = history + [
1008
- {"role": "user", "content": message},
1009
- {"role": "assistant", "content": bot_response}
1010
- ]
1011
  return (
1012
  history, "", stage, session, sel_needs,
1013
  f"{stage}/13: {STAGE_NAMES[stage]}",
@@ -1024,10 +1020,7 @@ def create_app():
1024
  )
1025
 
1026
  if error:
1027
- history = history + [
1028
- {"role": "user", "content": message},
1029
- {"role": "assistant", "content": error}
1030
- ]
1031
  return (
1032
  history, "", stage, session, sel_needs,
1033
  f"{stage}/13: {STAGE_NAMES[stage]}",
@@ -1036,14 +1029,9 @@ def create_app():
1036
  )
1037
 
1038
  if message != "continue":
1039
- history = history + [
1040
- {"role": "user", "content": message},
1041
- {"role": "assistant", "content": response}
1042
- ]
1043
  else:
1044
- history = history + [
1045
- {"role": "assistant", "content": response}
1046
- ]
1047
 
1048
  show_needs = (next_stage == 5)
1049
 
@@ -1089,7 +1077,7 @@ def create_app():
1089
  if not all_selected:
1090
  return (
1091
  all_selected,
1092
- history + [{"role": "assistant", "content": "Please select at least one need before continuing."}],
1093
  stage,
1094
  session
1095
  )
@@ -1103,10 +1091,7 @@ def create_app():
1103
  True
1104
  )
1105
 
1106
- history = history + [
1107
- {"role": "user", "content": f"Selected needs: {', '.join(all_selected)}"},
1108
- {"role": "assistant", "content": response}
1109
- ]
1110
 
1111
  return all_selected, history, next_stage, updated_session
1112
 
 
881
  height=500,
882
  show_label=True,
883
  elem_id="chatbot",
884
+ bubble_full_width=False
 
885
  )
886
 
887
  # Needs selector (hidden until stage 5)
 
1003
 
1004
  if stage == 5 and not sel_needs:
1005
  bot_response = "Please take a moment to select your needs from the list above, then click 'Confirm My Needs' to continue."
1006
+ history = history + [[message, bot_response]]
 
 
 
1007
  return (
1008
  history, "", stage, session, sel_needs,
1009
  f"{stage}/13: {STAGE_NAMES[stage]}",
 
1020
  )
1021
 
1022
  if error:
1023
+ history = history + [[message, error]]
 
 
 
1024
  return (
1025
  history, "", stage, session, sel_needs,
1026
  f"{stage}/13: {STAGE_NAMES[stage]}",
 
1029
  )
1030
 
1031
  if message != "continue":
1032
+ history = history + [[message, response]]
 
 
 
1033
  else:
1034
+ history = history + [[None, response]]
 
 
1035
 
1036
  show_needs = (next_stage == 5)
1037
 
 
1077
  if not all_selected:
1078
  return (
1079
  all_selected,
1080
+ history + [[None, "Please select at least one need before continuing."]],
1081
  stage,
1082
  session
1083
  )
 
1091
  True
1092
  )
1093
 
1094
+ history = history + [[f"Selected needs: {', '.join(all_selected)}", response]]
 
 
 
1095
 
1096
  return all_selected, history, next_stage, updated_session
1097