feat(shipping-notice): 新增发货通知自动上传功能与候选资格评估
- 在环境配置中新增 SHIPPING_NOTICE_AUTO_UPLOAD_ENABLED 选项,默认关闭,需显式开启以支持自动上传。 - 引入新的 pytest.ini 文件,增加测试标记以支持自动化测试。 - 删除不再使用的 seed_shipping_notice_agents.py 文件,简化代码库。 - 更新相关 API,增强发货通知与候选资格评估功能,支持多种筛选条件。 - 增强文档与代码注释,反映新的业务逻辑与功能要求。
This commit is contained in:
1 parent
cef3d5b26a
commit
3a9fbac2fc
226 files changed
+25010
-2098
No files matched your search
@@ -1,4 +1,7 @@
|
||||
/** 去除模型 reasoning 前奏,供 Markdown 展示与出货模块使用 */
|
||||
/**
|
||||
* 去除模型推理与调试包装,供 Markdown 展示与出货模块使用。
|
||||
* 仅处理明确的推理标签、纯调试 JSON 和开头技术诊断行,不改写正常业务回答。
|
||||
*/
|
||||
export const stripReasoningPrelude = (text: string) => {
|
||||
if (!text) return '';
|
||||
let cleaned = text
|
||||
@@ -6,6 +9,31 @@ export const stripReasoningPrelude = (text: string) => {
|
||||
.replace(/<analysis[\s\S]*?<\/analysis>/gi, '')
|
||||
.trim();
|
||||
|
||||
if (/^(?:\{|\[)/.test(cleaned)) {
|
||||
try {
|
||||
const parsed = JSON.parse(cleaned) as unknown;
|
||||
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
||||
const keys = Object.keys(parsed as Record<string, unknown>);
|
||||
const technicalKeys = new Set([
|
||||
'workflow_run_id', 'node_id', 'node_execution_id', 'status', 'error',
|
||||
'outputs', 'inputs', 'metadata', 'traceback', 'tool_output', 'tool_response',
|
||||
]);
|
||||
if (keys.length > 0 && keys.every((key) => technicalKeys.has(key))) return '';
|
||||
}
|
||||
} catch {
|
||||
// 非完整 JSON 继续按普通回答展示。
|
||||
}
|
||||
}
|
||||
|
||||
const lines = cleaned.split('\n');
|
||||
while (
|
||||
lines.length > 1
|
||||
&& /^\s*(?:workflow(?:_run)?_id|node(?:_execution)?_id|tool(?:_output|_response)?|traceback|status|error)(?:[_\s-]*(?:code|message))?\s*[:=]/i.test(lines[0] || '')
|
||||
) {
|
||||
lines.shift();
|
||||
}
|
||||
cleaned = lines.join('\n').trim();
|
||||
|
||||
const reasoningMarkers = [
|
||||
'让我分析',
|
||||
'根据应答生成规则',
|
||||
|
||||
Reference in new issue
Block a user