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