codecritique 1.2.3 → 2.0.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/README.md +3 -3
- package/package.json +22 -20
- package/src/content-retrieval.js +109 -161
- package/src/content-retrieval.test.js +49 -9
- package/src/custom-documents.js +29 -14
- package/src/feedback-loader.js +19 -8
- package/src/index.js +97 -48
- package/src/llm.js +7 -3
- package/src/project-analyzer.js +92 -26
- package/src/rag-analyzer.js +70 -34
- package/src/rag-analyzer.test.js +12 -1
- package/src/rag-review.js +14 -7
- package/src/zero-shot-classifier-open.js +16 -7
|
@@ -105,7 +105,9 @@ class OpenZeroShotClassifier {
|
|
|
105
105
|
*/
|
|
106
106
|
async initialize() {
|
|
107
107
|
// If already initialized, return immediately
|
|
108
|
-
if (this.isInitialized)
|
|
108
|
+
if (this.isInitialized) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
109
111
|
|
|
110
112
|
// If currently initializing, wait for the existing initialization
|
|
111
113
|
if (this.initializationPromise) {
|
|
@@ -117,7 +119,8 @@ class OpenZeroShotClassifier {
|
|
|
117
119
|
|
|
118
120
|
try {
|
|
119
121
|
await this.initializationPromise;
|
|
120
|
-
}
|
|
122
|
+
}
|
|
123
|
+
finally {
|
|
121
124
|
// Clean up the promise after initialization (success or failure)
|
|
122
125
|
this.initializationPromise = null;
|
|
123
126
|
}
|
|
@@ -133,7 +136,8 @@ class OpenZeroShotClassifier {
|
|
|
133
136
|
|
|
134
137
|
this.isInitialized = true;
|
|
135
138
|
verboseLog({}, '✓ Open-ended zero-shot classifier initialized successfully');
|
|
136
|
-
}
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
137
141
|
console.error('Error initializing classifier:', error);
|
|
138
142
|
this.isInitialized = false;
|
|
139
143
|
throw error;
|
|
@@ -174,7 +178,8 @@ class OpenZeroShotClassifier {
|
|
|
174
178
|
for (const value of Object.values(obj)) {
|
|
175
179
|
if (Array.isArray(value)) {
|
|
176
180
|
value.forEach((tech) => techs.add(tech.toLowerCase()));
|
|
177
|
-
}
|
|
181
|
+
}
|
|
182
|
+
else if (typeof value === 'object') {
|
|
178
183
|
addTechsFromObject(value);
|
|
179
184
|
}
|
|
180
185
|
}
|
|
@@ -234,7 +239,9 @@ class OpenZeroShotClassifier {
|
|
|
234
239
|
const word = words[i].replace(/[.,;:!?'"()[\]{}]/g, '');
|
|
235
240
|
|
|
236
241
|
// Skip if it's a common word
|
|
237
|
-
if (this.commonWords.has(word.toLowerCase()))
|
|
242
|
+
if (this.commonWords.has(word.toLowerCase())) {
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
238
245
|
|
|
239
246
|
// Check if word is capitalized and not at sentence start
|
|
240
247
|
if (i > 0 && /^[A-Z][a-zA-Z]+/.test(word) && word.length > 2 && word.length < 20) {
|
|
@@ -302,7 +309,8 @@ class OpenZeroShotClassifier {
|
|
|
302
309
|
|
|
303
310
|
this.cache.set(cacheKey, classifications);
|
|
304
311
|
return classifications;
|
|
305
|
-
}
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
306
314
|
console.error('Error in technology classification:', error);
|
|
307
315
|
return [];
|
|
308
316
|
}
|
|
@@ -368,7 +376,8 @@ class OpenZeroShotClassifier {
|
|
|
368
376
|
|
|
369
377
|
this.cache.set(cacheKey, classifications);
|
|
370
378
|
return classifications;
|
|
371
|
-
}
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
372
381
|
console.error('Error in domain classification:', error);
|
|
373
382
|
return [];
|
|
374
383
|
}
|