Commit Graph

174 Commits

Author SHA1 Message Date
LiangShiyong daa53289af feat: 1. 添加企查查的按钮。新增相关组件和对接接口进行显示。
2. 为51707端口添加只存在交叉评查入口的项目启动配置。入口页添加相关的区分。
3. 完善文档列表的权限功能控制。
4. 隐藏系统概览中高风险用户的统计模块。
fix: 1. 修复合同起草无权访问却生成了新的模板文件的问题。
2. 修复文档类型无法编辑入口模块的问题。
2025-12-13 02:59:34 +08:00
LiangShiyong 847f7b2b5a feat: 1. 添加交叉评查中的相关页面的按钮与权限的绑定控制。 2. 完善权限校验的hook函数,添加指定的交叉评查的相关的权限。
fix: 1. 修复交叉评查中无法高亮文档的问题。
2025-12-12 16:10:05 +08:00
LiangShiyong d4000cd292 fix: 1. 继续对齐交叉评查的接口,完善创建交叉评查的逻辑 和 相关组件的渲染布局。
2. 文档的基本信息修改改用接口。      3. 重新完善角色权限管理的页面逻辑。     4.将评查点列表中的返回逻辑改用浏览器的记忆返回。
2025-12-12 12:00:36 +08:00
LiangShiyong d8bba607fc fix: 1. 重新对齐交叉评查的接口。
2. 确认评查结果的接口对接。 3. 新增评查点适配省级创建的响应数据和其他用户创建的单条响应数据。  4. 文档列表的文档类型通过通用的查询接口查询文档类型。优化加载状态的时机。
2025-12-11 11:16:50 +08:00
LiangShiyong ba517d7b9c fix:修复前端路由权限校验。修复交叉评查与普通评查结果的ai建议的替换效果不一致。 2025-12-10 09:10:57 +08:00
LiangShiyong de923f6521 fix: 1. 修改dockerFile
2. 修复一些合同起草的刷新报错问题
2025-12-09 14:46:07 +08:00
LiangShiyong 59c127806c Merge branch 'Wren' into shiy-login
# Conflicts:
#	app/hooks/dify-chat-apps/useChatApps.ts
2025-12-08 21:41:29 +08:00
TanWenyan 0a3c1a2735 修复权限操作 2025-12-08 21:36:03 +08:00
LiangShiyong 88e3d57351 fix:修复大模型对话管理的ant文本框和下拉选择框的样式 2025-12-08 14:21:27 +08:00
TanWenyan 3f5c23123b feat: 添加对话应用选择和知识库切换功能
- 新增对话应用管理模块(dify-chat-apps),支持获取和切换对话应用
- 优化对话应用切换后自动刷新会话列表功能
- 知识库管理页面新增下拉选择器,支持切换不同知识库
- API 层支持 app_id 参数传递,实现多应用会话隔离

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 01:44:34 +08:00
TanWenyan 27aff59152 feat: 添加知识库配置管理功能
新增地区-知识库绑定管理功能,支持增删改查操作
- 添加 V3 API 路由层:area-datasets 相关接口
- 添加 API 客户端:area-datasets.ts
- 添加自定义 Hook:use-area-dataset-config.ts
- 添加管理组件:area-dataset-config.tsx
- 修复路由冲突问题,删除重复的 .ts 路由文件
- 更新 dataset-manager 页面,添加 Tabs 导航

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 23:12:21 +08:00
PingChuan 21bcb1310b Merge remote-tracking branch 'origin/Wren' into PingChuan 2025-12-05 23:37:37 +08:00
PingChuan 7a2a481f44 refertor:使用antdX重构dify聊天渲染组件,到处引用文件 2025-12-05 23:36:12 +08:00
TanWenyan d53742948d feat: 知识库设置页面增加 retrieval_model 检索配置功能
1. 召回测试页面增加 Score 阈值参数配置
2. 知识库设置页面新增检索模型配置:
   - 检索方式 (向量/全文/混合/关键字检索)
   - Reranking 模型 (默认开启,不可关闭)
   - Top K 返回数量
   - Score 阈值 (默认开启,可调节数值)
