mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 12:49:03 +08:00
Fix open AI compatible rerank issue. (#3866)
### What problem does this PR solve? #3700 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
84afb4259c
commit
78601ee1bd
@ -375,10 +375,9 @@ def agent_completion(tenant_id, agent_id):
|
|||||||
return get_result(data=result)
|
return get_result(data=result)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@manager.route('/chats/<chat_id>/sessions', methods=['GET'])
|
@manager.route('/chats/<chat_id>/sessions', methods=['GET'])
|
||||||
@token_required
|
@token_required
|
||||||
def list_session(chat_id,tenant_id):
|
def list_session(tenant_id, chat_id):
|
||||||
if not DialogService.query(tenant_id=tenant_id, id=chat_id, status=StatusEnum.VALID.value):
|
if not DialogService.query(tenant_id=tenant_id, id=chat_id, status=StatusEnum.VALID.value):
|
||||||
return get_error_data_result(message=f"You don't own the assistant {chat_id}.")
|
return get_error_data_result(message=f"You don't own the assistant {chat_id}.")
|
||||||
id = request.args.get("id")
|
id = request.args.get("id")
|
||||||
@ -429,9 +428,10 @@ def list_session(chat_id,tenant_id):
|
|||||||
del conv["reference"]
|
del conv["reference"]
|
||||||
return get_result(data=convs)
|
return get_result(data=convs)
|
||||||
|
|
||||||
|
|
||||||
@manager.route('/agents/<agent_id>/sessions', methods=['GET'])
|
@manager.route('/agents/<agent_id>/sessions', methods=['GET'])
|
||||||
@token_required
|
@token_required
|
||||||
def list_agent_session(agent_id,tenant_id):
|
def list_agent_session(tenant_id, agent_id):
|
||||||
if not UserCanvasService.query(user_id=tenant_id, id=agent_id):
|
if not UserCanvasService.query(user_id=tenant_id, id=agent_id):
|
||||||
return get_error_data_result(message=f"You don't own the agent {agent_id}.")
|
return get_error_data_result(message=f"You don't own the agent {agent_id}.")
|
||||||
id = request.args.get("id")
|
id = request.args.get("id")
|
||||||
@ -509,6 +509,7 @@ def delete(tenant_id,chat_id):
|
|||||||
ConversationService.delete_by_id(id)
|
ConversationService.delete_by_id(id)
|
||||||
return get_result()
|
return get_result()
|
||||||
|
|
||||||
|
|
||||||
@manager.route('/sessions/ask', methods=['POST'])
|
@manager.route('/sessions/ask', methods=['POST'])
|
||||||
@token_required
|
@token_required
|
||||||
def ask_about(tenant_id):
|
def ask_about(tenant_id):
|
||||||
@ -528,6 +529,7 @@ def ask_about(tenant_id):
|
|||||||
if kb.chunk_num == 0:
|
if kb.chunk_num == 0:
|
||||||
return get_error_data_result(f"The dataset {kb_id} doesn't own parsed file")
|
return get_error_data_result(f"The dataset {kb_id} doesn't own parsed file")
|
||||||
uid = tenant_id
|
uid = tenant_id
|
||||||
|
|
||||||
def stream():
|
def stream():
|
||||||
nonlocal req, uid
|
nonlocal req, uid
|
||||||
try:
|
try:
|
||||||
|
@ -286,7 +286,7 @@ class OpenAI_APIRerank(Base):
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": f"Bearer {key}"
|
"Authorization": f"Bearer {key}"
|
||||||
}
|
}
|
||||||
self.model_name = model_name
|
self.model_name = model_name.split("___")[0]
|
||||||
|
|
||||||
def similarity(self, query: str, texts: list):
|
def similarity(self, query: str, texts: list):
|
||||||
# noway to config Ragflow , use fix setting
|
# noway to config Ragflow , use fix setting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user