| | |
| | | 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)}") |
| | | |
| | | # 注册到ragflow |
| | | try: |
| | |
| | | |
| | | # 存储用户信息 |
| | | 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() |
| | |
| | | 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)}") |
| | | |
| | | # 登录到ragflow |
| | | try: |
| | |
| | | # 创建本地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, |
| | |
| | | import asyncio |
| | | import websockets |
| | | from sqlalchemy.orm import Session |
| | | from starlette.responses import PlainTextResponse |
| | | |
| | | from Log import logger |
| | | from app.api import get_current_user_websocket |
| | | from app.config.config import settings |
| | | from app.config.const import IMAGE_TO_TEXT, DOCUMENT_TO_REPORT, DOCUMENT_TO_CLEANING |
| | | from app.config.const import IMAGE_TO_TEXT, DOCUMENT_TO_REPORT, DOCUMENT_TO_CLEANING, DOCUMENT_TO_REPORT_TITLE, \ |
| | | DOCUMENT_TO_TITLE, DOCUMENT_IA_QUESTIONS |
| | | from app.models.agent_model import AgentModel, AgentType |
| | | from app.models.base_model import get_db |
| | | from app.models.user_model import UserModel |
| | |
| | | print(f"Client {agent_id} connected") |
| | | |
| | | agent = db.query(AgentModel).filter(AgentModel.id == agent_id).first() |
| | | print(agent_id) |
| | | if not agent: |
| | | ret = {"message": "Agent not found", "type": "close"} |
| | | await websocket.send_json(ret) |
| | | return |
| | | |
| | | agent_type = agent.agent_type |
| | | print(agent_type) |
| | | if chat_id == "" or chat_id == "0": |
| | | ret = {"message": "Chat ID not found", "type": "close"} |
| | | await websocket.send_json(ret) |
| | |
| | | except Exception as e: |
| | | logger.error(e) |
| | | # complete_response = "" |
| | | |
| | | files = [] |
| | | if upload_file_id: |
| | | files.append({ |
| | | "type": "image", |
| | | "transfer_method": "local_file", |
| | | "url": "", |
| | | "upload_file_id": upload_file_id |
| | | }) |
| | | answer_str = "" |
| | | async for rag_response in dify_service.chat(token, current_user.id, question, upload_file_id, |
| | | conversation_id): |
| | | async for rag_response in dify_service.chat(token, current_user.id, question, files, |
| | | conversation_id, {}): |
| | | # print(rag_response) |
| | | try: |
| | | if rag_response[:5] == "data:": |
| | |
| | | print(f"Received from client {chat_id}: {receive_message}") |
| | | upload_files = receive_message.get('upload_files', []) |
| | | title = receive_message.get('title', "") |
| | | sub_titles = receive_message.get('sub_titles', "") |
| | | workflow_type = receive_message.get('workflow', 1) |
| | | if not upload_files: |
| | | await websocket.send_json({"message": "Invalid request", "type": "error"}) |
| | | continue |
| | | title_number = receive_message.get('title_number', 8) |
| | | title_style = receive_message.get('title_style', "") |
| | | title_query = receive_message.get('title_query', "") |
| | | if upload_files: |
| | | title_query = "start" |
| | | # if not upload_files: |
| | | # await websocket.send_json({"message": "Invalid request", "type": "error"}) |
| | | # continue |
| | | try: |
| | | session = SessionService(db).create_session( |
| | | chat_id, |
| | | title, |
| | | title if title else title_query, |
| | | agent_id, |
| | | AgentType.DIFY, |
| | | current_user.id |
| | |
| | | }) |
| | | if workflow_type == 1: |
| | | inputs["input_files"] = files |
| | | if workflow_type == 2: |
| | | elif workflow_type == 2: |
| | | inputs["file_list"] = files |
| | | inputs["Completion_of_main_indicators"] = title |
| | | token = DfTokenDao(db).get_token_by_id(DOCUMENT_TO_REPORT) |
| | | inputs["sub_titles"] = sub_titles |
| | | token = DfTokenDao(db).get_token_by_id(DOCUMENT_TO_REPORT_TITLE) |
| | | if not token: |
| | | await websocket.send_json( |
| | | {"message": "Invalid token document_to_cleaning", "type": "error"}) |
| | | {"message": "Invalid token document_to_report", "type": "error"}) |
| | | elif workflow_type == 3: |
| | | inputs["file_list"] = files |
| | | inputs["number_of_title"] = title_number |
| | | inputs["title_style"] = title_style |
| | | token = DfTokenDao(db).get_token_by_id(DOCUMENT_TO_TITLE) |
| | | if not token: |
| | | await websocket.send_json( |
| | | {"message": "Invalid token document_to_title", "type": "error"}) |
| | | |
| | | complete_response = "" |
| | | async for rag_response in dify_service.workflow(token, current_user.id, inputs): |
| | | if workflow_type == 1 or workflow_type == 2: |
| | | async for rag_response in dify_service.workflow(token, current_user.id, inputs): |
| | | # print(rag_response) |
| | | try: |
| | | if rag_response[:5] == "data:": |
| | | # 如果是,则截取掉前5个字符,并去除首尾空白符 |
| | | complete_response = rag_response[5:].strip() |
| | | elif "event: ping" in rag_response: |
| | | continue |
| | | else: |
| | | # 否则,保持原样 |
| | | complete_response += rag_response |
| | | try: |
| | | data = json.loads(complete_response) |
| | | complete_response = "" |
| | | if data.get("event") == "node_started" or data.get("event") == "node_finished": # "event": "message_end" |
| | | if "data" not in data or not data["data"]: # 信息过滤 |
| | | logger.error("非法数据--------------------") |
| | | logger.error(data) |
| | | continue |
| | | else: # 正常输出 |
| | | answer = data.get("data", "") |
| | | if isinstance(answer, str): |
| | | logger.error("----------------未知数据--------------------") |
| | | logger.error(data) |
| | | continue |
| | | elif isinstance(answer, dict): |
| | | |
| | | message = answer.get("title", "") |
| | | |
| | | result = {"message": message, "type": "system"} |
| | | elif data.get("event") == "workflow_finished": |
| | | answer = data.get("data", "") |
| | | if isinstance(answer, str): |
| | | logger.error("----------------未知数据--------------------") |
| | | logger.error(data) |
| | | result = {"message": "", "type": "close", "download_url": ""} |
| | | elif isinstance(answer, dict): |
| | | download_url = "" |
| | | outputs = answer.get("outputs", {}) |
| | | if outputs: |
| | | message = outputs.get("output", "") |
| | | download_url = outputs.get("download_url", "") |
| | | else: |
| | | message = answer.get("error", "") |
| | | |
| | | result = {"message": message, "type": "message", "download_url": download_url} |
| | | try: |
| | | SessionService(db).update_session(chat_id, |
| | | message={"role": "assistant", |
| | | "content": { |
| | | "answer": message, |
| | | "download_url": download_url}}, |
| | | conversation_id=data.get( |
| | | "conversation_id")) |
| | | except Exception as e: |
| | | logger.error("保存dify的会话异常!") |
| | | logger.error(e) |
| | | try: |
| | | await websocket.send_json(result) |
| | | except Exception as e: |
| | | logger.error(e) |
| | | logger.error("返回客户端消息异常!") |
| | | result = {"message": "", "type": "close", "download_url": ""} |
| | | |
| | | |
| | | else: |
| | | continue |
| | | try: |
| | | await websocket.send_json(result) |
| | | except Exception as e: |
| | | logger.error(e) |
| | | logger.error("返回客户端消息异常!") |
| | | complete_response = "" |
| | | except json.JSONDecodeError as e: |
| | | print(f"Error decoding JSON: {e}") |
| | | # print(f"Response text: {text}") |
| | | except Exception as e2: |
| | | result = {"message": f"内部错误: {e2}", "type": "close"} |
| | | await websocket.send_json(result) |
| | | print(f"Error process message of ragflow: {e2}") |
| | | elif workflow_type == 3: |
| | | image_list = [] |
| | | # print(inputs) |
| | | complete_response = "" |
| | | async for rag_response in dify_service.chat(token, current_user.id, title_query, [], |
| | | conversation_id, inputs): |
| | | print(rag_response) |
| | | try: |
| | | if rag_response[:5] == "data:": |
| | | # 如果是,则截取掉前5个字符,并去除首尾空白符 |
| | | complete_response = rag_response[5:].strip() |
| | | elif "event: ping" in rag_response: |
| | | continue |
| | | else: |
| | | # 否则,保持原样 |
| | | complete_response += rag_response |
| | | try: |
| | | data = json.loads(complete_response) |
| | | complete_response = "" |
| | | if data.get("event") == "node_started" or data.get( |
| | | "event") == "node_finished": # "event": "message_end" |
| | | if "data" not in data or not data["data"]: # 信息过滤 |
| | | logger.error("非法数据--------------------") |
| | | logger.error(data) |
| | | continue |
| | | else: # 正常输出 |
| | | answer = data.get("data", "") |
| | | if isinstance(answer, str): |
| | | logger.error("----------------未知数据--------------------") |
| | | logger.error(data) |
| | | continue |
| | | elif isinstance(answer, dict): |
| | | |
| | | message = answer.get("title", "") |
| | | |
| | | result = {"message": message, "type": "system"} |
| | | elif data.get("event") == "message": |
| | | message = data.get("answer", "") |
| | | # try: |
| | | # msg_dict = json.loads(answer) |
| | | # message = msg_dict.get("output", "") |
| | | # except Exception as e: |
| | | # print(e) |
| | | # continue |
| | | result = {"message": message, "type": "message", |
| | | "download_url": ""} |
| | | try: |
| | | SessionService(db).update_session(chat_id, |
| | | message={"role": "assistant", |
| | | "content": { |
| | | "answer": message, |
| | | "download_url": ""}}, |
| | | conversation_id=data.get( |
| | | "conversation_id")) |
| | | except Exception as e: |
| | | logger.error("保存dify的会话异常!") |
| | | logger.error(e) |
| | | # try: |
| | | # await websocket.send_json(result) |
| | | # except Exception as e: |
| | | # logger.error(e) |
| | | # logger.error("返回客户端消息异常!") |
| | | |
| | | elif data.get("event") == "message_end": |
| | | result = {"message": "", "type": "close", "download_url": ""} |
| | | else: |
| | | continue |
| | | try: |
| | | await websocket.send_json(result) |
| | | except Exception as e: |
| | | logger.error(e) |
| | | logger.error("dify返回客户端消息异常!") |
| | | complete_response = "" |
| | | except json.JSONDecodeError as e: |
| | | print(f"Error decoding JSON: {e}") |
| | | # print(f"Response text: {text}") |
| | | except Exception as e2: |
| | | result = {"message": f"内部错误: {e2}", "type": "close"} |
| | | await websocket.send_json(result) |
| | | print(f"Error process message of ragflow: {e2}") |
| | | elif agent.type == "documentIa": |
| | | print(122112) |
| | | token = DfTokenDao(db).get_token_by_id(DOCUMENT_IA_QUESTIONS) |
| | | # print(token) |
| | | if not token: |
| | | await websocket.send_json({"message": "Invalid token", "type": "error"}) |
| | | |
| | | while True: |
| | | conversation_id = "" |
| | | # print(4343) |
| | | receive_message = await websocket.receive_json() |
| | | print(f"Received from client {chat_id}: {receive_message}") |
| | | upload_file_id = receive_message.get('upload_file_id', []) |
| | | question = receive_message.get('message', "") |
| | | if not question and not image_url: |
| | | await websocket.send_json({"message": "Invalid request", "type": "error"}) |
| | | continue |
| | | try: |
| | | session = SessionService(db).create_session( |
| | | chat_id, |
| | | question, |
| | | agent_id, |
| | | AgentType.DIFY, |
| | | current_user.id |
| | | ) |
| | | conversation_id = session.conversation_id |
| | | except Exception as e: |
| | | logger.error(e) |
| | | # complete_response = "" |
| | | files = [] |
| | | for fileId in upload_file_id: |
| | | files.append({ |
| | | "type": "document", |
| | | "transfer_method": "local_file", |
| | | "url": "", |
| | | "upload_file_id": fileId |
| | | }) |
| | | |
| | | answer_str = "" |
| | | complete_response = "" |
| | | async for rag_response in dify_service.chat(token, current_user.id, question, files, |
| | | conversation_id, {}): |
| | | # print(rag_response) |
| | | try: |
| | | if rag_response[:5] == "data:": |
| | |
| | | complete_response += rag_response |
| | | try: |
| | | data = json.loads(complete_response) |
| | | complete_response = "" |
| | | if data.get("event") == "node_started" or data.get("event") == "node_finished": # "event": "message_end" |
| | | if data.get("event") == "node_started" or data.get( |
| | | "event") == "node_finished": # "event": "message_end" |
| | | if "data" not in data or not data["data"]: # 信息过滤 |
| | | logger.error("非法数据--------------------") |
| | | logger.error(data) |
| | |
| | | message = answer.get("title", "") |
| | | |
| | | result = {"message": message, "type": "system"} |
| | | continue |
| | | elif data.get("event") == "message": # "event": "message_end" |
| | | # 正常输出 |
| | | answer = data.get("answer", "") |
| | | result = {"message": answer, "type": "stream"} |
| | | elif data.get("event") == "workflow_finished": |
| | | answer = data.get("data", "") |
| | | if isinstance(answer, str): |
| | |
| | | download_url = "" |
| | | outputs = answer.get("outputs", {}) |
| | | if outputs: |
| | | message = outputs.get("output", "") |
| | | download_url = outputs.get("download_url", "") |
| | | message = outputs.get("answer", "") |
| | | # download_url = outputs.get("download_url", "") |
| | | else: |
| | | message = answer.get("error", "") |
| | | |
| | | result = {"message": message, "type": "message", "download_url": download_url} |
| | | # result = {"message": message, "type": "message", |
| | | # "download_url": download_url} |
| | | try: |
| | | SessionService(db).update_session(chat_id, |
| | | message={"role": "assistant", |
| | |
| | | except Exception as e: |
| | | logger.error("保存dify的会话异常!") |
| | | logger.error(e) |
| | | await websocket.send_json(result) |
| | | result = {"message": "", "type": "close", "download_url": ""} |
| | | |
| | | # await websocket.send_json(result) |
| | | continue |
| | | elif data.get("event") == "message_end": |
| | | result = {"message": "", "type": "close"} |
| | | |
| | | else: |
| | | continue |
| | | try: |
| | | await websocket.send_json(result) |
| | | except Exception as e: |
| | | except Exception as e: |
| | | logger.error(e) |
| | | logger.error("返回客户端消息异常!") |
| | | complete_response = "" |
| | |
| | | |
| | | from app.api import Response, get_current_user, ResponseList |
| | | from app.config.config import settings |
| | | from app.config.const import DOCUMENT_TO_REPORT_TITLE, IMAGE_TO_TEXT |
| | | from app.models.agent_model import AgentType, AgentModel |
| | | from app.models.base_model import get_db |
| | | from app.models.user_model import UserModel |
| | |
| | | elif agent.agent_type == AgentType.DIFY: |
| | | dify_service = DifyService(base_url=settings.dify_base_url) |
| | | if agent.type == "imageTalk": |
| | | token = DfTokenDao(db).get_token_by_id("image_and_text_conversion") |
| | | token = DfTokenDao(db).get_token_by_id(IMAGE_TO_TEXT) |
| | | if not token: |
| | | raise HTTPException(status_code=500, detail="获取token失败,image_and_text_conversion!") |
| | | file = file[0] |
| | |
| | | data = await dify_service.upload(token, file.filename, file_content, current_user.id) |
| | | except Exception as e: |
| | | raise HTTPException(status_code=500, detail=str(e)) |
| | | elif agent.type == "reportWorkflow": |
| | | token = DfTokenDao(db).get_token_by_id("document_to_report") |
| | | elif agent.type == "reportWorkflow" or agent.type == "documentIa": |
| | | token = DfTokenDao(db).get_token_by_id(DOCUMENT_TO_REPORT_TITLE) |
| | | if not token: |
| | | raise HTTPException(status_code=500, detail="获取token失败,document_to_report!") |
| | | result = [] |
| | |
| | | from Log import logger |
| | | from app.api import Response |
| | | from app.api.auth import login |
| | | from app.config.const import IMAGE_TO_TEXT, DOCUMENT_TO_CLEANING, DOCUMENT_TO_REPORT, DIFY, BISHENG, RAGFLOW |
| | | from app.config.const import IMAGE_TO_TEXT, DOCUMENT_TO_CLEANING, DOCUMENT_TO_REPORT, DIFY, BISHENG, RAGFLOW, \ |
| | | DOCUMENT_IA_QUESTIONS, DOCUMENT_TO_TITLE, DOCUMENT_TO_REPORT_TITLE |
| | | from app.models.base_model import get_db |
| | | from app.models.public_api_model import DfToken, AppRegister |
| | | from app.service.common.api_token import DfTokenDao |
| | |
| | | |
| | | @public_api.post("/sync/df_token", response_model=Response) |
| | | async def sync_df_token(df: DfToken, db=Depends(get_db)): |
| | | token_dict = {IMAGE_TO_TEXT: df.image, DOCUMENT_TO_CLEANING: df.clean, DOCUMENT_TO_REPORT: df.report} |
| | | token_dict = {IMAGE_TO_TEXT: df.image, DOCUMENT_TO_CLEANING: df.clean, DOCUMENT_TO_REPORT: df.report, DOCUMENT_TO_REPORT_TITLE: df.reoprt_title, DOCUMENT_TO_TITLE: df.title, DOCUMENT_IA_QUESTIONS: df.question} |
| | | |
| | | try: |
| | | for api_id, token in token_dict.items(): |
| | |
| | | kwargs['fwr_base_url'] = kwargs.get('fwr_base_url', '').replace('127.0.0.1', host_ip) |
| | | kwargs['sgb_db_url'] = kwargs.get('sgb_db_url', '').replace('127.0.0.1', host_ip) |
| | | kwargs['fwr_db_url'] = kwargs.get('fwr_db_url', '').replace('127.0.0.1', host_ip) |
| | | kwargs['dify_base_url'] = kwargs.get('dify_base_url', '').replace('127.0.0.1', host_ip) |
| | | # kwargs['dify_base_url'] = kwargs.get('dify_base_url', '').replace('127.0.0.1', host_ip) |
| | | kwargs['basic_base_url'] = kwargs.get('basic_base_url', '').replace('127.0.0.1', host_ip) |
| | | # Check if all required fields are provided and set them |
| | | for field in self.__annotations__.keys(): |
| | |
| | | secret_key: your-secret-key |
| | | secret_key: Dt05gJnaqpT3Lx1iyWPrEolCKeXMbIcOSm28 |
| | | sgb_base_url: http://192.168.20.119:13001 |
| | | sgb_websocket_url: ws://192.168.20.119:13001 |
| | | fwr_base_url: http://192.168.20.119:11080 |
| | | database_url: mysql+pymysql://root:infini_rag_flow@192.168.20.119:5455/199c90c51171 |
| | | database_url: mysql+pymysql://root:rag_gateway@192.168.20.119:3308/rag_gateway |
| | | #database_url: mysql+pymysql://root:infini_rag_flow@192.168.20.119:5455/199c90c51171 |
| | | sgb_db_url: mysql+pymysql://root:1234@192.168.20.119:13306/bisheng |
| | | fwr_db_url: mysql+pymysql://root:infini_rag_flow@192.168.20.119:15455/rag_flow |
| | | PUBLIC_KEY: | |
| | |
| | | DOCUMENT_TO_CLEANING = "document_to_cleaning" |
| | | DOCUMENT_TO_REPORT = "document_to_report" |
| | | IMAGE_TO_TEXT = "image_and_text_conversion" |
| | | |
| | | DOCUMENT_TO_REPORT_TITLE = "document_to_report_title" |
| | | DOCUMENT_TO_TITLE = "document_to_title" |
| | | DOCUMENT_IA_QUESTIONS = "document_ia_questions" |
| | | |
| | | ### -----------app register -------------- |
| | | RAGFLOW = "ragflow_app" |
| | |
| | | image: Optional[str] = "" |
| | | clean: Optional[str] = "" |
| | | report: Optional[str] = "" |
| | | reoprt_title: Optional[str] = "" |
| | | title: Optional[str] = "" |
| | | question: Optional[str] = "" |
| | | |
| | | |
| | | class AppRegister(BaseModel): |
| | |
| | | # 参数验证 |
| | | if not isinstance(user_id, int) or user_id <= 0: |
| | | return |
| | | if not access_token or not bisheng_token or not ragflow_token: |
| | | return |
| | | # if not access_token or not bisheng_token or not ragflow_token: |
| | | # return |
| | | db_token = None |
| | | try: |
| | | # 查询现有记录 |
| | |
| | | raise Exception("Authorization header not found in response") |
| | | return authorization |
| | | |
| | | async def chat(self, token: str, user_id: int, message: str, upload_file_id: str, conversation_id: str): |
| | | async def chat(self, token: str, user_id: int, message: str, files: list, conversation_id: str, inputs:dict): |
| | | |
| | | target_url = f"{self.base_url}/v1/chat-messages" |
| | | files = [] |
| | | if upload_file_id: |
| | | files = [ |
| | | { |
| | | "type": "image", |
| | | "transfer_method": "local_file", |
| | | "url": "", |
| | | "upload_file_id": upload_file_id |
| | | } |
| | | ] |
| | | data = { |
| | | "inputs": {}, |
| | | "inputs": inputs, |
| | | "query": message, |
| | | "response_mode": "streaming", |
| | | "conversation_id": conversation_id, |
| | | "user": str(user_id), |
| | | "files": files |
| | | } |
| | | |
| | | # if parent_message_id: |
| | | # data["parent_message_id"] = parent_message_id |
| | | # print("----------------------------------------------") |
| | | # print(data) |
| | | # print("-----------------------------------------------") |
| | | async with httpx.AsyncClient(timeout=300.0) as client: |
| | | headers = { |
| | | 'Content-Type': 'application/json', |
| | |
| | | db.commit() # 提交事务 |
| | | |
| | | initial_agents = [ |
| | | ('80ee430a-e396-48c4-a12c-7c7cdf5eda51', 1, '报告生成', 'BISHENG', 'report'), |
| | | # ('80ee430a-e396-48c4-a12c-7c7cdf5eda51', 1, '报告生成', 'BISHENG', 'report'), |
| | | ('basic_excel_merge', 2, '报表合并', 'BASIC', 'excelMerge'), |
| | | ('bfd090d589d811efb3630242ac190006', 4, '文档智能', 'BISHENG', 'report'), |
| | | ('7638f006-38a2-4c21-a68e-c6c49b304a35', 4, '文档智能', 'DIFY', 'documentIa'), |
| | | ('da3451da89d911efb9490242ac190006', 3, '知识问答', 'RAGFLOW', 'knowledgeQA'), |
| | | ('e96eb7a589db11ef87d20242ac190006', 5, '智能问答', 'RAGFLOW', 'chat'), |
| | | ('basic_report_clean', 6, '文档报告', 'DIFY', 'reportWorkflow') |
| | | ('basic_report_clean', 6, '报告生成', 'DIFY', 'reportWorkflow'), |
| | | # ('basic_excel_talk', 6, '智能数据', 'BASIC', 'excelTalk'), |
| | | # ('basic_question_talk', 7, '出题组卷', 'BASIC', 'questionTalk'), |
| | | # ('9d75142a-66eb-4e23-b7d4-03efe4584915', 8, '小数绘图', 'DIFY', 'imageTalk'), |
| | |
| | | |
| | | def sync_agents(): |
| | | try: |
| | | bisheng_data = get_data_from_bisheng(BISHENG_NAMES_TO_SYNC) |
| | | # bisheng_data = get_data_from_bisheng(BISHENG_NAMES_TO_SYNC) |
| | | ragflow_data = get_data_from_ragflow(RAGFLOW_NAMES_TO_SYNC) |
| | | |
| | | update_ids_in_local(bisheng_data) |
| | | # update_ids_in_local(bisheng_data) |
| | | update_ids_in_local(ragflow_data) |
| | | |
| | | print("Agents synchronized successfully") |