3. 修复 Dify API 字段名问题 (retrieval_model_dict)
4. 优化数据加载流程,使用详情接口获取完整配置

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 22:07:16 +08:00
LiangShiyong 91b7518c99 feat: 1. 完善起草合同页面的逻辑交互,对接minio的接口操作 2025-12-05 20:17:37 +08:00
LiangShiyong 3d1dbb3f97 all in 2025-12-05 00:09:32 +08:00
LiangShiyong bb3d22eabf Merge branch 'PingChuan' into shiy-login 2025-12-05 00:05:40 +08:00
LiangShiyong 33f10896a0 fix: 1.接入ai_suggestion.
2. 接入合同起草功能。
2025-12-05 00:04:45 +08:00
PingChuan dcdc21b90e feat:新增dify接入知识库时更新文档嵌入参数的功能 2025-12-04 17:47:44 +08:00
LiangShiyong eca98fc540 Merge branch 'PingChuan' into shiy-login
# Conflicts:
#	app/config/api-config.ts
2025-12-03 12:10:21 +08:00
LiangShiyong d88cfc818b feat: 1. 实现一键替换。
2. 优化追加附件和模板上传的样式。
2025-12-03 12:07:56 +08:00
PingChuan a13f3b3635 feat: 完善Dify知识库管理召回测试模块,优化知识库上传文件时的分段配置设置 2025-12-03 12:03:09 +08:00
PingChuan 0f49426a2e feat:完成上传文档时调整嵌入参数模块初版 2025-12-02 22:29:32 +08:00
LiangShiyong 88466b7a8b feat: 1. 完善交叉评查上传创建任务,改成动态加载文档类型。
2. 重新对齐交叉评查的接口。
2025-12-02 10:10:03 +08:00
LiangShiyong c9e0d5abba Merge branch 'PingChuan' into shiy-login 2025-12-01 12:40:22 +08:00
LiangShiyong c43485ec27 fix: 添加交叉评查的案卷类型的查询,动态选择文档类型 2025-12-01 12:36:38 +08:00
PingChuan 0c1b81cfb2 temp:临时备份,完成一半知识库管理模块 2025-12-01 12:33:53 +08:00
PingChuan 754ec2c7b5 feat:完成dify知识库文档基础CRUD模块 2025-11-30 21:28:49 +08:00
LiangShiyong af258fe669 Merge branch 'PingChuan' into shiy-login 2025-11-30 19:33:46 +08:00
LiangShiyong 4fcc92a381 feat: 1. 接入CollaboraViewer选中的高亮效果,清除高亮功能,页面销毁自动清除高亮。
2. 合同模板对比接入monaco editor的效果。
3. 添加交叉评查的案卷类型的数据查询。

fix: 1. 修复文档列表的打开模态框蒙板层显示效果。
2025-11-30 19:33:05 +08:00
PingChuan c94cc00138 feat:前端新增初版知识库管理页面 2025-11-30 19:27:01 +08:00
PingChuan 9614899171 feat:重构dify前端组件以及转发逻辑 2025-11-30 16:24:35 +08:00
LiangShiyong fb67f138dc fix: 1. 全局axios添加formData文件上传的检测,删除Content-Type让axios自动检测。
2. 完善入口模块管理的接口的对接。
3. 完善角色权限管理的接口对接和测试。
4. 完善主页的入口模块的图标的显示和图片的显示。
2025-11-29 19:37:29 +08:00
LiangShiyong 30e100ef3e feat: 1. 本地化思源黑体的字体包并优先使用。
2. 添加权限映射表和全局查看权限的hook,便于路由控制不同权限按钮显示/隐藏。
3. 删除评查点分组的部分旧api方法。
4. 对接评查点分组接口,文档类型接口, 提示词管理接口, 入口模块管理的接口。
5. 优化角色权限管理的接口,完善不用地区的访问权限认证。
6. 优化主页交叉评查和设置的入口样式和布局。
7. 优化评查点分组,评查规则的功能权限校验。
2025-11-29 10:37:35 +08:00
LiangShiyong d5827a2146 fix: 1. 接入入口模块的管理接口,优化样式。
2. 将查看文档评查结果详情对接接口,采用接口的方式进行查询。
2025-11-26 23:37:14 +08:00
TanWenyan e4e1757977 fix: 修复首页统计数据字段映射错误
修正后端API字段名称:
- pass_rate_growth → monthly_pass_rate_growth
- issues_detected → monthly_detected_issues
- issues_growth → monthly_issues_growth

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 18:55:46 +08:00
TanWenyan 1e9e0044ba feat: 角色权限管理v3.0及错误处理优化
1. 角色权限管理升级:
   - 添加路由下展开式API权限管理功能
   - 新增 getRoleRoutesWithPermissions 和 saveRoleApiPermissions API
   - 支持按路由展开/收起查看和勾选权限
   - 过滤"所有权限"选项,只显示具体权限

2. 错误处理优化:
   - 403 无权限错误显示为"无权限访问该资源"
   - 修复评查点分组批量删除显示"成功删除 undefined 个分组"的问题

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 17:04:18 +08:00
TanWenyan 5073090bcb feat: 添加 403 无权限弹窗提示
## 修改内容

在 axios 响应拦截器中添加 403 Forbidden 错误处理:
- 检测到 403 状态码时,显示 toast 警告提示
- 提示信息:"无权限访问该资源"
- 只在客户端环境显示,服务端不显示 toast

## 代码位置
- app/api/axios-client.ts:177-185

## 实现
```typescript
// 🔒 403 无权限错误处理
if (isAxiosError(error) && error.response?.status === 403) {
  console.warn('⚠️ [403 Forbidden] 无权限访问:', error.config?.url);

  // 只在客户端显示 toast 提示
  if (typeof window !== 'undefined') {
    toastService.warning('无权限访问该资源');
  }
}
```

## 用户体验
- 用户访问无权限资源时,右上角显示黄色警告 toast
- toast 自动消失,不阻塞用户操作
- 控制台同时输出警告日志便于调试
2025-11-26 12:13:44 +08:00
TanWenyan da7e565bbb fix(evaluation-groups): 修复 Authorization 头缺失问题
## 问题
GET 和 DELETE 请求在 token 为 undefined 时,传递空对象 `{}` 作为 headers,导致 axios-client 拦截器无法自动添加 Authorization 头。

## 根本原因
```typescript
//  错误写法
headers: token ? { 'Authorization': `Bearer ${token}` } : {}
```
当 token 为 undefined 时,传递的是空对象 `{}`,axios-client 认为已经提供了 headers,就跳过拦截器。

## 修复方案
```typescript
//  正确写法
...(token ? { headers: { 'Authorization': `Bearer ${token}` } } : {})
```
当 token 为 undefined 时,完全不传 headers 参数,让 axios-client 拦截器自动添加。

## 修复的函数
1.  getEvaluationPointGroups (GET)
2.  getAllEvaluationPointGroups (GET)
3.  getEvaluationPointGroup (GET)
4.  getEvaluationPointGroupChildren (GET)
5.  deleteEvaluationPointGroup (DELETE)

## 未修复的函数(无需修复)
- createEvaluationPointGroup (POST) - headers 总是包含 Content-Type
- updateEvaluationPointGroup (PUT) - headers 总是包含 Content-Type
- batchUpdateEvaluationPointGroupStatus (PATCH) - headers 总是包含 Content-Type
- batchDeleteEvaluationPointGroups (DELETE) - headers 总是包含 Content-Type

POST/PUT/PATCH 请求因为总是需要设置 Content-Type,所以 headers 对象总是存在,拦截器会正常工作。

## 影响
修复后,即使 token 参数为 undefined,axios-client 拦截器也能正常添加 Authorization 头。

## 文件
- app/api/evaluation_points/rule-groups.ts

## 相关日志
解决了控制台警告:
⚠️ [apiRequest] 请求缺少 Authorization 头!headers:
2025-11-26 10:37:36 +08:00
TanWenyan bd3b6de9cd debug(evaluation-groups): 添加 getEvaluationPointGroups 调试日志
## 修改内容

