seeemess 1.0.11 → 1.0.12
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/admin/routes/posts.js +10 -2
- package/admin/routes/synopsis.js +2 -2
- package/admin/utils/markdown.js +14 -2
- package/package.json +1 -1
package/admin/routes/posts.js
CHANGED
|
@@ -72,6 +72,9 @@ router.post('/set-lede/*', (req, res) => {
|
|
|
72
72
|
if (itemSection === section && itemFm.lede) {
|
|
73
73
|
const { frontmatter: fm, body: bd } = parseFrontmatterAndBody(itemContent);
|
|
74
74
|
delete fm.lede;
|
|
75
|
+
const knownKeys = ['title','synopsis','date','tags','image','imageCaption','imageCredit','imageFocalX','imageFocalY','author','gallery','images','showGallery','lede','status'];
|
|
76
|
+
const customFields = {};
|
|
77
|
+
Object.keys(fm).forEach(k => { if (!knownKeys.includes(k)) customFields[k] = fm[k]; });
|
|
75
78
|
const updatedContent = buildMarkdown({
|
|
76
79
|
title: fm.title,
|
|
77
80
|
synopsis: fm.synopsis,
|
|
@@ -86,7 +89,8 @@ router.post('/set-lede/*', (req, res) => {
|
|
|
86
89
|
gallery: fm.gallery,
|
|
87
90
|
showGallery: fm.showGallery,
|
|
88
91
|
status: fm.status,
|
|
89
|
-
lede: false
|
|
92
|
+
lede: false,
|
|
93
|
+
customFields
|
|
90
94
|
}, bd);
|
|
91
95
|
fs.writeFileSync(itemFullPath, updatedContent);
|
|
92
96
|
}
|
|
@@ -97,6 +101,9 @@ router.post('/set-lede/*', (req, res) => {
|
|
|
97
101
|
clearLedeInSection(getContentDir());
|
|
98
102
|
|
|
99
103
|
// Set lede on the target post
|
|
104
|
+
const knownKeys = ['title','synopsis','date','tags','image','imageCaption','imageCredit','imageFocalX','imageFocalY','author','gallery','images','showGallery','lede','status'];
|
|
105
|
+
const customFields = {};
|
|
106
|
+
Object.keys(frontmatter).forEach(k => { if (!knownKeys.includes(k)) customFields[k] = frontmatter[k]; });
|
|
100
107
|
const updatedContent = buildMarkdown({
|
|
101
108
|
title: frontmatter.title,
|
|
102
109
|
synopsis: frontmatter.synopsis,
|
|
@@ -111,7 +118,8 @@ router.post('/set-lede/*', (req, res) => {
|
|
|
111
118
|
gallery: frontmatter.gallery,
|
|
112
119
|
showGallery: frontmatter.showGallery,
|
|
113
120
|
status: frontmatter.status,
|
|
114
|
-
lede: true
|
|
121
|
+
lede: true,
|
|
122
|
+
customFields
|
|
115
123
|
}, body);
|
|
116
124
|
fs.writeFileSync(fullPath, updatedContent);
|
|
117
125
|
|
package/admin/routes/synopsis.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Router } from 'express';
|
|
|
2
2
|
|
|
3
3
|
const router = Router();
|
|
4
4
|
|
|
5
|
-
// Generate synopsis using Ollama (llama3)
|
|
5
|
+
// Generate synopsis using Ollama (llama3.1)
|
|
6
6
|
router.post('/', async (req, res) => {
|
|
7
7
|
const { title, body } = req.body;
|
|
8
8
|
if (!title && !body) {
|
|
@@ -17,7 +17,7 @@ router.post('/', async (req, res) => {
|
|
|
17
17
|
method: 'POST',
|
|
18
18
|
headers: { 'Content-Type': 'application/json' },
|
|
19
19
|
body: JSON.stringify({
|
|
20
|
-
model: 'llama3',
|
|
20
|
+
model: 'llama3.1',
|
|
21
21
|
prompt: prompt,
|
|
22
22
|
stream: false
|
|
23
23
|
})
|
package/admin/utils/markdown.js
CHANGED
|
@@ -137,15 +137,27 @@ export function buildMarkdown(fm, body) {
|
|
|
137
137
|
if (fm.lede === true) lines.push('lede: true');
|
|
138
138
|
if (fm.status) lines.push('status: ' + fm.status);
|
|
139
139
|
|
|
140
|
-
// Handle custom fields
|
|
140
|
+
// Handle custom fields from customFields object
|
|
141
141
|
if (fm.customFields && typeof fm.customFields === 'object') {
|
|
142
142
|
Object.entries(fm.customFields).forEach(([key, value]) => {
|
|
143
|
-
if (value) {
|
|
143
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
144
144
|
lines.push(key + ': "' + String(value).replace(/"/g, '\\"') + '"');
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
// Preserve any unknown top-level frontmatter keys (e.g. location, age, dream)
|
|
150
|
+
const knownKeys = ['title','synopsis','date','tags','image','imageCaption','imageCredit','imageFocalX','imageFocalY','author','gallery','images','showGallery','lede','status','customFields'];
|
|
151
|
+
Object.entries(fm).forEach(([key, value]) => {
|
|
152
|
+
if (!knownKeys.includes(key) && value !== undefined && value !== null && value !== '') {
|
|
153
|
+
// Skip if already written via customFields
|
|
154
|
+
const alreadyWritten = fm.customFields && typeof fm.customFields === 'object' && key in fm.customFields;
|
|
155
|
+
if (!alreadyWritten) {
|
|
156
|
+
lines.push(key + ': "' + String(value).replace(/"/g, '\\"') + '"');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
149
161
|
lines.push('---');
|
|
150
162
|
return lines.join('\n') + '\n\n' + body;
|
|
151
163
|
}
|