detox-copilot
Advanced tools
Comparing version 0.0.15 to 0.0.17
@@ -92,7 +92,6 @@ "use strict"; | ||
promptResult = await this.promptHandler.runPrompt(prompt, snapshot); | ||
const result = await this.codeEvaluator.evaluate(promptResult, this.context); | ||
// Cache the result | ||
this.cache.set(cacheKey, promptResult); | ||
this.saveCacheToFile(); | ||
return result; | ||
return await this.codeEvaluator.evaluate(promptResult, this.context); | ||
} | ||
@@ -109,15 +108,9 @@ catch (error) { | ||
}]; | ||
const retryCacheKey = this.generateCacheKey(step, newPrevious, viewHierarchy); | ||
if (this.cache.has(retryCacheKey)) { | ||
const cachedRetryPromptResult = this.cache.get(retryCacheKey); | ||
return this.codeEvaluator.evaluate(cachedRetryPromptResult, this.context); | ||
} | ||
const retryPrompt = this.promptCreator.createPrompt(step, viewHierarchy, isSnapshotImageAttached, newPrevious); | ||
try { | ||
const retryPromptResult = await this.promptHandler.runPrompt(retryPrompt, snapshot); | ||
const retryResult = await this.codeEvaluator.evaluate(retryPromptResult, this.context); | ||
// Cache the result under the original cache key | ||
this.cache.set(cacheKey, retryPromptResult); | ||
this.saveCacheToFile(); | ||
return retryResult; | ||
return await this.codeEvaluator.evaluate(retryPromptResult, this.context); | ||
} | ||
@@ -124,0 +117,0 @@ catch (retryError) { |
@@ -147,3 +147,3 @@ "use strict"; | ||
await expect(stepPerformer.perform(intent)).rejects.toThrow('Evaluation failed'); | ||
expect(fs.writeFileSync).not.toHaveBeenCalled(); // Cache should not be saved | ||
expect(fs.writeFileSync).toHaveBeenCalled(); // Cache should be saved | ||
}); | ||
@@ -150,0 +150,0 @@ it('should use cached prompt result if available', async () => { |
@@ -25,2 +25,3 @@ "use strict"; | ||
"Please generate the minimal executable code to perform the desired intent based on the given information and context.", | ||
"If generating the relevant code is not possible due to ambiguity, invalid intent, or inability to find the desired element, return code that throws an informative error explaining the problem in one sentence.", | ||
"" | ||
@@ -27,0 +28,0 @@ ]; |
{ | ||
"name": "detox-copilot", | ||
"version": "0.0.15", | ||
"version": "0.0.17", | ||
"description": "A flexible plugin that drives your tests with human-written commands, enhanced by the power of large language models (LLMs)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64741
1319