Skip to content

Commit c73915e

Browse files
authored
EditAttention: allow negatives (#476)
for #474
1 parent 7626d08 commit c73915e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/extensions/core/editAttention.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ app.registerExtension({
2121
const floatWeight = parseFloat(weight)
2222
if (isNaN(floatWeight)) return weight
2323
const newWeight = floatWeight + delta
24-
if (newWeight < 0) return '0'
2524
return String(Number(newWeight.toFixed(10)))
2625
}
2726

@@ -143,7 +142,7 @@ app.registerExtension({
143142
// Increment the weight
144143
const weightDelta = event.key === 'ArrowUp' ? delta : -delta
145144
const updatedText = selectedText.replace(
146-
/\((.*):(\d+(?:\.\d+)?)\)/,
145+
/\((.*):([+-]?\d+(?:\.\d+)?)\)/,
147146
(match, text, weight) => {
148147
weight = incrementWeight(weight, weightDelta)
149148
if (weight == 1) {

0 commit comments

Comments
 (0)