From 00fe58a94292a3b9921ce134542ee38d74cd9401 Mon Sep 17 00:00:00 2001 From: zhaoqingang <zhaoqg0118@163.com> Date: 星期二, 14 一月 2025 18:35:14 +0800 Subject: [PATCH] tmp --- app/service/v2/app_driver/chat_data.py | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) diff --git a/app/service/v2/app_driver/chat_data.py b/app/service/v2/app_driver/chat_data.py index ebfa63d..dad38e2 100644 --- a/app/service/v2/app_driver/chat_data.py +++ b/app/service/v2/app_driver/chat_data.py @@ -1,12 +1,14 @@ import json +from app.config.config import settings # from Log import logger from app.service.v2.app_driver.chat_base import ChatBase +from app.utils.rsa_crypto import RagflowCrypto class ChatBaseApply(ChatBase): - async def chat_parameters(self, url, params, headers): + async def chat_get(self, url, params, headers): res = await self.http_get(url, params, headers) if res.status_code == 200: @@ -14,8 +16,37 @@ else: return {} + async def chat_ping(self, url, params, headers): + res = await self.http_get(url, params, headers) + return res.status_code + async def chat_post(self, url, data, headers): + + res = await self.http_post(url, data, headers) + if res.status_code == 200: + return res.json() + else: + return {} + + async def chat_login(self, url, data, headers): + + res = await self.http_post(url, data, headers) + if res.status_code == 200: + res_json = res.json() + authorization = res.headers.get('Authorization') + if authorization: + res_json["data"]["access_token"] = authorization + return res_json + else: + return {} + + + @staticmethod + async def password_encrypt(password): + password = RagflowCrypto(settings.PUBLIC_KEY, settings.PRIVATE_KEY).encrypt(password) + return password + -- Gitblit v1.8.0