mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-15 12:13:38 +00:00
Let people name accounts and use the names to tell accounts apart
Connections get an account_name (migration 0039) that the owner sets with PATCH /api/connections/<id>; the account label stays the account's identity, so signing in again still finds it. When someone has more than one account of a service, its tools are listed as "Telegram · <account>" and the model sees each account's actions under the account's name (telegram_send_message_alerts_bot) with the account in the description, instead of _1 and _2. Actions shared by different services are named after the service. Tools a user renamed keep their name.
This commit is contained in:
1 parent
607c2296e3
commit
bdcb88866a
11 files changed
+371
-7
No files matched your search
@@ -161,6 +161,21 @@ class ConnectionDetail(Resource):
|
||||
return make_response(jsonify({"success": False, "error": "Failed to load connection"}), 500)
|
||||
return make_response(jsonify({"success": True, "connection": detail}), 200)
|
||||
|
||||
@api.doc(description="Name an account: {name}. An empty name clears it. Owner only.")
|
||||
def patch(self, connection_id: str):
|
||||
user_id = _user_id()
|
||||
if not user_id:
|
||||
return _unauthorized()
|
||||
name = _json_body().get("name")
|
||||
if not isinstance(name, str) or len(name.strip()) > service.ACCOUNT_NAME_MAX:
|
||||
return _error(f"name must be text of at most {service.ACCOUNT_NAME_MAX} characters", 400)
|
||||
with db_session() as conn:
|
||||
row = _owned(conn, connection_id, user_id)
|
||||
if row is None:
|
||||
return _not_found()
|
||||
connection = service.rename_connection(conn, row, name)
|
||||
return make_response(jsonify({"success": True, "connection": connection}), 200)
|
||||
|
||||
@api.doc(
|
||||
description=(
|
||||
"Remove a connection: {sources: keep | delete, tools: delete | keep}. "
|
||||
|
||||
Reference in new issue
Block a user