tmp
zhaoqingang
2025-01-14 00fe58a94292a3b9921ce134542ee38d74cd9401
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