Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- routes/refinity.js +5 -3
routes/refinity.js
CHANGED
|
@@ -82,7 +82,9 @@ router.post('/track-changes-comments', async (req, res) => {
|
|
| 82 |
try {
|
| 83 |
const prev = String(req.body?.prev || '');
|
| 84 |
const current = String(req.body?.current || '');
|
| 85 |
-
const outName = String(req.body?.filename || 'refinity-tracked-comments.docx').replace(/\
|
|
|
|
|
|
|
| 86 |
|
| 87 |
const parts = diffWords(prev, current);
|
| 88 |
|
|
@@ -96,7 +98,7 @@ router.post('/track-changes-comments', async (req, res) => {
|
|
| 96 |
if (!value) return;
|
| 97 |
if (p.added) {
|
| 98 |
const cid = nextCommentId++;
|
| 99 |
-
comments.create(cid,
|
| 100 |
new Paragraph({ children: [ new TextRun({ text: 'Added: ', bold: true }), new TextRun({ text: value }) ] })
|
| 101 |
]);
|
| 102 |
children.push(new CommentRangeStart(cid));
|
|
@@ -107,7 +109,7 @@ router.post('/track-changes-comments', async (req, res) => {
|
|
| 107 |
}
|
| 108 |
if (p.removed) {
|
| 109 |
const cid = nextCommentId++;
|
| 110 |
-
comments.create(cid,
|
| 111 |
new Paragraph({ children: [ new TextRun({ text: 'Removed: ', bold: true }), new TextRun({ text: value }) ] })
|
| 112 |
]);
|
| 113 |
children.push(new CommentRangeStart(cid));
|
|
|
|
| 82 |
try {
|
| 83 |
const prev = String(req.body?.prev || '');
|
| 84 |
const current = String(req.body?.current || '');
|
| 85 |
+
const outName = String(req.body?.filename || 'refinity-tracked-comments.docx').replace(/[\\/]+/g,'_');
|
| 86 |
+
const authorName = String(req.body?.authorName || 'Refinity');
|
| 87 |
+
const authorInitials = String(req.body?.authorInitials || (authorName.split(/\s+/).map(s=>s[0]||'').join('').slice(0,3).toUpperCase()) || 'RF');
|
| 88 |
|
| 89 |
const parts = diffWords(prev, current);
|
| 90 |
|
|
|
|
| 98 |
if (!value) return;
|
| 99 |
if (p.added) {
|
| 100 |
const cid = nextCommentId++;
|
| 101 |
+
comments.create(cid, authorName, authorInitials, new Date(), [
|
| 102 |
new Paragraph({ children: [ new TextRun({ text: 'Added: ', bold: true }), new TextRun({ text: value }) ] })
|
| 103 |
]);
|
| 104 |
children.push(new CommentRangeStart(cid));
|
|
|
|
| 109 |
}
|
| 110 |
if (p.removed) {
|
| 111 |
const cid = nextCommentId++;
|
| 112 |
+
comments.create(cid, authorName, authorInitials, new Date(), [
|
| 113 |
new Paragraph({ children: [ new TextRun({ text: 'Removed: ', bold: true }), new TextRun({ text: value }) ] })
|
| 114 |
]);
|
| 115 |
children.push(new CommentRangeStart(cid));
|