Asish Karthikeya Gogineni commited on
Commit
27fbe66
·
1 Parent(s): da942b7

fix: Resolve tuple application error in Generate page

Browse files

- Updated pages/4_✨_Generate.py to unpack (response, sources) tuple
- Prevents 'Invalid binary data format' error when using code generation
- Ensures consistent error handling across all pages

Files changed (1) hide show
  1. pages/4_✨_Generate.py +18 -3
pages/4_✨_Generate.py CHANGED
@@ -53,7 +53,12 @@ Please generate the code following the patterns and style used in this codebase.
53
  Include comments explaining the code."""
54
 
55
  try:
56
- response = chat_engine.chat(prompt)
 
 
 
 
 
57
  st.markdown("### Generated Code")
58
  st.markdown(response)
59
 
@@ -93,7 +98,12 @@ elif mode == "Modify existing code":
93
  Show the modified code with explanations of what changed."""
94
 
95
  try:
96
- response = chat_engine.chat(prompt)
 
 
 
 
 
97
  st.markdown("### Modified Code")
98
  st.markdown(response)
99
  except Exception as e:
@@ -120,7 +130,12 @@ Generate complete, production-ready code following the patterns in this codebase
120
  Include proper imports, docstrings, and error handling."""
121
 
122
  try:
123
- response = chat_engine.chat(prompt)
 
 
 
 
 
124
  st.markdown(f"### {file_name}")
125
  st.markdown(response)
126
 
 
53
  Include comments explaining the code."""
54
 
55
  try:
56
+ response_payload = chat_engine.chat(prompt)
57
+ if isinstance(response_payload, tuple):
58
+ response, _ = response_payload
59
+ else:
60
+ response = response_payload
61
+
62
  st.markdown("### Generated Code")
63
  st.markdown(response)
64
 
 
98
  Show the modified code with explanations of what changed."""
99
 
100
  try:
101
+ response_payload = chat_engine.chat(prompt)
102
+ if isinstance(response_payload, tuple):
103
+ response, _ = response_payload
104
+ else:
105
+ response = response_payload
106
+
107
  st.markdown("### Modified Code")
108
  st.markdown(response)
109
  except Exception as e:
 
130
  Include proper imports, docstrings, and error handling."""
131
 
132
  try:
133
+ response_payload = chat_engine.chat(prompt)
134
+ if isinstance(response_payload, tuple):
135
+ response, _ = response_payload
136
+ else:
137
+ response = response_payload
138
+
139
  st.markdown(f"### {file_name}")
140
  st.markdown(response)
141