Skip to content

Commit 4334f33

Browse files
author
yaroslav8765
committed
fix: improve label handling in content generation for text fields
1 parent 1e07a12 commit 4334f33

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,19 +300,18 @@ export default class RichEditorPlugin extends AdminForthPlugin {
300300
currentVal = currentVal.slice(-promptLimit);
301301
}
302302

303-
//const resLabel = this.resourceConfig!.label;
304-
const fieldLabel = this.resourceConfig?.columns.find(c => c.name === this.options.htmlFieldName)?.label || this.options.htmlFieldName;
305-
const resourceLabel = this.resourceConfig?.label || this.resourceConfig?.resourceId;
306-
303+
const resLabel = this.resourceConfig?.label;
304+
307305
let content;
308-
306+
309307
if (currentVal) {
310-
content = `Continue writing for text/string field "${fieldLabel}" in the table "${resourceLabel}"\n` +
308+
content = `Continue writing for text/string field "${this.options.htmlFieldName}"${resLabel ? " in the table " + resLabel : ""} \n` +
311309
(Object.keys(recordNoField).length > 0 ? `Record has values for the context: ${inputContext}\n` : '') +
312310
`Current field value: ${currentVal}\n` +
313311
"Don't talk to me. Just write text. No quotes. Don't repeat current field value, just write completion\n";
312+
314313
} else {
315-
content = `Fill text/string field "${fieldLabel}" in the table "${resourceLabel}"\n` +
314+
content = `Fill text/string field "${this.options.htmlFieldName}"${resLabel ? " in the table " + resLabel : ""}\n` +
316315
(Object.keys(recordNoField).length > 0 ? `Record has values for the context: ${inputContext}\n` : '') +
317316
"Be short, clear and precise. No quotes. Don't talk to me. Just write text\n";
318317
}

0 commit comments

Comments
 (0)