From b9b76445fc48ad638ac5b0306c9267141a98e78d Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Thu, 15 May 2025 09:27:19 +0200
Subject: [PATCH] rerun4
---
routes/routeMsft.py | 49 +--------------------------------------------
1 file changed, 1 insertion(+), 48 deletions(-)
diff --git a/routes/routeMsft.py b/routes/routeMsft.py
index c5afed9b..917ab74e 100644
--- a/routes/routeMsft.py
+++ b/routes/routeMsft.py
@@ -480,7 +480,6 @@ async def get_access_token(currentUser: Dict[str, Any] = Depends(getCurrentActiv
detail=f"Error getting access token: {str(e)}"
)
-
@router.post("/token")
async def get_backend_token(request: Request):
"""Convert MSAL token to backend token"""
@@ -543,7 +542,7 @@ async def get_backend_token(request: Request):
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail=f"Error processing MSAL token: {str(e)}"
)
-=======
+
@router.post("/save-token")
async def save_token(token_data: Dict[str, Any], currentUser: Dict[str, Any] = Depends(getCurrentActiveUser)):
"""Save Microsoft token data from frontend"""
@@ -568,49 +567,3 @@ async def save_token(token_data: Dict[str, Any], currentUser: Dict[str, Any] = D
"success": False,
"message": f"Error saving token: {str(e)}"
})
-
-async def generateFinalMessage(self, objUserResponse: str, objFinalDocuments: List[str], objResults: List[Dict[str, Any]]) -> Dict[str, Any]:
- """Generate the final message for the workflow"""
- try:
- # Get list of delivered documents
- matchingDocuments = []
- for result in objResults:
- if "documents" in result:
- for doc in result["documents"]:
- if doc.get("label") in objFinalDocuments:
- matchingDocuments.append(doc.get("label"))
-
- # Use the mydom for language-aware AI calls
- finalPrompt = await self.mydom.callAi([
- {"role": "system", "content": "You are a project manager, who delivers results to a user."},
- {"role": "user", "content": f"""
-Give a brief summary of what has been accomplished, referencing the initial request (objUserResponse). List only the files that have been successfully delivered (filesDelivered). Keep the message concise and professional.
-
-Here the data:
-objUserResponse = {self.parseJson2text(objUserResponse)}
-filesDelivered = {self.parseJson2text(matchingDocuments)}
-"""
- }
- ], produceUserAnswer=True)
-
- # Create basic message structure with proper fields
- logger.debug(f"FINAL PROMPT = {self.parseJson2text(finalPrompt)}.")
- finalMessage = {
- "role": "assistant",
- "agentName": "Project Manager",
- "content": finalPrompt,
- "documents": [] # DO NOT include the results documents, already with agents
- }
-
- logger.debug(f"FINAL MESSAGE = {self.parseJson2text(finalMessage)}.")
- return finalMessage
-
- except Exception as e:
- logger.error(f"Error generating final message: {str(e)}")
- return {
- "role": "assistant",
- "agentName": "Project Manager",
- "content": "I apologize, but there was an error generating the final message. Please check the logs for more details.",
- "documents": []
- }
-