Skip to content

Commit

Permalink
PR comments - move directors
Browse files Browse the repository at this point in the history
  • Loading branch information
mic-smith committed Nov 21, 2024
1 parent 33e9716 commit 846cab6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions backend/src/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
from fastapi import FastAPI, HTTPException, Response, WebSocket, UploadFile
from fastapi.responses import JSONResponse
from fastapi.middleware.cors import CORSMiddleware
from src.report_director import report_on_file_upload
from src.directors.report_director import report_on_file_upload
from src.session.file_uploads import clear_session_file_uploads
from src.session.redis_session_middleware import reset_session
from src.utils.graph_db_utils import populate_db
from src.utils import Config, test_connection
from src.director import question
from src.directors.chat_director import question
from src.websockets.connection_manager import connection_manager, parse_message
from src.session import RedisSessionMiddleware
from src.utils.cyper_import_data_from_csv import import_data_from_csv_script
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
logger = logging.getLogger(__name__)
config = Config()
engine = PromptEngine()
director_prompt = engine.load_prompt("director")
director_prompt = engine.load_prompt("chat_director")


async def question(question: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import TypedDict
from fastapi import UploadFile

from src.utils.scratchpad import update_scratchpad
from src.utils.scratchpad import clear_scratchpad, update_scratchpad
from src.utils.file_utils import handle_file_upload

class FileUploadReport(TypedDict):
Expand All @@ -18,4 +18,6 @@ async def report_on_file_upload(upload:UploadFile) -> FileUploadReport:

report = "#Report on upload as markdown" # await report_agent.invoke(file["content"])

clear_scratchpad()

return {"filename": file["filename"], "id": file["uploadId"], "report": report}
File renamed without changes.
2 changes: 1 addition & 1 deletion backend/tests/api/app_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi.testclient import TestClient
import pytest
from src.report_director import FileUploadReport
from src.directors.report_director import FileUploadReport
from src.api import app, healthy_response, unhealthy_neo4j_response, chat_fail_response

client = TestClient(app)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import pytest

from src.session.file_uploads import FileUpload
from src.report_director import report_on_file_upload
from src.directors.report_director import report_on_file_upload

@pytest.mark.asyncio
async def test_report_on_file_upload(mocker):

file_upload = FileUpload(uploadId="1", filename="test.txt", content="test", contentType="text/plain", size=4)

mock_handle_file_upload = mocker.patch("src.report_director.handle_file_upload", return_value=file_upload)
mock_handle_file_upload = mocker.patch("src.directors.report_director.handle_file_upload", return_value=file_upload)

headers = Headers({"content-type": "text/plain"})
file = BytesIO(b"test content")
Expand Down

0 comments on commit 846cab6

Please sign in to comment.