Compare commits
2 Commits
e2a456fc9f
...
670e7492bb
| Author | SHA1 | Date | |
|---|---|---|---|
| 670e7492bb | |||
| a742efa73a |
@@ -478,7 +478,7 @@ impl AdvancedDocxHandler {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Invoice details table
|
// Invoice details table
|
||||||
let mut invoice_info = Table::new(vec![])
|
let invoice_info = Table::new(vec![])
|
||||||
.add_row(TableRow::new(vec![
|
.add_row(TableRow::new(vec![
|
||||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("Invoice #:"))),
|
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("Invoice #:"))),
|
||||||
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("[INV-0001]"))),
|
TableCell::new().add_paragraph(Paragraph::new().add_run(Run::new().add_text("[INV-0001]"))),
|
||||||
|
|||||||
+19
-11
@@ -1856,16 +1856,25 @@ impl DocxToolsProvider {
|
|||||||
hint: Some("Check list_templates for available names".to_string()),
|
hint: Some("Check list_templates for available names".to_string()),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Open template
|
|
||||||
let mut handler = self.handler.write().unwrap();
|
let mut handler = self.handler.write().unwrap();
|
||||||
|
|
||||||
|
// Open template
|
||||||
let doc_id = match handler.open_document(&template_path) {
|
let doc_id = match handler.open_document(&template_path) {
|
||||||
Ok(id) => id,
|
Ok(id) => id,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
drop(handler);
|
drop(handler);
|
||||||
return ToolOutcome::Error {
|
return CallToolResponse {
|
||||||
code: ErrorCode::InternalError,
|
content: vec![ToolResponseContent::Text(TextContent {
|
||||||
error: e.to_string(),
|
content_type: "application/json".into(),
|
||||||
hint: None,
|
text: serde_json::json!({
|
||||||
|
"success": false,
|
||||||
|
"error": e.to_string(),
|
||||||
|
"code": ErrorCode::InternalError
|
||||||
|
}).to_string(),
|
||||||
|
annotations: None,
|
||||||
|
})],
|
||||||
|
is_error: Some(true),
|
||||||
|
meta: None,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1882,9 +1891,9 @@ impl DocxToolsProvider {
|
|||||||
&doc_id,
|
&doc_id,
|
||||||
&placeholder,
|
&placeholder,
|
||||||
&val_str,
|
&val_str,
|
||||||
false, // case_sensitive: false for placeholders
|
false,
|
||||||
true, // whole_word: true (treat placeholder as whole token)
|
true,
|
||||||
false, // use_regex: false
|
false,
|
||||||
) {
|
) {
|
||||||
replace_count += count;
|
replace_count += count;
|
||||||
}
|
}
|
||||||
@@ -1892,9 +1901,8 @@ impl DocxToolsProvider {
|
|||||||
|
|
||||||
// Save generated document
|
// Save generated document
|
||||||
let out_path = PathBuf::from(output_path);
|
let out_path = PathBuf::from(output_path);
|
||||||
let result = if out_path.parent().is_some() {
|
let result = if let Some(parent) = out_path.parent() {
|
||||||
if let Err(e) = std::fs::create_dir_all(out_path.parent().unwrap()) {
|
if let Err(e) = std::fs::create_dir_all(parent) {
|
||||||
drop(handler);
|
|
||||||
ToolOutcome::Error {
|
ToolOutcome::Error {
|
||||||
code: ErrorCode::InternalError,
|
code: ErrorCode::InternalError,
|
||||||
error: format!("Failed to create output directory: {}", e),
|
error: format!("Failed to create output directory: {}", e),
|
||||||
|
|||||||
Reference in New Issue
Block a user