| | |
| | | |
| | | from app.api import Response, get_current_user, ResponseList |
| | | from app.config.config import settings |
| | | from app.config.const import DOCUMENT_TO_REPORT, 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) |
| | | if not token: |
| | | raise HTTPException(status_code=500, detail="获取token失败,document_to_report!") |
| | | result = [] |
| | |
| | | initial_agents = [ |
| | | # ('80ee430a-e396-48c4-a12c-7c7cdf5eda51', 1, '报告生成', 'DIFY', 'report'), |
| | | ('basic_excel_merge', 2, '报表合并', 'BASIC', 'excelMerge'), |
| | | ('bfd090d589d811efb3630242ac190006', 4, '文档智能', 'DIFY', 'documentIa'), |
| | | ('7638f00638a24c21a68ec6c49b304a35', 4, '文档智能', 'DIFY', 'documentIa'), |
| | | ('da3451da89d911efb9490242ac190006', 3, '知识问答', 'RAGFLOW', 'knowledgeQA'), |
| | | ('e96eb7a589db11ef87d20242ac190006', 5, '智能问答', 'RAGFLOW', 'chat'), |
| | | ('basic_excel_talk', 6, '智能数据', 'BASIC', 'excelTalk'), |
| | | ('basic_question_talk', 7, '出题组卷', 'BASIC', 'questionTalk'), |
| | | ('9d75142a-66eb-4e23-b7d4-03efe4584915', 8, '小数绘图', 'DIFY', 'imageTalk'), |
| | | ('basic_paper_talk', 8, '文档出卷', 'BASIC', 'paperTalk'), |
| | | ('basic_paper_talk', 9, '文档出卷', 'BASIC', 'paperTalk'), |
| | | ('basic_report_clean', 10, '文档报告', 'DIFY', 'reportWorkflow') |
| | | ] |
| | | |