detox-copilot
Advanced tools
Comparing version 0.0.20 to 0.0.21
@@ -85,14 +85,17 @@ "use strict"; | ||
const cacheKey = this.generateCacheKey(step, previous, viewHierarchy); | ||
if (this.cache.has(cacheKey)) { | ||
const cachedCode = this.cache.get(cacheKey); | ||
return this.codeEvaluator.evaluate(cachedCode, this.context); | ||
} | ||
const prompt = this.promptCreator.createPrompt(step, viewHierarchy, isSnapshotImageAttached, previous); | ||
let code = undefined; | ||
try { | ||
const promptResult = await this.promptHandler.runPrompt(prompt, snapshot); | ||
code = (0, extractCodeBlock_1.extractCodeBlock)(promptResult); | ||
// Cache the result | ||
this.cache.set(cacheKey, code); | ||
this.saveCacheToFile(); | ||
if (this.cache.has(cacheKey)) { | ||
code = this.cache.get(cacheKey); | ||
} | ||
else { | ||
const prompt = this.promptCreator.createPrompt(step, viewHierarchy, isSnapshotImageAttached, previous); | ||
const promptResult = await this.promptHandler.runPrompt(prompt, snapshot); | ||
code = (0, extractCodeBlock_1.extractCodeBlock)(promptResult); | ||
this.cache.set(cacheKey, code); | ||
this.saveCacheToFile(); | ||
} | ||
if (!code) { | ||
throw new Error('Failed to generate code from intent'); | ||
} | ||
return await this.codeEvaluator.evaluate(code, this.context); | ||
@@ -99,0 +102,0 @@ } |
{ | ||
"name": "detox-copilot", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"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
65736
1338