mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 23:41:12 +08:00
Refactor: completion -> completions (#14584)
### What problem does this PR solve? Keep only /completions, deprecated /completion ### Type of change - [x] Refactoring
This commit is contained in:
@@ -403,14 +403,14 @@ async def deprecated_file_upload_info():
|
||||
@add_tenant_id_to_kwargs
|
||||
async def deprecated_agent_completions(agent_id, tenant_id=None):
|
||||
"""
|
||||
Deprecated: Use POST /api/v1/agents/chat/completion instead.
|
||||
Deprecated: Use POST /api/v1/agents/chat/completions instead.
|
||||
|
||||
Old path: POST /api/v1/agents/{agent_id}/completions
|
||||
New path: POST /api/v1/agents/chat/completion
|
||||
New path: POST /api/v1/agents/chat/completions
|
||||
"""
|
||||
logging.warning(
|
||||
"API endpoint /api/v1/agents/%s/completions is deprecated. "
|
||||
"Please use /api/v1/agents/chat/completion instead.",
|
||||
"Please use /api/v1/agents/chat/completions instead.",
|
||||
agent_id,
|
||||
)
|
||||
return await agent_api.agent_chat_completion(tenant_id=tenant_id, agent_id=agent_id)
|
||||
|
||||
@@ -846,6 +846,7 @@ async def test_db_connection():
|
||||
|
||||
|
||||
@manager.route("/agents/chat/completion", methods=["POST"]) # noqa: F821
|
||||
@manager.route("/agents/chat/completions", methods=["POST"]) # noqa: F821
|
||||
@login_required
|
||||
@add_tenant_id_to_kwargs
|
||||
async def agent_chat_completion(tenant_id, agent_id=None):
|
||||
|
||||
@@ -174,6 +174,7 @@ def delete_search(search_id):
|
||||
|
||||
|
||||
@manager.route("/searches/<search_id>/completion", methods=["POST"]) # noqa: F821
|
||||
@manager.route("/searches/<search_id>/completions", methods=["POST"]) # noqa: F821
|
||||
@login_required
|
||||
@validate_request("question")
|
||||
async def completion(search_id):
|
||||
|
||||
@@ -160,7 +160,7 @@ class CanvasReplicaService:
|
||||
|
||||
@classmethod
|
||||
def load_for_run(cls, canvas_id: str, tenant_id: str, runtime_user_id: str):
|
||||
"""Load current runtime replica used by /completion."""
|
||||
"""Load current runtime replica used by /completions."""
|
||||
replica_key = cls._replica_key(canvas_id, str(tenant_id), str(runtime_user_id))
|
||||
return cls._read_payload(replica_key)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user