Skip to content

Feature/model - #35

Merged
sjwauto123 merged 5 commits into
mainfrom
feature/model
Jul 28, 2026
Merged

Feature/model#35
sjwauto123 merged 5 commits into
mainfrom
feature/model

Conversation

@sjwauto123

Copy link
Copy Markdown
Collaborator

No description provided.

- users 表扩展:department/position/expertise/preferred_language/timezone 画像字段

- 新增 UserPreference Entity + Repository 接口与实现(用户偏好 CRUD + 按 user_id 唯一查询)

- 调整 UserRepository.UpdateProfile 支持画像字段局部更新,移除 role_template_id 关联

- 请求/响应 DTO:用户画像 5 字段 + 偏好 8 字段,移除角色模板请求响应结构
- UserService 依赖拆分:依赖 UserPreferenceService 接口,Remove RoleTemplateService 全链路引用

- UserPreferenceService 接口:GetByUserID/Upsert/ToDTO,默认偏好兜底+按 user_id 唯一约束

- profile 接口/实现分离:profile_interface.go 定义接口,profile_service.go 保留实现,符合分层规范

- 画像更新校验:部门/职位/擅长字段长度校验,偏好枚举值校验(answer_style/citation_style 取值范围)
- EnhancedContext 扩展 Profile/Preference 字段,移除 RoleTemplate 引用

- PromptBuilder 双模式一致:WithProfile/WithPreference,删除 WithRoleTemplate

- chat_service 上下文增强:CreateUserContext+BuildPromptBuilder 快/深度模式统一调用

- Prompt 内容调整:画像5字段+偏好3字段(answer_style/table_first/citation_style) 注入到 UserContext

- chat_mode 快速/深度模式构建Prompt均走 PromptBuilder,保证一致性,移除模板注入链路
- 用户模块 Controller:新增 GetProfile/UpdateProfile/GetPreference/UpsertPreference 4个接口

- 移除角色模板全部6条路由(/api/v1/users/role-templates* + set-default)

- Router 聚合 NewRouter:移除 roleTemplateSvc 参数,用户 Controller 构造函数同步减少传参

- 错误码 pkg/errors:用户画像/偏好错误码段调整至14xxx,避免与模型额度12xxx段冲突
- internal/agent:修正 ReAct 执行与请求类型,适配 PromptUserContext 新字段(移除 RoleTemplatePrompt)

- internal/app/app.go:移除 roleTemplateRepo/roleTemplateSvc 实例,NewUserService/NewChatService/NewRouter 各减一参

- 装配链路对齐:prefSvc 仅 1 个偏好服务,不再有模板服务,编译验证通过
@sjwauto123 sjwauto123 self-assigned this Jul 28, 2026
@sjwauto123
sjwauto123 merged commit e524621 into main Jul 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant