@adminforth/text-complete 1.1.2 → 1.2.0
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/build.log +1 -1
- package/dist/index.js +9 -3
- package/index.ts +9 -3
- package/package.json +1 -1
- package/types.ts +11 -0
package/build.log
CHANGED
package/dist/index.js
CHANGED
|
@@ -91,9 +91,15 @@ export default class TextCompletePlugin extends AdminForthPlugin {
|
|
|
91
91
|
"Don't talk to me. Just write text. No quotes. Don't repeat current field value, just write completion\n";
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
if (this.options.initialPrompt) {
|
|
95
|
+
content = `${this.options.initialPrompt}\n` +
|
|
96
|
+
"No quotes. Don't talk to me. Just write text\n";
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
content = `Fill text/string field "${this.options.fieldName}" in the table "${resLabel}"\n` +
|
|
100
|
+
(Object.keys(recordNoField).length > 0 ? `Record has values for the context: ${inputContext}\n` : '') +
|
|
101
|
+
"Be short, clear and precise. No quotes. Don't talk to me. Just write text\n";
|
|
102
|
+
}
|
|
97
103
|
}
|
|
98
104
|
process.env.HEAVY_DEBUG && console.log('🪲 OpenAI Prompt 🧠', content);
|
|
99
105
|
const { content: respContent, finishReason } = yield this.options.adapter.complete(content, (_l = this.options.expert) === null || _l === void 0 ? void 0 : _l.stop, (_m = this.options.expert) === null || _m === void 0 ? void 0 : _m.maxTokens);
|
package/index.ts
CHANGED
|
@@ -119,9 +119,15 @@ export default class TextCompletePlugin extends AdminForthPlugin {
|
|
|
119
119
|
"Don't talk to me. Just write text. No quotes. Don't repeat current field value, just write completion\n";
|
|
120
120
|
|
|
121
121
|
} else {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
|
|
123
|
+
if (this.options.initialPrompt) {
|
|
124
|
+
content = `${this.options.initialPrompt}\n` +
|
|
125
|
+
"No quotes. Don't talk to me. Just write text\n";
|
|
126
|
+
} else {
|
|
127
|
+
content = `Fill text/string field "${this.options.fieldName}" in the table "${resLabel}"\n` +
|
|
128
|
+
(Object.keys(recordNoField).length > 0 ? `Record has values for the context: ${inputContext}\n` : '') +
|
|
129
|
+
"Be short, clear and precise. No quotes. Don't talk to me. Just write text\n";
|
|
130
|
+
}
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
process.env.HEAVY_DEBUG && console.log('🪲 OpenAI Prompt 🧠', content);
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -6,6 +6,16 @@ export interface PluginOptions {
|
|
|
6
6
|
*/
|
|
7
7
|
fieldName: string;
|
|
8
8
|
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Initial prompt request when field is empty. Mustache syntax for record context fields is supported.
|
|
12
|
+
* E.g.
|
|
13
|
+
* 'I need to introduce "{{ name }}" technology to my software development company website, I need short but very attractive description if it.'
|
|
14
|
+
*
|
|
15
|
+
* Where `name` is a field name which contains technology name e.g. Vue.js
|
|
16
|
+
*/
|
|
17
|
+
initialPrompt?: string;
|
|
18
|
+
|
|
9
19
|
/**
|
|
10
20
|
* Expert settings
|
|
11
21
|
*/
|
|
@@ -21,6 +31,7 @@ export interface PluginOptions {
|
|
|
21
31
|
*/
|
|
22
32
|
debounceTime?: number;
|
|
23
33
|
|
|
34
|
+
|
|
24
35
|
/**
|
|
25
36
|
* When completion is made, this plugin passes non-empty fields of the record to the LLM model for record context understanding.
|
|
26
37
|
*/
|