@adminforth/text-complete 2.0.11 → 2.0.13

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 CHANGED
@@ -10,5 +10,5 @@ custom/package.json
10
10
  custom/pnpm-lock.yaml
11
11
  custom/tsconfig.json
12
12
 
13
- sent 31,440 bytes received 115 bytes 21,036.67 bytes/sec
13
+ sent 31,440 bytes received 115 bytes 63,110.00 bytes/sec
14
14
  total size is 31,014 speedup is 0.98
package/dist/index.js CHANGED
@@ -124,12 +124,12 @@ export default class TextCompletePlugin extends AdminForthPlugin {
124
124
  content,
125
125
  maxTokens: (_m = (_l = this.options.expert) === null || _l === void 0 ? void 0 : _l.maxTokens) !== null && _m !== void 0 ? _m : 50,
126
126
  });
127
- let suggestion = respContent;
128
- if (suggestion.startsWith(currentVal)) {
127
+ let suggestion = respContent || '';
128
+ if (currentVal && typeof currentVal === 'string' && suggestion.startsWith(currentVal)) {
129
129
  suggestion = suggestion.slice(currentVal.length);
130
130
  }
131
- const wordsList = suggestion.split(' ').map((w, i) => {
132
- return (i === suggestion.split(' ').length - 1) ? w : w + ' ';
131
+ const wordsList = suggestion.split(' ').map((w, i, arr) => {
132
+ return (i === arr.length - 1) ? w : w + ' ';
133
133
  });
134
134
  // remove quotes from start and end
135
135
  return {
package/index.ts CHANGED
@@ -149,13 +149,13 @@ export default class TextCompletePlugin extends AdminForthPlugin {
149
149
  content,
150
150
  maxTokens: this.options.expert?.maxTokens ?? 50,
151
151
  });
152
- let suggestion = respContent
152
+ let suggestion = respContent || '';
153
153
 
154
- if (suggestion.startsWith(currentVal)) {
154
+ if (currentVal && typeof currentVal === 'string' && suggestion.startsWith(currentVal)) {
155
155
  suggestion = suggestion.slice(currentVal.length);
156
156
  }
157
- const wordsList = suggestion.split(' ').map((w, i) => {
158
- return (i === suggestion.split(' ').length - 1) ? w : w + ' ';
157
+ const wordsList = suggestion.split(' ').map((w, i, arr) => {
158
+ return (i === arr.length - 1) ? w : w + ' ';
159
159
  });
160
160
 
161
161
  // remove quotes from start and end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/text-complete",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "Text completion plugin for adminforth",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
26
  "@types/node": "^22.10.7",
27
- "adminforth": "^2.42.0",
27
+ "adminforth": "^2.50.0",
28
28
  "semantic-release": "^24.2.1",
29
29
  "semantic-release-slack-bot": "^4.0.2",
30
30
  "typescript": "^5.7.3"
@@ -55,6 +55,6 @@
55
55
  ]
56
56
  },
57
57
  "peerDependencies": {
58
- "adminforth": "^2.42.0"
58
+ "adminforth": "^2.50.0"
59
59
  }
60
60
  }