|
@@ -1,6 +1,7 @@
|
|
|
import uuid
|
|
import uuid
|
|
|
|
|
|
|
|
from fastapi import Depends, APIRouter, Query, HTTPException
|
|
from fastapi import Depends, APIRouter, Query, HTTPException
|
|
|
|
|
+from fastapi.responses import JSONResponse
|
|
|
from pydantic import BaseModel
|
|
from pydantic import BaseModel
|
|
|
from sqlalchemy.orm import Session
|
|
from sqlalchemy.orm import Session
|
|
|
|
|
|
|
@@ -51,6 +52,17 @@ async def chat_list(agent_id: str, db: Session = Depends(get_db), current_user:
|
|
|
return ResponseList(code=200, msg="Unsupported agent type")
|
|
return ResponseList(code=200, msg="Unsupported agent type")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+@router.get("/{conversation_id}/session_log")
|
|
|
|
|
+async def session_log(conversation_id: str, db: Session = Depends(get_db), current_user: UserModel = Depends(get_current_user)):
|
|
|
|
|
+ ragflow_service = RagflowService(base_url=settings.fwr_base_url)
|
|
|
|
|
+ try:
|
|
|
|
|
+ token = get_ragflow_token(db, current_user.id)
|
|
|
|
|
+ result = await ragflow_service.get_session_log(token, conversation_id)
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
|
+ return JSONResponse(status_code=200, content={"code": 200, "log": result})
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@router.get("/get-chat-id/{agent_id}", response_model=Response)
|
|
@router.get("/get-chat-id/{agent_id}", response_model=Response)
|
|
|
async def get_chat_id(agent_id: str, db: Session = Depends(get_db)):
|
|
async def get_chat_id(agent_id: str, db: Session = Depends(get_db)):
|
|
|
agent = db.query(AgentModel).filter(AgentModel.id == agent_id).first()
|
|
agent = db.query(AgentModel).filter(AgentModel.id == agent_id).first()
|