@@ -49,28 +49,6 @@ def get_agent(request: Request) -> Agent:
49
49
return request .app .state .agent
50
50
51
51
52
- def get_react_bundle_path () -> str :
53
- """Get the path to the latest React bundle from the Vite manifest file."""
54
- manifest_path = os .path .join (os .path .dirname (__file__ ), "static" , "react" , ".vite" , "manifest.json" )
55
- try :
56
- with open (manifest_path , 'r' ) as f :
57
- manifest = json .load (f )
58
- # Get the main entry point bundle
59
- if "src/main.jsx" in manifest :
60
- return f"/static/react/{ manifest ['src/main.jsx' ]['file' ]} "
61
- # Fallback to any entry point if the expected one isn't found
62
- for key , value in manifest .items ():
63
- if value .get ("isEntry" , False ):
64
- return f"/static/react/{ value ['file' ]} "
65
- # If no entries are found, return a default path
66
- logger .warning ("No entries found in Vite manifest, using fallback path" )
67
- return "/static/react/assets/main.js"
68
- except (FileNotFoundError , json .JSONDecodeError , KeyError ) as e :
69
- logger .error (f"Error reading Vite manifest: { e } " )
70
- # Return a default path if the manifest can't be read
71
- return "/static/react/assets/main.js"
72
-
73
-
74
52
def serialize_sse_event (data : Dict ) -> str :
75
53
return f"data: { json .dumps (data )} \n \n "
76
54
@@ -154,18 +132,7 @@ async def on_run_step(self, step: RunStep) -> Optional[str]:
154
132
155
133
@router .get ("/" , response_class = HTMLResponse )
156
134
async def index (request : Request ):
157
- # Check if the useReactApp query parameter is present and set to 'true'
158
- use_react_app = request .query_params .get ('useReactApp' , '' ).lower () == 'true'
159
-
160
- # Use different template files based on whether React is enabled
161
- template_name = "index_react.html" if use_react_app else "index.html"
162
-
163
- return templates .TemplateResponse (
164
- template_name ,
165
- {
166
- "request" : request ,
167
- }
168
- )
135
+ return templates .TemplateResponse ("index.html" , {"request" : request })
169
136
170
137
171
138
async def get_result (thread_id : str , agent_id : str , ai_client : AIProjectClient ) -> AsyncGenerator [str , None ]:
0 commit comments