Skip to content

Commit

Permalink
Updated Readme path in dashboard and docker ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwinzyx committed Aug 2, 2024
1 parent a44a6c0 commit 97b2565
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
11 changes: 9 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
*.log
*.pyc
*.db
.DS_Store
.dockerignore
.git
.gitignore
venv/



!.env-Sample
!.README.md
!.LICENSE
!README.md
!LICENSE
!assets/
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ RUN pip install dist/*.gz
WORKDIR /

# Optionally, you can delete hidden files and directories as well
RUN rm -rf ragbuilder/src
RUN rm -rf /ragbuilder/*

WORKDIR /ragbuilder

COPY LICENSE /ragbuilder/LICENSE
COPY .env-Sample /ragbuilder/.env-Sample
COPY README.md /ragbuilder/README.md



# Make port 80 available to the world outside this container
EXPOSE 8005


# Run app.py when the container launches
CMD ["ragbuilder"]
16 changes: 10 additions & 6 deletions src/ragbuilder/ragbuilder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from fastapi import FastAPI, Depends, HTTPException, Request
from fastapi.responses import HTMLResponse, JSONResponse
from fastapi.responses import RedirectResponse
from fastapi.templating import Jinja2Templates
from fastapi.staticfiles import StaticFiles
from fastapi.logger import logger
Expand Down Expand Up @@ -160,12 +161,15 @@ async def details(request: Request, eval_id: int, db: sqlite3.Connection = Depen
db.close()
return templates.TemplateResponse(request=request, name='details.html', context={"details": details})

@app.get("/read_docs", response_class=HTMLResponse)
def docs(request: Request):
with open("README.md", "r") as f:
markdown_text = f.read()
html = markdown.markdown(markdown_text)
return templates.TemplateResponse(request=request, name='docs.html', context={"content": html})
# @app.get("/read_docs", response_class=HTMLResponse)
# def docs(request: Request):
# with open("README.md", "r") as f:
# markdown_text = f.read()
# html = markdown.markdown(markdown_text)
# return templates.TemplateResponse(request=request, name='docs.html', context={"content": html})
@app.get("/read_docs", response_class=RedirectResponse)
def docs():
return RedirectResponse(url="https://github.com/KruxAI/ragbuilder/blob/main/README.md")

@app.get('/view_log/{filename}', response_class=HTMLResponse)
async def view_log(request: Request, filename: str):
Expand Down

0 comments on commit 97b2565

Please sign in to comment.