| | |
| | | try: |
| | | data = json.loads(complete_response) |
| | | # data = json_data.get("data") |
| | | if "answer" not in data: # 信息过滤 |
| | | if "answer" not in data or isinstance(data["answer"], dict): # 信息过滤 |
| | | continue |
| | | else: # 正常输出 |
| | | answer = data.get("answer", "") |
| | |
| | | from typing import Union, Dict, List |
| | | from fastapi import HTTPException |
| | | from starlette import status |
| | | from watchdog.observers.fsevents2 import message |
| | | |
| | | # from Log import logger |
| | | from app.config.config import settings |
| | | from app.utils.rsa_crypto import RagflowCrypto |
| | | |
| | |
| | | async def chat(self, token: str, chat_id: str, message: str, upload_file_id: str, conversation_id: str): |
| | | |
| | | target_url = f"{self.base_url}/v1/chat-messages" |
| | | files = [] |
| | | if upload_file_id: |
| | | files = [ |
| | | { |
| | | "type": "image", |
| | | "transfer_method": "remote_url", |
| | | "url": "https://cloud.dify.ai/logo/logo-site.png", |
| | | "upload_file_id":"" |
| | | "transfer_method": "local_file", |
| | | "url": "", |
| | | "upload_file_id": upload_file_id |
| | | } |
| | | ] |
| | | if upload_file_id: |
| | | files[0]["transfer_method"] = "local_file" |
| | | files[0]["upload_file_id"] = upload_file_id |
| | | data = { |
| | | "inputs": {}, |
| | | "query": message, |
| | |
| | | ('da3451da89d911efb9490242ac190006', 3, '知识问答', 'RAGFLOW', 'knowledgeQA'), |
| | | ('e96eb7a589db11ef87d20242ac190006', 5, '智能问答', 'RAGFLOW', 'chat'), |
| | | ('basic_excel_talk', 6, '智能数据', 'BASIC', 'excelTalk'), |
| | | ('basic_question_talk', 7, '文档出卷', 'BASIC', 'questionTalk') |
| | | ('basic_question_talk', 7, '文档出卷', 'BASIC', 'questionTalk'), |
| | | ('9d75142a-66eb-4e23-b7d4-03efe4584915', 8, '小数绘图', 'DIFY', 'imageTalk') |
| | | ] |
| | | |
| | | for agent in initial_agents: |