From 6b4093952e555e1eb2713bd85133a5f697cda1e0 Mon Sep 17 00:00:00 2001 From: zhaoqingang <zhaoqg0118@163.com> Date: 星期二, 31 十二月 2024 14:21:12 +0800 Subject: [PATCH] 文档报告支持生成小标题功能 --- app/api/auth.py | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/api/auth.py b/app/api/auth.py index 2fc3ea7..423ed72 100644 --- a/app/api/auth.py +++ b/app/api/auth.py @@ -30,14 +30,14 @@ if db_user: return Response(code=200, msg="Username already registered") - bisheng_service = BishengService(settings.sgb_base_url) + # bisheng_service = BishengService(settings.sgb_base_url) ragflow_service = RagflowService(settings.fwr_base_url) # 娉ㄥ唽鍒版瘯鏄� - try: - bisheng_info = await bisheng_service.register(user.username, user.password) - except Exception as e: - return Response(code=500, msg=f"Failed to register with Bisheng: {str(e)}") + # try: + # bisheng_info = await bisheng_service.register(user.username, user.password) + # except Exception as e: + # return Response(code=500, msg=f"Failed to register with Bisheng: {str(e)}") # 娉ㄥ唽鍒皉agflow try: @@ -47,7 +47,7 @@ # 瀛樺偍鐢ㄦ埛淇℃伅 hashed_password = pwd_context.hash(user.password) - db_user = UserModel(username=user.username, hashed_password=hashed_password, email=ragflow_info.get("email", f"{user.username}@example.com"),ragflow_id=ragflow_info.get("id"),bisheng_id=bisheng_info.get("user_id")) + db_user = UserModel(username=user.username, hashed_password=hashed_password, email=ragflow_info.get("email", f"{user.username}@example.com"),ragflow_id=ragflow_info.get("id"),bisheng_id="") db_user.password = db_user.encrypted_password(user.password) db.add(db_user) db.commit() @@ -61,14 +61,14 @@ if not user: return Response(code=400, msg="Incorrect username or password") - bisheng_service = BishengService(settings.sgb_base_url) + # bisheng_service = BishengService(settings.sgb_base_url) ragflow_service = RagflowService(settings.fwr_base_url) # 鐧诲綍鍒版瘯鏄� - try: - bisheng_token = await bisheng_service.login(login_data.username, login_data.password) - except Exception as e: - return Response(code=500, msg=f"Failed to login with Bisheng: {str(e)}") + # try: + # bisheng_token = await bisheng_service.login(login_data.username, login_data.password) + # except Exception as e: + # return Response(code=500, msg=f"Failed to login with Bisheng: {str(e)}") # 鐧诲綍鍒皉agflow try: @@ -79,7 +79,7 @@ # 鍒涘缓鏈湴token access_token = create_access_token(data={"sub": user.username, "user_id": user.id}) - upsert_token(db, user.id, access_token, bisheng_token, ragflow_token) + upsert_token(db, user.id, access_token, "", ragflow_token) return Response(code=200, msg="Login successful", data={ "access_token": access_token, -- Gitblit v1.8.0