Skip to content

Commit 5acefab

Browse files
committed
fix(cache): audit keyed by rawPrompt (input), score keyed by compiled output
Audit checks block presence based on what the user wrote/decomposed → cache key = rawPrompt. Score evaluates the assembled prompt → cache key = currentRaw (compiled output). Semantically aligned.
1 parent b730325 commit 5acefab

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

app/src/components/PromptInput.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ const PromptInput = () => {
9797
if (!isExtension) {
9898
const audit = computeAudit(result.nodes)
9999
setAuditResult(audit)
100-
const key = result.nodes.map(n => n.data.type).sort().join(',')
101-
setAuditCachedKey(key)
100+
setAuditCachedKey(prompt)
102101
}
103102

104103
} catch (e) {
@@ -188,11 +187,10 @@ const PromptInput = () => {
188187
<button
189188
className={`btn btn-primary${auditSeen ? '' : ' btn-audit-pulse'}`}
190189
onClick={() => {
191-
const currentKey = nodes.map(n => n.data.type).sort().join(',')
192-
if (!auditResult || auditCachedKey !== currentKey) {
190+
if (!auditResult || auditCachedKey !== rawPrompt) {
193191
const audit = computeAudit(nodes)
194192
setAuditResult(audit)
195-
setAuditCachedKey(currentKey)
193+
setAuditCachedKey(rawPrompt)
196194
}
197195
setAuditSeen(true)
198196
openAudit(true)

0 commit comments

Comments
 (0)