优化chat页面
This commit is contained in:
parent
411c515a13
commit
30cc704c0f
@ -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)
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user