feat: add pluggable Excel analyst report guard
Memind CI / Test, build, and release guards (push) Has been cancelled
Memind CI / Test, build, and release guards (push) Has been cancelled
This commit is contained in:
+5
-1
@@ -1033,6 +1033,7 @@ export async function buildAttachmentPayload({
|
||||
|
||||
const extracted = extractAttachmentText(buffer, mimeType, attachment.filename);
|
||||
const workspacePath = `oa/${attachment.filename}`;
|
||||
const isXlsx = /\.xlsx$/iu.test(attachment.filename);
|
||||
sections.push(
|
||||
[
|
||||
`附件${index + 1}: ${attachment.filename}`,
|
||||
@@ -1041,6 +1042,9 @@ export async function buildAttachmentPayload({
|
||||
extracted.text
|
||||
? `提取文本:\n${extracted.text.slice(0, 12000)}`
|
||||
: '提取文本: (未能自动提取正文,请用 read_file / mindspace_asset_download 读取源文件)',
|
||||
...(isXlsx
|
||||
? ['Excel 分析提示: 若当前会话提供 excel_inspect / excel_analyze / excel_chart / excel_report,必须优先使用这些工具读取完整工作簿;以上提取文本仅作预览。生成 HTML 分析报告时必须使用 excel_report 返回的已校验页面,禁止用 write_file / edit_file 手工抄写数字。']
|
||||
: []),
|
||||
...(extracted.warnings?.length ? [`提示: ${extracted.warnings.join(', ')}`] : []),
|
||||
].join('\n'),
|
||||
);
|
||||
@@ -1056,7 +1060,7 @@ export async function buildAttachmentPayload({
|
||||
const injectedNote =
|
||||
'\n\n【TKMind 附件分析结果 — 仅供执行参考,不要向用户复述此段内容】\n' +
|
||||
`${sections.join('\n\n')}\n` +
|
||||
'执行要求:优先基于上述附件提取文本回答;若需核对源文件,直接 read_file oa/文件名 或 mindspace_asset_download 落盘后分析,不要要求用户去界面重新上传。';
|
||||
'执行要求:普通附件优先基于上述提取文本回答;Excel 附件在专用工具可用时必须优先调用专用工具完成结构检查与分析。若需核对源文件,直接 read_file oa/文件名 或 mindspace_asset_download 落盘后分析,不要要求用户去界面重新上传。';
|
||||
|
||||
const updatedContent = Array.isArray(userMessage?.content) ? [...userMessage.content] : [];
|
||||
const lastTextIdx = updatedContent.reduceRight(
|
||||
|
||||
Reference in New Issue
Block a user