| | |
| | | from fastapi.responses import JSONResponse |
| | | 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_IA_QUESTIONS, DOCUMENT_TO_REPORT_TITLE, DOCUMENT_TO_TITLE, DOCUMENT_TO_PAPER |
| | | from app.models.base_model import get_db |
| | | from app.models.public_api_model import DfToken, AppRegister |
| | | from app.models.public_api_model import DfToken |
| | | from app.service.v2.api_token import DfTokenDao |
| | | from app.service.v2.app_register import AppRegisterDao |
| | | from app.service.v2.initialize_data import dialog_menu_sync, create_menu_sync, user_update_app |
| | | from app.task.sync_resources import sync_knowledge, sync_dialog, sync_agent, sync_llm, sync_resource |
| | | |
| | |
| | | return Response(code=200, msg="successfully", data={}) |
| | | |
| | | |
| | | @public_api.post("/sync/app_register", response_model=Response) |
| | | async def sync_app_register(apr: AppRegister, db=Depends(get_db)): |
| | | app_dict = {RAGFLOW: apr.rg, BISHENG: apr.bs, DIFY: apr.df} |
| | | |
| | | try: |
| | | for app_id, status in app_dict.items(): |
| | | AppRegisterDao(db).update_and_insert_app(app_id, status) |
| | | except Exception as e: |
| | | logger.error(e) |
| | | return Response(code=500, msg="failed", data={}) |
| | | |
| | | return Response(code=200, msg="successfully", data={}) |
| | | # @public_api.post("/sync/app_register", response_model=Response) |
| | | # async def sync_app_register(apr: AppRegister, db=Depends(get_db)): |
| | | # app_dict = {RAGFLOW: apr.rg, BISHENG: apr.bs, DIFY: apr.df} |
| | | # |
| | | # try: |
| | | # for app_id, status in app_dict.items(): |
| | | # AppRegisterDao(db).update_and_insert_app(app_id, status) |
| | | # except Exception as e: |
| | | # logger.error(e) |
| | | # return Response(code=500, msg="failed", data={}) |
| | | # |
| | | # return Response(code=200, msg="successfully", data={}) |
| | | |
| | | |
| | | @public_api.get("/sync/resource", response_model=Response) |