Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
98ae4bbf
Unverified
Commit
98ae4bbf
authored
Apr 20, 2023
by
missionfloyd
Committed by
GitHub
Apr 20, 2023
Browse files
Remove brackets if weight == 1
parent
0be92710
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
web/extensions/core/editAttention.js
web/extensions/core/editAttention.js
+7
-2
No files found.
web/extensions/core/editAttention.js
View file @
98ae4bbf
...
@@ -128,8 +128,13 @@ app.registerExtension({
...
@@ -128,8 +128,13 @@ app.registerExtension({
// Increment the weight
// Increment the weight
const
weightDelta
=
event
.
key
===
"
ArrowUp
"
?
delta
:
-
delta
;
const
weightDelta
=
event
.
key
===
"
ArrowUp
"
?
delta
:
-
delta
;
const
updatedText
=
selectedText
.
replace
(
/
(
.*:
)(\d
+
(\.\d
+
)?)(
.*
)
/
,
(
match
,
prefix
,
weight
,
_
,
suffix
)
=>
{
const
updatedText
=
selectedText
.
replace
(
/
\((
.*
)
:
(\d
+
(?:\.\d
+
)?)\)
/
,
(
match
,
text
,
weight
)
=>
{
return
prefix
+
incrementWeight
(
weight
,
weightDelta
)
+
suffix
;
weight
=
incrementWeight
(
weight
,
weightDelta
);
if
(
weight
==
1
)
{
return
text
;
}
else
{
return
`(
${
text
}
:
${
weight
}
)`
;
}
});
});
inputField
.
setRangeText
(
updatedText
,
start
,
end
,
"
select
"
);
inputField
.
setRangeText
(
updatedText
,
start
,
end
,
"
select
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment