dsh-form-fill-agent 0.2.3 → 0.2.4

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 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.3,共享内核和 Provider 保持 0.2.0。
46
+ 补充要求为模型可读文本;字段或工作表范围请通过向导/工作台修改,不能仅改文字后假定执行范围已同步。任务 schema 5 可读取 schema 1–5;回退旧版本请使用升级前目录副本或独立任务目录。主包为 0.2.4,共享内核和 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.3 保存任务 schema 5,兼容读取旧 schema 1–4;回退旧版本须使用升级前任务目录副本或新目录,防止丢失已确认的字段/主体设置。
54
+ 0.2.4 保存任务 schema 5,兼容读取旧 schema 1–4;回退旧版本须使用升级前任务目录副本或新目录,防止丢失已确认的字段/主体设置。
55
55
 
56
56
  ## 文档与反馈
57
57
 
package/lib/brand.css CHANGED
@@ -44,3 +44,4 @@
44
44
  .ff-ui .card{margin:16px 20px;padding:20px;border:1px solid var(--line);border-radius:8px;background:var(--surface);min-width:0}.ff-ui .card h2{margin:0 0 12px;font-size:18px}.ff-ui .card p{margin:8px 0 16px}.ff-ui #grid{margin:16px 20px;padding:16px;background:var(--surface);border:1px solid var(--line);border-radius:8px;min-width:0}.ff-ui #grid summary{cursor:pointer;font-weight:600}
45
45
  .ff-ui #history{padding:20px}.ff-ui #preview>.controls{padding:0 20px 20px}.ff-ui input[type=file]{width:100%;max-width:100%;min-width:0;font-size:12px}.ff-ui input[type=file]::file-selector-button{font:inherit;border:1px solid var(--line);border-radius:6px;padding:8px 12px;margin-right:10px;background:var(--surface);color:var(--text);cursor:pointer}.ff-ui #samples{margin-top:12px}.ff-ui .history-item{background:var(--surface);padding:16px;border:1px solid var(--line);border-radius:8px;margin-top:12px}
