feat: 单智能体模式下加载用户所有知识库
- get_bot_settings 接口中,单智能体模式时加载用户的所有知识库 - 不再从 settings_json 读取 dataset_ids 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
1d82ca9ba8
commit
7cb2c9c5ca
@ -1508,12 +1508,24 @@ async def get_bot_settings(bot_uuid: str, authorization: Optional[str] = Header(
|
||||
api_key=None
|
||||
)
|
||||
|
||||
# 处理 dataset_ids:将字符串转换为数组
|
||||
dataset_ids = settings.get('dataset_ids')
|
||||
if dataset_ids and isinstance(dataset_ids, str):
|
||||
dataset_ids = [id.strip() for id in dataset_ids.split(',') if id.strip()]
|
||||
elif not dataset_ids:
|
||||
dataset_ids = None
|
||||
# 处理 dataset_ids
|
||||
# 单智能体模式:加载用户的所有知识库
|
||||
# 普通模式:从 settings 读取
|
||||
if SINGLE_AGENT_MODE:
|
||||
await cursor.execute("""
|
||||
SELECT dataset_id
|
||||
FROM user_datasets
|
||||
WHERE user_id = %s
|
||||
ORDER BY created_at DESC
|
||||
""", (user_id,))
|
||||
user_datasets = await cursor.fetchall()
|
||||
dataset_ids = [row[0] for row in user_datasets] if user_datasets else []
|
||||
else:
|
||||
dataset_ids = settings.get('dataset_ids')
|
||||
if dataset_ids and isinstance(dataset_ids, str):
|
||||
dataset_ids = [id.strip() for id in dataset_ids.split(',') if id.strip()]
|
||||
elif not dataset_ids:
|
||||
dataset_ids = None
|
||||
|
||||
return BotSettingsResponse(
|
||||
bot_id=str(bot_id),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user