| | |
| | | if agent_type == AgentType.RAGFLOW: |
| | | ragflow_service = RagflowService(base_url=settings.fwr_base_url) |
| | | try: |
| | | token = await get_ragflow_token(db, current_user.id) |
| | | result = await ragflow_service.get_chat_sessions(token, agent_id) |
| | | result = await get_session_history(db, current_user.id, agent_id, page, limit) |
| | | if not result: |
| | | result = await get_session_history(db, current_user.id, agent_id, page, limit) |
| | | token = await get_ragflow_token(db, current_user.id) |
| | | result = await ragflow_service.get_chat_sessions(token, agent_id) |
| | | except Exception as e: |
| | | print(e) |
| | | raise HTTPException(status_code=500, detail=str(e)) |
| | |
| | | for i in session.log_to_json().get("message", []): |
| | | if i.get("role") == "user": |
| | | tmp_data["question"]=i.get("content") |
| | | if "upload_filenames" in i: |
| | | tmp_data["upload_filenames"] = i.get("upload_filenames") |
| | | elif i.get("role") == "assistant": |
| | | |
| | | if isinstance(i.get("content"), dict): |