zhaoqingang
2024-11-25 0fdc313d69ace003366ab519714158343d178acc
dify
3个文件已修改
19 ■■■■■ 已修改文件
app/api/chat.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/service/difyService.py 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/task/fetch_agent.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/api/chat.py
@@ -326,7 +326,7 @@
                            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", "")
app/service/difyService.py
@@ -5,9 +5,6 @@
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
@@ -68,17 +65,16 @@
    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,
app/task/fetch_agent.py
@@ -116,7 +116,8 @@
            ('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: