fix(chat): 修复源文件显示了兜底文件名uploaded_file
This commit is contained in:
1 parent
0c5ee4aec1
commit
1bc938155a
2 files changed
+89
-4
No files matched your search
@@ -0,0 +1,61 @@
|
||||
版本周期: 2026-06-09 ~ 2026-06-22
|
||||
tag: V26.6.2
|
||||
起始 commit: ff7c227(feat(环境配置): 添加企业微信通知和货代发货Agent环境配置)
|
||||
|
||||
本周更新亮点:
|
||||
|
||||
1. 前端架构重构(V3)
|
||||
a. 按 Feature-Module 垂直切分(auth / workspace / chat / admin / kb),统一 composables + Pinia 状态管理
|
||||
b. Chat 与 Workspace 子路由懒加载,减少首屏体积与重复请求
|
||||
c. 统一异常处理与错误提示,流式对话错误映射为面向用户的友好文案
|
||||
d. Admin 应用管理布局优化,新建/编辑弹框抽离为独立子组件
|
||||
|
||||
2. 文件检核(原 RoHS 检核升级)
|
||||
a. 新增文件检核工具 API,逐步替换原 RoHS 检核能力
|
||||
b. 支持检核进度实时展示、判定统计与当前步骤信息
|
||||
c. 检核执行过程中可下载 Excel 结果;支持历史检核报告检索
|
||||
d. 对话轮次与检核批次绑定;排程管理 cron 支持图形化配置
|
||||
e. 更新 Chatflow 编排与 API 文档,完善 API Key 配置说明
|
||||
|
||||
3. FAQ 高频问答缓存
|
||||
a. 缓存高频问题及预置答案,命中后直接返回,跳过 Dify 调用以提升响应速度
|
||||
b. 知识库关联文档更新时,自动标记关联问题为「待复审」并暂停缓存命中
|
||||
c. 排程管理支持触发热点问题离线聚合
|
||||
|
||||
4. 固定资产(固资)Agent 增强
|
||||
a. 查询结果去重、分页加载优化,修复查询状态中文显示问题
|
||||
b. 扩展 HXJM / HTT / HTE 等查询维度;支持供应商模糊查询
|
||||
c. 本人明细资产查询优化;表单字段过多时滑动体验改进
|
||||
d. 本地化固资快照:优先查本地缓存,可降级 ERP 直查;定期同步 ERP 全量资产信息
|
||||
|
||||
5. 货代发货通知(Shipping Notice)
|
||||
a. 环境变量与接口增强,完善企业微信通知及 Agent 参数配置
|
||||
b. 新增发货批次与任务管理,支持批次创建与任务处理
|
||||
|
||||
6. 排程管理
|
||||
a. 界面交互优化,新增弹窗控制逻辑
|
||||
b. 新增调度时区转换功能
|
||||
|
||||
7. 管理控制台(Admin)
|
||||
a. 用户管理改为服务端分页,避免拉取全量用户;修复删除用户未级联清理等问题
|
||||
b. 用户字段唯一性校验;新增/修改用户同步 Casdoor(仅密码变更时同步密码)
|
||||
c. 企业微信管理支持从 OA 一键同步企业微信 ID
|
||||
d. 聊天日志报表优化;公告布局调整并在首页滚动展示
|
||||
e. 支持企业微信重置密码
|
||||
|
||||
8. 聊天与对话链路
|
||||
a. 新增对话流性能监控及相关日志输出
|
||||
b. 修复 Dify 返回 token 但 chat_logs 记录 tokens_used 为 0 的问题
|
||||
|
||||
9. 知识库
|
||||
a. 修复 PPT 图片解析同步 Dify 时携带 base64 数据的问题
|
||||
b. Excel 上传预处理优化:由 markdown 改为 key=value 格式,改善 Dify 切块命中效果
|
||||
|
||||
10. 构建与运维
|
||||
a. Jenkins 构建保留最近 10 组镜像,超出自动清除旧镜像
|
||||
b. 测试环境 Oracle Client 替换为 ARM 版本;加速后端镜像构建并修复 Debian 12 ODBC 配置
|
||||
c. 修复 Alembic migration 多 head 问题
|
||||
|
||||
11. Bug 修复与体验优化
|
||||
a. 检核任务禁用状态处理及错误信息修复
|
||||
b. Admin 若干样式与布局微调
|
||||
@@ -62,6 +62,28 @@ const looksLikeFileName = (name: string) => {
|
||||
return /\.[A-Za-z0-9]{2,8}$/.test(n);
|
||||
};
|
||||
|
||||
/**
|
||||
* 判断源文件名是否为知识库上传链路生成的兜底名。
|
||||
* AI 触发时机:当 Dify 文档名与 HXOPS 源文件名不一致时,用它识别 `uploaded_file.*`
|
||||
* 这类无业务含义的占位名,避免聊天源文件按钮展示错误名称。
|
||||
*/
|
||||
const isFallbackUploadedFileName = (name: string) => {
|
||||
const base = String(name || '').trim().split(/[\\/]/).pop() || '';
|
||||
return /^uploaded_file(?:\.[A-Za-z0-9]{1,8})?$/i.test(base);
|
||||
};
|
||||
|
||||
/**
|
||||
* 选择聊天源文件按钮/预览弹窗的展示名称。
|
||||
* AI 触发时机:构建 source file link 时调用;若本地源文件名是兜底名,
|
||||
* 优先使用 Dify 检索返回的 document_name/title,下载链接仍沿用后端解析结果。
|
||||
*/
|
||||
const pickSourceDisplayName = (item: Record<string, unknown>, fallback = '') => {
|
||||
const sourceFilename = String(item?.source_filename || '').trim();
|
||||
const documentName = String(item?.document_name || item?.title || '').trim();
|
||||
if (sourceFilename && !isFallbackUploadedFileName(sourceFilename)) return sourceFilename;
|
||||
return documentName || sourceFilename || fallback;
|
||||
};
|
||||
|
||||
const findFirstByKeys = (payload: unknown, keyCandidates: string[]): string => {
|
||||
if (payload == null) return '';
|
||||
if (Array.isArray(payload)) {
|
||||
@@ -234,7 +256,7 @@ export function useChatSourceFiles({ agentId, t, msg, isMobile }: UseChatSourceF
|
||||
].filter(Boolean) as string[];
|
||||
|
||||
const content = getSourceContent(item);
|
||||
const forceName = String(item?.source_filename || item?.document_name || item?.title || '');
|
||||
const forceName = pickSourceDisplayName(item);
|
||||
const forceUrl = normalizeUrl(String(item?.source_download_url || item?.url || ''));
|
||||
|
||||
if (forceName && (forceUrl || (datasetId && remoteDocumentId))) {
|
||||
@@ -263,7 +285,7 @@ export function useChatSourceFiles({ agentId, t, msg, isMobile }: UseChatSourceF
|
||||
|
||||
for (const url of discovered) {
|
||||
if (isChunkLikeLink(url)) continue;
|
||||
const name = String(item?.source_filename || item?.document_name || item?.title || safeDecode(url.split('/').pop() || 'source-file'));
|
||||
const name = pickSourceDisplayName(item, safeDecode(url.split('/').pop() || 'source-file'));
|
||||
if (isNoisySourceName(name)) continue;
|
||||
if (isMarkdownFileName(name) || isMarkdownByUrl(url)) continue;
|
||||
const key = buildSourceLinkKey(name, datasetId, remoteDocumentId, url);
|
||||
@@ -316,7 +338,7 @@ export function useChatSourceFiles({ agentId, t, msg, isMobile }: UseChatSourceF
|
||||
const getDisplayRetrieverResources = (message: Record<string, unknown>): Record<string, unknown>[] => {
|
||||
const list = Array.isArray(message?.retriever_resources) ? message.retriever_resources as Record<string, unknown>[] : [];
|
||||
return list.filter((doc) => {
|
||||
const name = String(doc?.source_filename || doc?.document_name || doc?.title || '');
|
||||
const name = pickSourceDisplayName(doc);
|
||||
const url = String(doc?.source_download_url || doc?.url || doc?.file_url || doc?.document_url || '');
|
||||
return !(isMarkdownFileName(name) || isMarkdownByUrl(url));
|
||||
});
|
||||
@@ -358,7 +380,9 @@ export function useChatSourceFiles({ agentId, t, msg, isMobile }: UseChatSourceF
|
||||
return {
|
||||
...file,
|
||||
url: resolvedUrl,
|
||||
name: data?.source_filename || file.name,
|
||||
name: data?.source_filename && !isFallbackUploadedFileName(data.source_filename)
|
||||
? data.source_filename
|
||||
: file.name,
|
||||
actualExt: String(data?.source_ext || '').trim().toLowerCase() || undefined,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user