46
46
  @media(max-width:640px){.ff-ui .ff-shortcuts{justify-content:flex-start;padding-inline:12px;gap:8px}.ff-ui .ff-shortcuts button{flex:0 0 auto;min-width:92px;padding:7px 10px;font-size:12px}.ff-ui .card{margin:14px;padding:16px}.ff-ui #grid{margin:14px}.ff-ui .task-tabs{padding-inline:14px}.ff-ui #status{padding-inline:14px}.ff-ui #task-meta{margin-inline:14px;max-width:calc(100% - 28px)}.ff-ui .ff-execution-toolbar{margin-inline:14px}.ff-ui .ff-panel-head{padding:12px}.ff-ui .ff-panel-head .ff-brand{gap:8px}.ff-ui .ff-panel-head h2{font-size:14px}.ff-ui .ff-panel-actions{gap:4px}.ff-ui .ff-panel-actions button{font-size:11px;padding:6px}.ff-ui .ff-workbench-head{padding:16px}}
47
+ .ff-ui .ff-field-picker{position:relative;width:100%;min-width:0}.ff-ui .ff-field-picker>summary{padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--surface);cursor:pointer;overflow-wrap:anywhere}.ff-ui .ff-field-picker[open]>summary{border-color:var(--blue)}.ff-ui .ff-field-panel{padding:12px;border:1px solid var(--line);border-radius:8px;background:var(--surface);margin-top:4px;min-width:0}.ff-ui .ff-field-panel select[data-column]{width:100%;height:auto;max-width:100%}.ff-ui .ff-field-panel optgroup{font-weight:600}.ff-ui .ff-field-panel option{padding:7px;font-weight:400}
package/lib/ui.html CHANGED
@@ -151,6 +151,10 @@ function renderSettings(data){
151
151
  const dimension=document.createElement('select');dimension.setAttribute('aria-label',sheet.name+' 字段维度 '+cell.label);
152
152
  const groups=[{id:'',label:'全部维度'},...(data.catalogGroups||[]),{id:'other',label:'其他字段'}];
153
153
  for(const g of groups){const option=document.createElement('option');option.value=g.id;option.textContent=g.label;dimension.append(option)}
154
+ const picker=document.createElement('details');picker.className='ff-field-picker';
155
+ const trigger=document.createElement('summary');picker.append(trigger);
156
+ const panel=document.createElement('div');panel.className='ff-field-panel';picker.append(panel);
157
+ picker.addEventListener('keydown',event=>{if(event.key==='Escape'){picker.open=false;trigger.focus();event.stopPropagation()}});
154
158
  const status=document.createElement('p');status.className='ff-mapping-status';status.setAttribute('aria-live','polite');
155
159
  const count=document.createElement('small');count.className='muted';
156
160
  const suggestions=document.createElement('div');suggestions.className='ff-mapping-suggestions';
@@ -161,19 +165,23 @@ function renderSettings(data){
161
165
  select.replaceChildren();
162
166
  const list=[{key:'',label:'不填写'},...found];
163
167
  if(chosen&&!found.some(f=>f.key===chosen)){const field=data.catalog.find(f=>f.key===chosen);if(field)list.splice(1,0,{...field,label:field.label+'(当前选择,筛选外)'})}
164
- for(const field of list){const option=document.createElement('option');option.value=field.key;option.textContent=field.label;select.append(option)}
168
+ const buckets=new Map();
169
+ for(const field of list){const option=document.createElement('option');option.value=field.key;option.textContent=field.label;const group=field.key?data.catalogGroups?.find(g=>g.fields.includes(field.key)):null;if(group){if(!buckets.has(group.id)){const optgroup=document.createElement('optgroup');optgroup.label=group.label;select.append(optgroup);buckets.set(group.id,optgroup)}buckets.get(group.id).append(option)}else select.append(option)}
170
+ trigger.textContent=chosen?(data.catalog.find(f=>f.key===chosen)?.label||chosen):'选择填写字段';
165
171
  select.value=chosen;count.textContent=found.length?'匹配 '+found.length+' 个字段':'没有匹配字段,请更换关键词或维度';updateStatus();
166
172
  };
167
173
  select.onchange=()=>{chosen=select.value;manual=true;suggestions.replaceChildren();options()};
168
174
  search.oninput=options;dimension.onchange=options;
169
175
  if(!chosen&&!manual){
170
- const hints={'原文件导入名称':['company_name'],'单位':['company_name'],'名称':['company_name'],'网址':['contact_official_website']}[cell.label.trim()]||[];
176
+ const hints={'原文件导入名称':['company_name'],'单位':['company_name'],'名称':['company_name'],'法定代表人':['legal_person'],'登记状态':['business_status'],'地址':['registered_address'],'网址':['contact_official_website']}[cell.label.trim()]||[];
171
177
  const recommended=(data.catalog||[]).filter(f=>hints.includes(f.key)||matches(f,cell.label)).slice(0,4);
172
178
  if(recommended.length){const hint=document.createElement('span');hint.textContent='推荐(确认后采用):';suggestions.append(hint)}
173
179
  for(const field of recommended){const button=document.createElement('button');button.type='button';button.textContent=field.label;button.onclick=()=>{chosen=field.key;manual=true;suggestions.replaceChildren();options()};suggestions.append(button)}
174
180
  }
175
181
  const filters=document.createElement('div');filters.className='ff-mapping-filters';filters.append(search,dimension);
176
- label.append(status,suggestions,filters,select,count);options();fields.append(label);
182
+ select.size=8;
183
+ panel.append(suggestions,filters,select,count);
184
+ label.append(status,picker);options();fields.append(label);
177
185
  }
178
186
  };
179
187
  header.onchange=showFields;section.append(header,fields);showFields();$('mapping').append(section);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-form-fill-agent",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
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" },