| | |
| | | chat_info = db.query(DialogModel).filter_by(id=chat_id).first() |
| | | if not chat_info: |
| | | return {} |
| | | if chat_info.dialog_type == RG_TYPE: |
| | | return {"retriever_resource": |
| | | { |
| | | "enabled": True |
| | | } |
| | | } |
| | | elif chat_info.dialog_type == BASIC_TYPE: |
| | | ... |
| | | elif chat_info.dialog_type == DF_TYPE: |
| | | token = await get_chat_token(db, chat_id) |
| | | if not token: |
| | | return {} |
| | | url = settings.dify_base_url + DF_CHAT_PARAMETERS |
| | | chat = ChatBaseApply() |
| | | return await chat.chat_get(url, {"user": str(user_id)}, await chat.get_headers(token)) |
| | | return chat_info.parameters |
| | | # if chat_info.dialog_type == RG_TYPE: |
| | | # return {"retriever_resource": |
| | | # { |
| | | # "enabled": True |
| | | # } |
| | | # } |
| | | # elif chat_info.dialog_type == BASIC_TYPE: |
| | | # ... |
| | | # elif chat_info.dialog_type == DF_TYPE: |
| | | # token = await get_chat_token(db, chat_id) |
| | | # if not token: |
| | | # return {} |
| | | # url = settings.dify_base_url + DF_CHAT_PARAMETERS |
| | | # chat = ChatBaseApply() |
| | | # return await chat.chat_get(url, {"user": str(user_id)}, await chat.get_headers(token)) |
| | | |
| | | |
| | | async def service_chat_sessions(db, chat_id, name): |