Skip to content

Commit abee513

Browse files
authored
Revert "Initial set of changes to setup react app for getting started templat…" (#98)
This reverts commit 70f41d3.
1 parent 70f41d3 commit abee513

File tree

14 files changed

+2
-2021
lines changed

14 files changed

+2
-2021
lines changed

.gitignore

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,3 @@ ENV/
99
env.bak/
1010
venv.bak/
1111
.azure
12-
13-
# Node.js dependencies
14-
node_modules/
15-
.pnpm-store/
16-
.pnpm-debug.log
17-
18-
# React build output
19-
src/api/static/react/

src/api/main.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ def create_app():
121121
directory = os.path.join(os.path.dirname(__file__), "static")
122122
app = fastapi.FastAPI(lifespan=lifespan)
123123
app.mount("/static", StaticFiles(directory=directory), name="static")
124-
125-
# Mount React static files
126-
react_directory = os.path.join(os.path.dirname(__file__), "static/react")
127-
app.mount("/static/react", StaticFiles(directory=react_directory), name="react")
128124

129125
from . import routes # Import routes
130126
app.include_router(routes.router)

src/api/routes.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,6 @@ def get_agent(request: Request) -> Agent:
4949
return request.app.state.agent
5050

5151

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-
7452
def serialize_sse_event(data: Dict) -> str:
7553
return f"data: {json.dumps(data)}\n\n"
7654

@@ -154,18 +132,7 @@ async def on_run_step(self, step: RunStep) -> Optional[str]:
154132

155133
@router.get("/", response_class=HTMLResponse)
156134
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})
169136

170137

171138
async def get_result(thread_id: str, agent_id: str, ai_client : AIProjectClient) -> AsyncGenerator[str, None]:

src/api/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ <h5 class="mb-0">Document Viewer</h5>
101101
<script src="https://cdn.jsdelivr.net/npm/markdown-it/dist/markdown-it.min.js"></script>
102102
<script type="module" src="/static/main.js"></script>
103103
</body>
104-
</html>
104+
</html>

src/api/templates/index_react.html

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/frontend/package.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)