Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tts-ranking
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
audio
tts-ranking
Commits
dc82aeef
Commit
dc82aeef
authored
Jul 11, 2026
by
程裕兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(luna-tts): add Luna TTS vote counter, fix Stop button, fix daily limit auto-stop
parent
1abd0ae9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
2 deletions
+14
-2
extension/content.js
+4
-1
extension/popup/popup.html
+1
-0
extension/popup/popup.js
+3
-0
server/native_host.py
+6
-1
No files found.
extension/content.js
View file @
dc82aeef
...
...
@@ -332,9 +332,11 @@
}
}
if
(
!
enabled
)
return
;
// stopped during listening/matching
if
(
finalDecision
===
'vote_left'
)
{
_updateBanner
(
'🗳️ 投票: 左侧...'
);
_captureRevealAndVerify
(
result
,
'left'
);
if
(
!
enabled
)
return
;
// stopped before voting
const
v
=
await
simulateVote
(
'left'
);
if
(
!
v
.
success
)
{
_updateBanner
(
'❌ 投票未确认,刷新重试...'
);
await
delay
(
3000
);
location
.
reload
();
return
;
}
_updateBanner
(
`🗳️ 投左侧 ✓
${
finalDecision
!==
result
.
decision
?
' [手动]'
:
''
}
`
);
...
...
@@ -381,7 +383,8 @@
}
function
scheduleNextVote
()
{
voteTimerId
=
setTimeout
(
doVote
,
1000
);
// minimal delay, page naturally loads next audio
if
(
!
enabled
)
return
;
// stopped — don't schedule next cycle
voteTimerId
=
setTimeout
(
doVote
,
1000
);
}
// ---- Work/rest cycle ----
...
...
extension/popup/popup.html
View file @
dc82aeef
...
...
@@ -29,6 +29,7 @@
</div>
<div
class=
"row"
><span
class=
"label"
>
Server
</span><span
class=
"value"
id=
"serverStatus"
>
—
</span></div>
<div
class=
"row"
><span
class=
"label"
>
Luna TTS
</span><span
class=
"value"
id=
"lunaVotes"
>
0
</span></div>
<div
class=
"row"
><span
class=
"label"
>
Today votes
</span><span
class=
"value"
id=
"todayVotes"
>
0 / 800
</span></div>
<div
class=
"row"
><span
class=
"label"
>
Today skips
</span><span
class=
"value"
id=
"todaySkips"
>
0
</span></div>
...
...
extension/popup/popup.js
View file @
dc82aeef
...
...
@@ -7,6 +7,7 @@ const dot = document.getElementById('dot');
const
serverStatus
=
document
.
getElementById
(
'serverStatus'
);
const
todayVotes
=
document
.
getElementById
(
'todayVotes'
);
const
todaySkips
=
document
.
getElementById
(
'todaySkips'
);
const
lunaVotes
=
document
.
getElementById
(
'lunaVotes'
);
const
log
=
document
.
getElementById
(
'log'
);
let
tabId
=
null
;
...
...
@@ -41,6 +42,7 @@ async function refreshState() {
chrome
.
runtime
.
sendMessage
({
type
:
'get_state'
},
(
state
)
=>
{
updateUI
(
state
);
if
(
state
.
today_votes
!==
undefined
)
{
lunaVotes
.
textContent
=
state
.
luna_votes
||
0
;
todayVotes
.
textContent
=
`
${
state
.
today_votes
}
/
${
state
.
daily_limit
||
800
}
`
;
todaySkips
.
textContent
=
state
.
today_skips
||
0
;
}
...
...
@@ -91,6 +93,7 @@ chrome.runtime.onMessage.addListener((message) => {
if
(
message
.
type
===
'from_server'
)
{
const
payload
=
message
.
payload
;
if
(
payload
.
stats
)
{
lunaVotes
.
textContent
=
payload
.
stats
.
luna_votes
||
0
;
todayVotes
.
textContent
=
`
${
payload
.
stats
.
today_votes
}
/
${
payload
.
stats
.
daily_limit
}
`
;
todaySkips
.
textContent
=
payload
.
stats
.
today_skips
;
}
...
...
server/native_host.py
View file @
dc82aeef
...
...
@@ -96,6 +96,7 @@ def main():
today_votes
=
0
today_skips
=
0
luna_votes
=
0
_write_status
(
"ready"
,
f
"Models loaded, {today_votes} votes today"
)
_log_stderr
(
"[host] Ready, waiting for messages..."
)
...
...
@@ -169,6 +170,10 @@ def main():
today_skips
+=
1
else
:
today_votes
+=
1
# Count Luna TTS votes (top match from "our" library)
if
(
decision_obj
.
action
==
"vote_left"
and
left_side
.
top_library
==
"our"
)
or
\
(
decision_obj
.
action
==
"vote_right"
and
right_side
.
top_library
==
"our"
):
luna_votes
+=
1
needs_review
=
(
left_side
.
our_score
>=
OUR_THRESHOLD
and
right_side
.
our_score
>=
OUR_THRESHOLD
and
...
...
@@ -183,7 +188,7 @@ def main():
"left"
:
{
**
left_result
.
to_dict
(),
"top_match"
:
{
"speaker"
:
left_side
.
top_speaker
,
"score"
:
left_side
.
top_score
,
"library"
:
left_side
.
top_library
}},
"right"
:
{
**
right_result
.
to_dict
(),
"top_match"
:
{
"speaker"
:
right_side
.
top_speaker
,
"score"
:
right_side
.
top_score
,
"library"
:
right_side
.
top_library
}},
},
"stats"
:
{
"today_votes"
:
today_votes
,
"today_skips"
:
today_skips
,
"daily_limit"
:
DAILY_VOTE_LIMIT
},
"stats"
:
{
"today_votes"
:
today_votes
,
"today_skips"
:
today_skips
,
"
luna_votes"
:
luna_votes
,
"
daily_limit"
:
DAILY_VOTE_LIMIT
},
}
_write_status
(
"ready"
,
f
"Votes: {today_votes}, Skips: {today_skips}"
)
send_message
(
response
)
...
...
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