feat(ai): 新增智能助手功能模块

feat(backend): 添加ChromaDB向量数据库支持
feat(backend): 实现智能体配置、知识库和文档管理
feat(backend): 重构WebSocket聊天服务为AgentService
feat(frontend): 实现完整的聊天界面组件
feat(frontend): 添加智能体配置、知识库和文档管理页面
fix(user): 修复用户导入时性别转换问题
style(import): 优化导入组件加载状态处理
This commit is contained in:
zhangtao
2026-02-09 01:22:48 +08:00
parent b4dcdfa1ab
commit 45dad1e256
34 changed files with 5803 additions and 1214 deletions
@@ -517,8 +517,8 @@ class UserService:
header_dict = {
"部门编号": "dept_id",
"用户名": "username",
"": "name",
"账号": "username",
"": "name",
"邮箱": "email",
"手机号": "mobile",
"性别": "gender",
@@ -564,7 +564,7 @@ class UserService:
try:
count = count + 1
# 数据转换
gender = 1 if row["gender"] == "" else (2 if row["gender"] == "" else 1)
gender = "1" if row["gender"] == "" else ("2" if row["gender"] == "" else "1")
status = "0" if row["status"] == "正常" else "1"
# 构建用户数据
@@ -595,8 +595,19 @@ class UserService:
else:
error_msgs.append(f"{count}行: 用户 {user_data['username']} 已存在")
else:
user_create_data = UserCreateSchema(**user_data)
await UserCRUD(auth).create(data=user_create_data)
user_create_schema = UserCreateSchema(**user_data)
user_create_data = user_create_schema.model_dump(
exclude_unset=True, exclude={"role_ids", "position_ids"}
)
new_user = await UserCRUD(auth).create(data=user_create_data)
if user_create_schema.role_ids and len(user_create_schema.role_ids) > 0:
await UserCRUD(auth).set_user_roles_crud(
user_ids=[new_user.id], role_ids=user_create_schema.role_ids
)
if user_create_schema.position_ids and len(user_create_schema.position_ids) > 0:
await UserCRUD(auth).set_user_positions_crud(
user_ids=[new_user.id], position_ids=user_create_schema.position_ids
)
success_count += 1
except Exception as e:
@@ -623,8 +634,8 @@ class UserService:
"""
header_list = [
"部门编号",
"用户名",
"",
"账号",
"",
"邮箱",
"手机号",
"性别",