在 getEvaluationPointGroups 函数中添加详细的调试日志,用于排查数据获取问题:

### 新增调试日志
- 📦 打印完整 API 响应
- 📊 打印 response.data 和 response.data.data
-  错误日志增强
-  转换成功后打印结果

### 日志输出点
1. API 响应完整数据
2. response.data 检查
3. response.data.data 存在性验证
4. 数据转换后的 ruleGroups
5. 错误捕获和详细错误信息

### 目的
帮助诊断以下问题:
- 后端返回数据格式是否正确
- response.data.data 是否存在
- 数据转换是否成功
- 前端为什么没有显示数据

### 文件
- app/api/evaluation_points/rule-groups.ts:1207-1225

⚠️ 注意:这是临时调试日志,问题解决后应该移除或注释掉
2025-11-26 10:23:01 +08:00
TanWenyan e7646d17a6 fix(evaluation-groups): 修复一级分组显示错误和 React key 警告
## 修复内容

### 1. 修复一级分组过滤问题
- **问题**: getEvaluationPointGroups 函数忽略了 pid 参数,导致返回所有分组(包括二级分组)
- **修复**: 添加 pid 参数处理逻辑,支持传递 "null" 字符串来查询一级分组
- **文件**: app/api/evaluation_points/rule-groups.ts:1186-1198

### 2. 修复 React key 重复警告
- **问题**: 父分组和子分组可能有相同的 ID,导致 "Encountered two children with the same key" 警告
- **修复**: 将 rowKey 从简单的 "id" 改为根据 isParent 生成唯一 key
- **文件**: app/routes/rule-groups._index.tsx:817

### 3. 新增后端 API 规范文档
- **文件**: docs/evaluation/evaluation_point_groups_backend_api_spec.md
- **内容**:
  - 完整的 9 个 FastAPI v3 接口规范
  - Python Pydantic 模型定义
  - TypeScript 接口定义
  - pid 参数处理说明(字符串 "null" 转换为 None)
  - 10 个完整测试用例
  - 数据库表结构建议

## 技术细节

**pid 参数处理**:
```typescript
// 前端发送
GET /api/v3/evaluation-point-groups?pid=null&page=1

// 后端需要识别字符串 "null" 并转换为 None/NULL
if (pid == "null") {
  query = query.filter(EvaluationPointGroup.pid.is_(None))
}
```

**唯一 key 生成**:
```typescript
rowKey={(record) => record.isParent ? `parent-${record.id}` : `child-${record.id}`}
```

🔗 相关文档: docs/evaluation/evaluation_point_groups_backend_api_spec.md
2025-11-26 10:05:39 +08:00
TanWenyan d1f764028c Merge branch 'shiy-login' into Wren 2025-11-25 20:59:59 +08:00
LiangShiyong 83f8d80e12 合并代码 2025-11-25 20:50:34 +08:00
TanWenyan 0e812ba181 fix(rule-groups): 修复 getChildGroups 函数使用 FastAPI v3 接口
问题:
- getChildGroups 函数内部仍在调用已重命名的 getRuleGroups 函数
- 导致运行时错误:"getRuleGroups is not defined"
- 影响子分组加载功能

修复:
- 更新 getChildGroups 使用 FastAPI v3 的 getEvaluationPointGroupChildren
- 删除手动统计评查点数量的代码(FastAPI v3 接口已返回 rule_count)
- 简化函数逻辑,直接返回接口数据

影响范围:
- app/api/evaluation_points/rule-groups.ts (getChildGroups 函数)

功能:
- 获取子分组列表及评查点数量

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 20:39:11 +08:00
TanWenyan dbc9512c8b refactor(rule-groups): 替换创建/编辑页面为 FastAPI v3 接口
变更内容:
1. 补充重命名 getRuleGroup → getRuleGroup_legacy (rule-groups.ts)
2. 更新导入语句,使用新的 FastAPI v3 函数 (rule-groups.new.tsx)
3. 替换所有函数调用:
   - getRuleGroups → getEvaluationPointGroups (2处)
   - getRuleGroup → getEvaluationPointGroup
   - createRuleGroup → createEvaluationPointGroup
   - updateRuleGroup → updateEvaluationPointGroup

