From 30cc704c0fe5d71d608c2f3f0adbde9c85044707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=BD=AE?= Date: Mon, 23 Feb 2026 20:48:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96chat=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/bot_manager.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/routes/bot_manager.py b/routes/bot_manager.py index 82b1af9..a3096de 100644 --- a/routes/bot_manager.py +++ b/routes/bot_manager.py @@ -470,6 +470,7 @@ class BotSettingsResponse(BaseModel): tool_response: bool skills: Optional[str] is_published: bool = False # 是否发布到广场 + is_owner: bool = True # 是否是所有者 copied_from: Optional[str] = None # 复制来源的bot id updated_at: str @@ -1616,7 +1617,7 @@ async def get_bot_settings(bot_uuid: str, authorization: Optional[str] = Header( async with pool.connection() as conn: async with conn.cursor() as cursor: await cursor.execute(""" - SELECT id, name, settings, updated_at, is_published, copied_from + SELECT id, name, settings, updated_at, is_published, copied_from, owner_id FROM agent_bots WHERE id = %s """, (bot_uuid,)) @@ -1625,9 +1626,12 @@ async def get_bot_settings(bot_uuid: str, authorization: Optional[str] = Header( if not row: raise HTTPException(status_code=404, detail="Bot not found") - bot_id, bot_name, settings_json, updated_at, is_published, copied_from = row + bot_id, bot_name, settings_json, updated_at, is_published, copied_from, owner_id = row settings = settings_json if settings_json else {} + # 判断当前用户是否是所有者(确保类型一致) + is_owner = (str(owner_id) == str(user_id)) + # 获取关联的模型信息 model_info = None model_id = settings.get('model_id') @@ -1670,6 +1674,7 @@ async def get_bot_settings(bot_uuid: str, authorization: Optional[str] = Header( tool_response=settings.get('tool_response', False), skills=settings.get('skills'), is_published=is_published if is_published else False, + is_owner=is_owner, copied_from=str(copied_from) if copied_from else None, updated_at=datetime_to_str(updated_at) )