We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 26a26a6 + 69c8094 commit 5ad91c2Copy full SHA for 5ad91c2
1 file changed
index.ts
@@ -149,13 +149,13 @@ export default class TextCompletePlugin extends AdminForthPlugin {
149
content,
150
maxTokens: this.options.expert?.maxTokens ?? 50,
151
});
152
- let suggestion = respContent
+ let suggestion = respContent || '';
153
154
- if (suggestion.startsWith(currentVal)) {
+ if (currentVal && typeof currentVal === 'string' && suggestion.startsWith(currentVal)) {
155
suggestion = suggestion.slice(currentVal.length);
156
}
157
- const wordsList = suggestion.split(' ').map((w, i) => {
158
- return (i === suggestion.split(' ').length - 1) ? w : w + ' ';
+ const wordsList = suggestion.split(' ').map((w, i, arr) => {
+ return (i === arr.length - 1) ? w : w + ' ';
159
160
161
// remove quotes from start and end
0 commit comments