影响范围:
- app/api/evaluation_points/rule-groups.ts (补充遗漏的重命名)
- app/routes/rule-groups.new.tsx (创建/编辑页面)

功能:
- 分组创建、编辑、编码唯一性验证

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 20:20:52 +08:00
TanWenyan ccb33e9b11 refactor(rule-groups): 重命名旧 PostgREST 函数为 _legacy 后缀
重命名函数(保留作为备份):
1. getRuleGroups → getRuleGroups_legacy
2. getAllRuleGroups → getAllRuleGroups_legacy
3. createRuleGroup → createRuleGroup_legacy
4. updateRuleGroup → updateRuleGroup_legacy
5. deleteRuleGroup → deleteRuleGroup_legacy
6. batchUpdateRuleGroupStatus → batchUpdateRuleGroupStatus_legacy
7. batchDeleteRuleGroups → batchDeleteRuleGroups_legacy

变更:
- 所有旧函数添加 _legacy 后缀
- 添加 @deprecated 注释指向新的 FastAPI v3 函数
- 保留旧函数作为备份,不删除

目的:
- 为过渡到 FastAPI v3 接口做准备
- 保留旧代码以便回滚

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 20:14:53 +08:00
TanWenyan d5a7674a9a feat(rule-groups): 添加 FastAPI v3 评查点分组接口函数
新增功能:
- 添加 9 个 FastAPI v3 接口函数到 rule-groups.ts
- 导入 apiRequest 用于调用后端 API

接口列表:
1. getEvaluationPointGroups - 获取一级分组列表 (GET /api/v3/evaluation-point-groups)
2. getAllEvaluationPointGroups - 获取树形结构 (GET /api/v3/evaluation-point-groups/all)
3. getEvaluationPointGroup - 获取单个分组详情 (GET /api/v3/evaluation-point-groups/{id})
4. getEvaluationPointGroupChildren - 获取子分组列表 (GET /api/v3/evaluation-point-groups/{parent_id}/children)
5. createEvaluationPointGroup - 创建分组 (POST /api/v3/evaluation-point-groups)
6. updateEvaluationPointGroup - 更新分组 (PUT /api/v3/evaluation-point-groups/{id})
7. deleteEvaluationPointGroup - 删除分组 (DELETE /api/v3/evaluation-point-groups/{id})
8. batchUpdateEvaluationPointGroupStatus - 批量更新状态 (PATCH /api/v3/evaluation-point-groups/batch/status)
9. batchDeleteEvaluationPointGroups - 批量删除 (DELETE /api/v3/evaluation-point-groups/batch)

技术细节:
- 新增 EvaluationPointGroupResponse 接口定义响应格式
- 新增 convertApiGroupToRuleGroup 转换函数
- 所有函数支持 JWT token 认证
- 统一的错误处理和日志输出
- 保留旧的 PostgREST 函数作为备份

相关文档:
- docs/evaluation/evaluation_point_groups.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 20:10:30 +08:00
LiangShiyong fbf741bca9 Merge branch 'Wren' into shiy-login 2025-11-25 18:47:46 +08:00
TanWenyan 87a1bf87e5 fix(axios-client): 修复 code 字段类型判断导致的误报错误
问题:
- axios-client 检查 API 响应中的 code 字段时,没有区分数字类型和字符串类型
- 当后端返回包含业务编码字段 code: "05PZSYTZSNRYZX" 的数据时,被误判为错误响应
- 导致 GET /api/v3/evaluation-points/:id 等接口报"API请求失败: 未知错误"

解决方案:
- 添加 typeof data.code === 'number' 类型检查
- 只有数字类型的 code 才被视为 API 状态码(0 或 200)
- 字符串类型的 code 被视为业务数据字段,不触发错误检查

影响范围:
- 所有返回包含字符串 code 字段的 API 响应
- 特别是评查点相关接口(code 是评查点编码)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 18:36:15 +08:00
LiangShiyong ff0a99cbb4 Merge branch 'Wren' into shiy-login 2025-11-25 18:24:28 +08:00