54 lines
1.7 KiB
Diff
54 lines
1.7 KiB
Diff
diff --git a/frontend/src/db/backend-api.ts b/frontend/src/db/backend-api.ts
|
||
index 8944353..94ac852 100644
|
||
--- a/frontend/src/db/backend-api.ts
|
||
+++ b/frontend/src/db/backend-api.ts
|
||
@@ -92,6 +92,7 @@ export interface TemplateField {
|
||
name: string;
|
||
field_type: string;
|
||
required: boolean;
|
||
+ hint?: string;
|
||
}
|
||
|
||
// 表格填写结果
|
||
@@ -625,7 +626,10 @@ export const backendApi = {
|
||
*/
|
||
async fillTemplate(
|
||
templateId: string,
|
||
- templateFields: TemplateField[]
|
||
+ templateFields: TemplateField[],
|
||
+ sourceDocIds?: string[],
|
||
+ sourceFilePaths?: string[],
|
||
+ userHint?: string
|
||
): Promise<FillResult> {
|
||
const url = `${BACKEND_BASE_URL}/templates/fill`;
|
||
|
||
@@ -636,6 +640,9 @@ export const backendApi = {
|
||
body: JSON.stringify({
|
||
template_id: templateId,
|
||
template_fields: templateFields,
|
||
+ source_doc_ids: sourceDocIds || [],
|
||
+ source_file_paths: sourceFilePaths || [],
|
||
+ user_hint: userHint || null,
|
||
}),
|
||
});
|
||
|
||
diff --git a/frontend/src/pages/TemplateFill.tsx b/frontend/src/pages/TemplateFill.tsx
|
||
index 8c330a9..f9a4a39 100644
|
||
--- a/frontend/src/pages/TemplateFill.tsx
|
||
+++ b/frontend/src/pages/TemplateFill.tsx
|
||
@@ -128,8 +128,12 @@ const TemplateFill: React.FC = () => {
|
||
setStep('filling');
|
||
|
||
try {
|
||
- // 调用后端填表接口
|
||
- const result = await backendApi.fillTemplate('temp-template-id', templateFields);
|
||
+ // 调用后端填表接口,传递选中的文档ID
|
||
+ const result = await backendApi.fillTemplate(
|
||
+ 'temp-template-id',
|
||
+ templateFields,
|
||
+ selectedDocs // 传递源文档ID列表
|
||
+ );
|
||
setFilledResult(result);
|
||
setStep('preview');
|
||
toast.success('表格填写完成');
|