dsh-form-fill-agent 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/ui.html +14 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ dsh plugin --profile web add dsh-form-fill-agent@latest
|
|
|
43
43
|
|
|
44
44
|
## 使用边界与数据保存
|
|
45
45
|
|
|
46
|
-
补充要求为模型可读文本;字段或工作表范围请通过向导/工作台修改,不能仅改文字后假定执行范围已同步。任务 schema 5 可读取 schema 1–5;回退旧版本请使用升级前目录副本或独立任务目录。主包为 0.2.
|
|
46
|
+
补充要求为模型可读文本;字段或工作表范围请通过向导/工作台修改,不能仅改文字后假定执行范围已同步。任务 schema 5 可读取 schema 1–5;回退旧版本请使用升级前目录副本或独立任务目录。主包为 0.2.10,共享内核为 0.2.8,Provider 保持 0.2.0。
|
|
47
47
|
|
|
48
48
|
支持企业完整登记名称或 18 位信用代码;简称、主体不一致或多候选不会自动猜选。仅有信用代码的表格也可作为查询锚点。连接候选检索工具时可检索简称,仍需人工确认;缺少工具时降级人工输入。字段映射采用确定性规则及人工确认,不让模型编造事实。支持普通内部公式、固定区域下拉、基础条件格式和普通表格对象;复杂 Excel 结构和 Word 暂不支持,保真边界见下方安全说明。
|
|
49
49
|
|
|
@@ -51,7 +51,7 @@ dsh plugin --profile web add dsh-form-fill-agent@latest
|
|
|
51
51
|
|
|
52
52
|
显式设置 DSH_HOME 时,任务保存至其 form-fill-tasks 目录,默认 24 小时过期;未设置时使用内存。任务保存输入表格和归一化预览,不持久化原始 MCP 响应,可主动删除任务。模型及 MCP 凭据由宿主管理。
|
|
53
53
|
|
|
54
|
-
0.2.
|
|
54
|
+
0.2.10 保存任务 schema 5,兼容读取旧 schema 1–4;回退旧版本须使用升级前任务目录副本或新目录,防止丢失已确认的字段/主体设置。
|
|
55
55
|
|
|
56
56
|
## 文档与反馈
|
|
57
57
|
|
package/lib/ui.html
CHANGED
|
@@ -84,7 +84,17 @@ function initWizard(){const structure=mappingVersion();if(wizardTask===current?.
|
|
|
84
84
|
function scopeReview(){
|
|
85
85
|
const omitted=current?.analysis.tables.flatMap(t=>t.mappings.filter(m=>!t.anchors.includes(m.field)&&(!m.field||!wizardFields.has(m.field))).map(m=>t.sheet+':'+m.label))||[];
|
|
86
86
|
const missing=current?.analysis.incomplete.filter(i=>i.reason==='missing-anchor')||[];
|
|
87
|
-
|
|
87
|
+
let problem='';
|
|
88
|
+
const tables=current?.analysis.tables||[],issues=current?.analysis.incomplete||[];
|
|
89
|
+
if(!tables.length){
|
|
90
|
+
const conflicts=issues.filter(i=>i.reason==='ambiguous-mapping');
|
|
91
|
+
if(conflicts.length){
|
|
92
|
+
const details=conflicts.map(i=>{const mappings=current.configuration?.mappings?.filter(m=>m.sheet===i.sheet&&m.field)||[];const repeated=[...new Set(mappings.filter(m=>mappings.some(n=>n.column!==m.column&&n.field===m.field)).map(m=>current.catalog.find(f=>f.key===m.field)?.label||m.field))];return i.sheet+(repeated.length?':'+repeated.join('、'):'')});
|
|
93
|
+
problem='字段映射存在重复或冲突('+details.join(';')+')。请返回字段设置,同一目标字段保留一列,其他列选择不填写。';
|
|
94
|
+
}else problem='未识别到可执行的表头。请在字段设置确认表头行,保留企业名称或有值的信用代码,并至少映射一个需要填写的字段。';
|
|
95
|
+
}else if(!wizardFields.size)problem='尚未选择填写字段。请返回字段设置,为原表中至少一个待填列选择对应字段;企业名称仅用于定位主体。';
|
|
96
|
+
else if(missing.length&&!current.analysis.opportunities.length)problem='待填行缺少可用企业标识。请返回字段设置映射有值的企业名称列,或检查原表主体内容。';
|
|
97
|
+
return {omitted,missing,blocked:!!problem,problem};
|
|
88
98
|
}
|
|
89
99
|
function renderWizard(){
|
|
90
100
|
initWizard();
|
|
@@ -129,14 +139,14 @@ function directScope(){
|
|
|
129
139
|
wizardFields=new Set(current?.selectedFields||current?.analysis.tables.flatMap(t=>t.mappings.filter(m=>m.field&&!t.anchors.includes(m.field)).map(m=>m.field))||[]);
|
|
130
140
|
const review=scopeReview(),signature=mappingVersion();
|
|
131
141
|
if($('direct-ack').dataset.signature!==signature){$('direct-ack').checked=false;$('direct-ack').dataset.signature=signature}
|
|
132
|
-
$('direct-scope').textContent=review.
|
|
142
|
+
$('direct-scope').textContent=review.problem||'将填写 '+wizardFields.size+' 个已确认字段。'+(review.omitted.length?'未纳入:'+review.omitted.join('、')+'。':'');
|
|
133
143
|
$('direct-ack-label').hidden=!review.omitted.length;
|
|
134
144
|
return review;
|
|
135
145
|
}
|
|
136
146
|
async function directDraft(){
|
|
137
147
|
if(busy||!current)return;
|
|
138
148
|
const review=directScope();
|
|
139
|
-
if(review.blocked
|
|
149
|
+
if(review.blocked){$('status').textContent=review.problem;navigate('rules');$('anchor-alert').textContent=review.problem;$('anchor-alert').scrollIntoView({block:'center'});return}
|
|
140
150
|
if(review.omitted.length&&!$('direct-ack').checked){$('status').textContent='请确认本页未纳入的字段,或返回字段设置完善映射。';return}
|
|
141
151
|
$('scope-ack').checked=$('direct-ack').checked;
|
|
142
152
|
if(parent===window){$('direct-command').hidden=false;$('direct-command').value=command();$('direct-command').focus();$('direct-command').select();$('status').textContent='指令已生成,请复制到 DSH 对话框发送。';return}
|
|
@@ -251,7 +261,7 @@ function readMapping(){const configuration={sheets:[],headers:[],mappings:[]};fo
|
|
|
251
261
|
function mappingSignature(configuration){return JSON.stringify(configuration.headers.map(h=>({sheet:h.sheet,row:h.row,cells:current.structure.find(s=>s.name===h.sheet)?.rows.find(r=>r.number===h.row)?.cells}))) }
|
|
252
262
|
$('mapping-save').onclick=()=>{try{if(!current||busy)return;const configuration=readMapping();localStorage.setItem('ff-mapping:'+owner,JSON.stringify({schema:1,signature:mappingSignature(configuration),configuration}));$('status').textContent='字段规则已保存在本浏览器。'}catch{$('status').textContent='浏览器无法保存字段规则。'}};
|
|
253
263
|
$('mapping-load').onclick=async()=>{if(!current||busy)return;controls(true);try{const saved=JSON.parse(localStorage.getItem('ff-mapping:'+owner)||'null');if(saved?.schema!==1||saved.signature!==mappingSignature(saved.configuration))throw Error('没有与当前工作表及表头一致的规则,请手动设置。');render(await api('/configure',{id:current.id,configuration:saved.configuration}));$('status').textContent='字段规则已复用,请检查后重新核验。'}catch(e){$('status').textContent=e.message}finally{controls(false)}};
|
|
254
|
-
$('configure').onclick=async()=>{if(!current||busy)return;const configuration=readMapping();controls(true);$('mapping-next').hidden=true;try{render(await api('/configure',{id:current.id,configuration}));$('status').textContent='字段设置已应用,旧预览已清除,请重新核验。';$('mapping-next').hidden=
|
|
264
|
+
$('configure').onclick=async()=>{if(!current||busy)return;const configuration=readMapping();controls(true);$('mapping-next').hidden=true;try{render(await api('/configure',{id:current.id,configuration}));const review=directScope();$('status').textContent=review.blocked?'设置已保存,但尚不能执行。'+review.problem:'字段设置已应用,旧预览已清除,请重新核验。';$('mapping-next').hidden=review.blocked;if(review.blocked){$('anchor-alert').textContent=review.problem;$('anchor-alert').scrollIntoView({block:'center'})}else $('mapping-next').scrollIntoView({block:'nearest'});}catch(e){$('status').textContent=e.message}finally{controls(false)}};
|
|
255
265
|
$('samples').onclick=async e=>{if(!e.target.dataset.name||busy)return;const name=e.target.dataset.name;try{const response=await fetch(basePath+'/fixture/'+encodeURIComponent(name));if(!response.ok)throw Error('模板读取失败');await preview(await response.arrayBuffer(),name+'.xlsx',true)}catch(e){$('status').textContent=e.message}};
|
|
256
266
|
$('confirm').onclick=async()=>{if(!current||busy)return;controls(true);try{await api('/confirm',{id:current.id,confirmChangeSetId:current.changeSet.changeSetId});current=await api('/task/'+current.id);render(current);downloads();$('status').textContent='副本已生成,原文件保持不变。'}catch(e){$('status').textContent=e.message}finally{controls(false)}};
|
|
257
267
|
$('selection').onclick=async()=>{if(!current||busy)return;controls(true);try{render(await api('/select',{id:current.id,selectedIds:[...$('changes').querySelectorAll('input:checked')].map(x=>x.value)}));$('status').textContent='选择已应用,请核对新的预览。'}catch(e){$('status').textContent=e.message}finally{controls(false)}};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-form-fill-agent",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "AI填表智能体:XLSX blank-cell preview, QCC enrichment and persistent tasks for DSH.",
|
|
6
6
|
"repository": { "type": "git", "url": "git+https://github.com/duhu2000/dsh-form-fill-agent.git", "directory": "packages/dsh-form-fill-agent" },
|