@adminforth/text-complete 1.8.10 → 2.0.1
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/.woodpecker/release.yml +4 -4
- package/dist/index.js +5 -6
- package/index.ts +4 -9
- package/package.json +4 -4
- package/types.ts +0 -4
package/.woodpecker/release.yml
CHANGED
|
@@ -17,18 +17,18 @@ steps:
|
|
|
17
17
|
- infisical export --domain https://vault.devforth.io/api --format=dotenv-export --env="prod" > /woodpecker/deploy.vault.env
|
|
18
18
|
|
|
19
19
|
build:
|
|
20
|
-
image:
|
|
20
|
+
image: devforth/node20-pnpm:latest
|
|
21
21
|
when:
|
|
22
22
|
- event: push
|
|
23
23
|
commands:
|
|
24
24
|
- apt update && apt install -y rsync
|
|
25
25
|
- . /woodpecker/deploy.vault.env
|
|
26
|
-
-
|
|
26
|
+
- pnpm install
|
|
27
27
|
- /bin/bash ./.woodpecker/buildRelease.sh
|
|
28
28
|
- npm audit signatures
|
|
29
29
|
|
|
30
30
|
release:
|
|
31
|
-
image:
|
|
31
|
+
image: devforth/node20-pnpm:latest
|
|
32
32
|
when:
|
|
33
33
|
- event:
|
|
34
34
|
- push
|
|
@@ -36,7 +36,7 @@ steps:
|
|
|
36
36
|
- main
|
|
37
37
|
commands:
|
|
38
38
|
- . /woodpecker/deploy.vault.env
|
|
39
|
-
-
|
|
39
|
+
- pnpm exec semantic-release
|
|
40
40
|
|
|
41
41
|
slack-on-failure:
|
|
42
42
|
image: curlimages/curl
|
package/dist/index.js
CHANGED
|
@@ -67,7 +67,7 @@ export default class TextCompletePlugin extends AdminForthPlugin {
|
|
|
67
67
|
method: 'POST',
|
|
68
68
|
path: `/plugin/${this.pluginInstanceId}/doComplete`,
|
|
69
69
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, headers }) {
|
|
70
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
70
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
71
71
|
if (this.rateLimiter) {
|
|
72
72
|
// rate limit
|
|
73
73
|
// const { error } = RateLimiter.checkRateLimit(
|
|
@@ -97,7 +97,7 @@ export default class TextCompletePlugin extends AdminForthPlugin {
|
|
|
97
97
|
content = `Continue writing for text/string field "${fieldLabel}" in the table "${resLabel}"\n` +
|
|
98
98
|
(Object.keys(recordNoField).length > 0 ? `Record has values for the context: ${inputContext}\n` : '') +
|
|
99
99
|
`Current field value: ${currentVal}\n` +
|
|
100
|
-
"Don't talk to me. Just write text. No quotes. Don't repeat current field value, just write completion\n";
|
|
100
|
+
"Don't talk to me. Just write text. No quotes. Don't repeat current field value, just write completion. Stop generating when you finish the sentence. DO NOT GENERATE AFTER GENERATED FIRST \".\"\n";
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
103
|
if (this.options.initialPrompt) {
|
|
@@ -116,13 +116,12 @@ export default class TextCompletePlugin extends AdminForthPlugin {
|
|
|
116
116
|
else {
|
|
117
117
|
content = `Fill text/string field "${fieldLabel}" in the table "${resLabel}"\n` +
|
|
118
118
|
(Object.keys(recordNoField).length > 0 ? `Record has values for the context: ${inputContext}\n` : '') +
|
|
119
|
-
"Be short, clear and precise. No quotes. Don't talk to me. Just write text\n";
|
|
119
|
+
"Be short, clear and precise. No quotes. Don't talk to me. Just write text. Stop generating when you finish the sentence. DO NOT GENERATE AFTER YOU GENERATED FIRST\".\"\n";
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
process.env.HEAVY_DEBUG && console.log('🪲 OpenAI Prompt 🧠', content);
|
|
123
|
-
const { content: respContent
|
|
124
|
-
|
|
125
|
-
let suggestion = respContent + (finishReason === 'stop' ? (stop[0] === '.' && stop.length === 1 && this.columnType === AdminForthDataTypes.TEXT ? '. ' : '') : '');
|
|
123
|
+
const { content: respContent } = yield this.options.adapter.complete(content, [], (_l = this.options.expert) === null || _l === void 0 ? void 0 : _l.maxTokens);
|
|
124
|
+
let suggestion = respContent;
|
|
126
125
|
if (suggestion.startsWith(currentVal)) {
|
|
127
126
|
suggestion = suggestion.slice(currentVal.length);
|
|
128
127
|
}
|
package/index.ts
CHANGED
|
@@ -122,7 +122,7 @@ export default class TextCompletePlugin extends AdminForthPlugin {
|
|
|
122
122
|
content = `Continue writing for text/string field "${fieldLabel}" in the table "${resLabel}"\n` +
|
|
123
123
|
(Object.keys(recordNoField).length > 0 ? `Record has values for the context: ${inputContext}\n` : '') +
|
|
124
124
|
`Current field value: ${currentVal}\n` +
|
|
125
|
-
"Don't talk to me. Just write text. No quotes. Don't repeat current field value, just write completion\n";
|
|
125
|
+
"Don't talk to me. Just write text. No quotes. Don't repeat current field value, just write completion. Stop generating when you finish the sentence. DO NOT GENERATE AFTER GENERATED FIRST \".\"\n";
|
|
126
126
|
} else {
|
|
127
127
|
if (this.options.initialPrompt) {
|
|
128
128
|
const regex = /{{([^}]+)}}/g;
|
|
@@ -140,18 +140,13 @@ export default class TextCompletePlugin extends AdminForthPlugin {
|
|
|
140
140
|
} else {
|
|
141
141
|
content = `Fill text/string field "${fieldLabel}" in the table "${resLabel}"\n` +
|
|
142
142
|
(Object.keys(recordNoField).length > 0 ? `Record has values for the context: ${inputContext}\n` : '') +
|
|
143
|
-
"Be short, clear and precise. No quotes. Don't talk to me. Just write text\n";
|
|
143
|
+
"Be short, clear and precise. No quotes. Don't talk to me. Just write text. Stop generating when you finish the sentence. DO NOT GENERATE AFTER YOU GENERATED FIRST\".\"\n";
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
process.env.HEAVY_DEBUG && console.log('🪲 OpenAI Prompt 🧠', content);
|
|
148
|
-
const { content: respContent
|
|
149
|
-
|
|
150
|
-
let suggestion = respContent + (
|
|
151
|
-
finishReason === 'stop' ? (
|
|
152
|
-
stop[0] === '.' && stop.length === 1 && this.columnType === AdminForthDataTypes.TEXT ? '. ' : ''
|
|
153
|
-
) : ''
|
|
154
|
-
);
|
|
148
|
+
const { content: respContent } = await this.options.adapter.complete(content, [], this.options.expert?.maxTokens);
|
|
149
|
+
let suggestion = respContent
|
|
155
150
|
|
|
156
151
|
if (suggestion.startsWith(currentVal)) {
|
|
157
152
|
suggestion = suggestion.slice(currentVal.length);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/text-complete",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Text completion plugin for adminforth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://adminforth.dev/docs/tutorial/Plugins/text-complete/",
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "tsc && rsync -av --exclude 'node_modules' custom dist/"
|
|
14
|
-
"prepare": "npm link adminforth"
|
|
13
|
+
"build": "tsc && rsync -av --exclude 'node_modules' custom dist/"
|
|
15
14
|
},
|
|
16
15
|
"repository": {
|
|
17
16
|
"type": "git",
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
[
|
|
39
38
|
"semantic-release-slack-bot",
|
|
40
39
|
{
|
|
40
|
+
"packageName": "@adminforth/text-complete",
|
|
41
41
|
"notifyOnSuccess": true,
|
|
42
42
|
"notifyOnFail": true,
|
|
43
43
|
"slackIcon": ":package:",
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"adminforth": "
|
|
57
|
+
"adminforth": "^2.24.0"
|
|
58
58
|
}
|
|
59
59
|
}
|