Merge branch 'bot_manager' of https://git.aitravelmaster.com/zhuchaowe/qwen_agent into bot_manager
This commit is contained in:
commit
8a536741b7
@ -470,6 +470,7 @@ class BotSettingsResponse(BaseModel):
|
|||||||
tool_response: bool
|
tool_response: bool
|
||||||
skills: Optional[str]
|
skills: Optional[str]
|
||||||
is_published: bool = False # 是否发布到广场
|
is_published: bool = False # 是否发布到广场
|
||||||
|
is_owner: bool = True # 是否是所有者
|
||||||
copied_from: Optional[str] = None # 复制来源的bot id
|
copied_from: Optional[str] = None # 复制来源的bot id
|
||||||
updated_at: str
|
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 pool.connection() as conn:
|
||||||
async with conn.cursor() as cursor:
|
async with conn.cursor() as cursor:
|
||||||
await cursor.execute("""
|
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
|
FROM agent_bots
|
||||||
WHERE id = %s
|
WHERE id = %s
|
||||||
""", (bot_uuid,))
|
""", (bot_uuid,))
|
||||||
@ -1625,9 +1626,12 @@ async def get_bot_settings(bot_uuid: str, authorization: Optional[str] = Header(
|
|||||||
if not row:
|
if not row:
|
||||||
raise HTTPException(status_code=404, detail="Bot not found")
|
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 {}
|
settings = settings_json if settings_json else {}
|
||||||
|
|
||||||
|
# 判断当前用户是否是所有者(确保类型一致)
|
||||||
|
is_owner = (str(owner_id) == str(user_id))
|
||||||
|
|
||||||
# 获取关联的模型信息
|
# 获取关联的模型信息
|
||||||
model_info = None
|
model_info = None
|
||||||
model_id = settings.get('model_id')
|
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),
|
tool_response=settings.get('tool_response', False),
|
||||||
skills=settings.get('skills'),
|
skills=settings.get('skills'),
|
||||||
is_published=is_published if is_published else False,
|
is_published=is_published if is_published else False,
|
||||||
|
is_owner=is_owner,
|
||||||
copied_from=str(copied_from) if copied_from else None,
|
copied_from=str(copied_from) if copied_from else None,
|
||||||
updated_at=datetime_to_str(updated_at)
|
updated_at=datetime_to_str(updated_at)
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user