Skip to content

Commit

Permalink
Merge pull request #589 from Ikaros-521/fataldemon-tendou_arisu
Browse files Browse the repository at this point in the history
延长聊天页 按键监听时长为0.5s,降低误触概率;美化注释
  • Loading branch information
Ikaros-521 committed Jan 25, 2024
2 parents 54acdd6 + b286306 commit 084244f
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 11 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion talk.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def start_server():
logging.error("程序初始化失败!")
exit(0)

cooldown = 0.3 # 冷却时间 0.3 秒
# 冷却时间 0.5 秒
cooldown = 0.5
last_pressed = 0

# HTTP API线程
Expand Down
16 changes: 15 additions & 1 deletion utils/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,21 @@ def stop_current_audio(self):
Audio.mixer_normal.music.fadeout(1000)

"""
文案板块
./@\]
,@@@@\* \@@^ ,]]]
[[[* /@@]@@@@@/[[\@@@@/
]]@@@@@@\ /@@^ @@@^]]`[[
]]@@@@@@@[[* ,[` /@@\@@@@@@@@@@@@@@^
[[[[[` @@@/ \@@@@[[[\@@^ =@@/
.\@@\* *@@@` [\@@@@@@\`
,@@\=@@@ ,]@@@/` ,\@@@@*
,@@@@` ,[[[[` =@@@ ]]/O
/@@@@@` ]]]@@@@@@@@@/[[[[[`
,@@@@[ \@@@\` ./@@@@@@@]
,]/@@@@/` \@@@@@\]] ,@@@/,@@^ \@@@\]
,@@@@@@@@/[* ,/@@/* /@@^ [@@@@@@@\*
,@@^
"""
# 延时执行恢复文案播放
def delayed_execution_unpause_copywriting_play(self):
Expand Down
72 changes: 67 additions & 5 deletions utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,21 @@ def get_random_value(self, lower_limit, upper_limit):


"""
文本操作
.,]` ]]]` ,]]` .` .]`
,@@@@ @@@^ =@@^ .@@@@@@@@@@@@^ /@@@ /@@@
=@@@@@@@@@@@@@@@@@@@@@@^ O@@@@@@@@@@@@@@@@@@@@@ ..=@@\...@@@]]]]]]/@@^ =@@@` =@@@@@@@@@@@@@\
=@@@@@@@@@@@@@@@@@@@@@@^ O@@@@@@@@@@@@@@@@@@@@@ =@@@@@@^.@@@@@@@@@@@@^ ,@@@^ ,@@@@@@@@@@@@@@@
=@@@^ /@@@^ /@@@@@@\ =@@^ .@@@@@@O.@@@@@@@ ,@@@@^=@@@^=@@@.
=@@@^ =@@@/ ,@@@@@@@@@@` =@@^..@@^.@@@.@@^.@@@ ,@@@@@^\@@` =@@@@@@@@@^
\@@@\ ./@@@/ ,@@@@`@@@^.@@@@` /@@@@@@*@@@@@@@.@@@@@@@ =@@@@@^ \. =@@@@@@@@@^
,@@@@@@@@` ,@@@@/ @@@^ =@@@@] =@@@@/` =@@O .@.@@@^ =@@@.
]@@@@@@` =@@@@@]]]]@@@\]]]]@@@@@^ =@@^ @@@@@@@@@@@@@@@@^ @@@^ =@@@@@@@@@@
,/@@@@@@@@@@@@\` ,@/.=@@@@@@@@@@@@^ \/. =@@^ ,@@@@@@@@] @@@^ =@@@@@@@@@@
=@@@@@@@@/. .\@@@@@@@@` @@@^ ,]/@@^,/@@@@`=@@@.\@@@@` @@@^ =@@@.
,@@@/` ,\@@/. @@@^ =@@@@` ,@[. =@@@ ,\` @@@^ =@@@.
"""

# 删除多余单词
Expand Down Expand Up @@ -522,7 +536,16 @@ def dynamic_variable_replacement(self, template, data_json):


"""
文本操作-路径、文件名相关
.@@@ @@@ @@^ =@@@@@@@@ /@@ /@@ =@@@@@*,@@\]]]] ,@@@@@@@@@@@@* .@@@ @@/.\]`@@@ =@@\]]]]]]] =@@..@@@@@@@@@ =@@\ /@@^
*@@@@@@@@@@@@@@@*=@@@@@@@@@@@@@@.@@@@@=@@@@@@@@ =@@`=@@@@@@@@@^ =@/[@@@@@@@@@@/.@@@` .]@@/ *@@@@@@@@@@@@@@@* =@@.=@@]@@@]]]. ,@@@@@@@@@@@@ ,@@@@@@@@/[[[\@@ =@@@@@@@@@@@@@^
=@@` ,@@^ .@@@@@. @@^=@@@@^@@@@@ =@@@=@@`@@^ =@@@@@,[@@@@@/ \/,@@`]/@@@@@] =@@` ,@@^ ,@@@,@@@@@@@@@/.\@/,@@@`/@@@` .[\@@[[@@@@@@@@@ ,[[[[[@@@[[[[[`
\@@` ,@@/ /@@@@@@@\ .@@@O@\/@^@@]@@=@@@@,@`*@@@@@@^ ]]=@@=@@@@@@@@@^,@@@,@@/` .\@@. \@@` ,@@/ ,@@@@[@/ @@@ ,]@@@@[ ,@@@@\@@^ =@@.@@@@@@@@@@@@@@@`
=@@@@@^ ./@@/ @@@ \@@\`=@@@/` =@@ @=@@ *@@^ =@@@@^ @@=@@@,@@@@@@@^,@@@^.@@@@@@@@@^ =@@@@@^ .@\@@@@@@@@@@@@@/@@@@@@@@@@@@@@.,@@@@[`@@@@@@@@@.[[[[[\@@@/[[[[[`
,/@@@@@\` .\@/@@@@@@@@@\@/ @@^\@@@@@@@@@/. =@@ *@@@@@@@ @@=@@ *@@[[[@@^ .=@^ =@@. ./` ,/@@@@@\` =@@ @@@ @@@ =@@..@=@@..@@^ =@@ ,/@@[@@@`
.@@@@@@` ,\@@@@@` @@@ ,]@@^/@@/=@@[@@@` =@@ *@@^ =@@@@@@^@@@@@@@^ =@^@@@@@@@@@@@^,@@@` .@@@@@@` ,\@@@@@` =@@ @@@ @@@@@@@@@@@@. =@@..@@@@@@@@@./@@@@/ [@@@@@`
.[` ,[ \@/ .[[[ .. ,@/ ,@/ .@@` . .@/. \@` ,[`,[[[[[[[[[[. ,[ .[` ,[ ,@/ \@/ \@/ ,[[. ,@/..\@` ,@/ .[[ ,[
"""

# 读取指定文件中所有文本内容并返回 如果文件不存在则创建
Expand Down Expand Up @@ -677,7 +700,20 @@ def get_live2d_model_name(self, path):


"""
文件操作
.]]@@ .@]] @@@@ O@@` ,]]]]]]]]]]]]. /]] /@]`
=@@@\ =@@@`.@@@^ @@@@ @@@^ =@@@@@@@@@@@@. =@@@` =@@@`
@@@@@@@@@@@@@@@@@@@@@@@ ,@@@^ =@@@` @@@@ ]]@@@\]`=@@@@@@@@@@@@. ,@@@^ ,@@@@@@@@@@@@@@^
@@@@@@@@@@@@@@@@@@@@@@@ .@@@@ .@@@@@@@@@@@@@@@ @@@@@@@^,[[[[[[[[[[[[. .@@@@..@@@@@@@@@@@@@@@`
\@@@` =@@@@ .@@@@@ =@@@[[[@@@@[[[[` @@@^ =@@@@@@^=@@@@@@^ .@@@@@,@@@/ @@@^
.@@@@` ,@@@@. /@@@@@,@@@^ @@@@ @@@\]=@@ =@@^=@@.=@@^.@@@@@@.@@/ @@@@@@@@@@
\@@@\./@@@@ .@@@@@@,]]]]]]]@@@@]]]]]/@@@@@@@=@@@@@@^=@@@@@@^ @@O@@@..` @@@/[[[[[[
=@@@@@@@^ =/=@@@=@@@@@@@@@@@@@@@@^@@@@@^,]]]]]]@@@\]]]]]] =`=@@@. @@@^
./@@@@@@@] =@@@ @@@@ @@@^=@@@@@@@@@@@@@@@@ =@@@. @@@@@@@@@@^
,]@@@@@@@[@@@@@@@]` =@@@ @@@@ @@@^ .]@@@@@@@@@\. =@@@. @@@/[[[[[[`
\@@@@@@@[ .[@@@@@@@/ =@@@ @@@@ .@@@@@`@@@@@` @@@^.\@@@@. =@@@. @@@^
,@/[ .[\@` =@@@ @@@@ \@@@` ,` @@@^ .[ =@@@. @@@^
"""

# 写入内容到指定文件中 返回T/F
Expand Down Expand Up @@ -736,7 +772,20 @@ def move_file(self, source_path, destination_path, rename=None, format="wav"):


"""
音频相关
,@@@^ .@@@. .@@@@@@@@@@@@. .@@@. ,]]]]]]]]]]]]` ]@@@` ,@@@\.
.@@@@@@@@@@@@@@@@@@@@@^ .@@O.@@@\]`@@@@@@@@@@@@. .@@@. =@@@@@@@@@@@@^ \@@@@. =@@@/
.]@@^ ,@@\` .@@O.@@@@@^,]]/@@@]]]]`.@@@@@@@@@=@@^ .@@@^ =@@@@@@@@@@@@@@@@@@@@
.@@@@@@@@@@@@@@@@@@@@@@@..@@O.@@@. =@@@@@@@@@@^.[[[@@@/[[=@@@]]]]]/@@@^ =@@@@@@@@@@@@@@@@@@@O
.@@@@@@@@@@@@@@@@@@@@@@@*@@@@@@@@@@@=@@^,]]`=@@^ /@@@` =@@@@@@@@@@@@^ =@@@^
=@@@@@@@@@@@@@@@@@^ =@@O =@@^=@@^=@@^ /@@@@@@@/@@^ .@@@^.@@@@@@@@@@@@@@@@@@@@@@@.
=@@@@@@@@@@@@@@@@@^ /@@\@@O=@@/@@^=@@^=@@^./@@@@@[@`=@@@@@@@@@@@@^.O@@@@@@@@@@@@@@@@@@@@@O.
=@@@]]]]]]]]]]]@@@^ =@@^=@@@@@/=@@^@@@.=@@^.@@`@@@. =@@@@@@@@@@@@^ .@@@@@@@`
=@@@@@@@@@@@@@@@@@^ .,\^ ./@@@^ ,[[@@@@\,[[` =`.@@@. =@@^ .@@@^ ,@@@@/ \@@@@]
=@@@]]]]]]]]]]]@@@^ .]@@@@/ ,/@@@/@@@@] .@@@. =@@@@@@@@@@@@^ .,/@@@@@/. .\@@@@@@\].
=@@@@@@@@@@@@@@@@@^ \@@@@` ,@@@@[ .\@@@. .@@@. =@@@@@@@@@@@@^ ,@@@@@` ,\@@@/.
.... .... ,. ,. . ... .... ..... .
"""
# 获取新的音频路径
def get_new_audio_path(self, audio_out_path, file_name):
Expand Down Expand Up @@ -782,7 +831,20 @@ def get_all_audio_device_info(self, type):
return device_infos

"""
HTTP请求相关
.. ,]]]. ,]]]. ,]
.@@@@. ,@@@\ .@@@@@@@@@@@@@@`@@@@@@@@@@@@@@` =@@@@@@\]]` =@@@^ ,]]]]]/@@@\]]]]]] =@@@. \@@@@`
.@@@@. =@@@@ *@@@@@@@@@@@@@@^@@@@@@@@@@@@@@^ =@@@@@@@@@@@\ ,@@@\,[[[[[\@@@[[[[[[[ ]]]]]]]]]/@@@\]]]/@\]]]
.@@@@. =@@@@ .@@@@. .@@@@. =@@@^ .@@@@^ .[` .@@@@@@@@@@@@@@@. @@@@@@@@@@@@@@@@@@@@@@@
.@@@@. =@@@@ .@@@@. .@@@@. =@@@^ =@@@@,]]]]],]]]]]]/@@@]]]]]]]` ,@` =@@@` /\.
.@@@@@@@@@@@@@@@@ .@@@@. .@@@@. =@@@^ .]@@@@`=@@@@@,[[[[[[[[[[[[[[[[[` ,@@@@\. =@@@@` ./@@@@`
.@@@@@@@@@@@@@@@@ .@@@@. .@@@@. =@@@@@@@@@@/. =@@@ =@@@@@@@@@@@@@^ .\@@` =@@@@@@@@@/.
.@@@@. =@@@@ .@@@@. .@@@@. =@@@/[[`. =@@@ =@@@]]]]]]]@@@^ ,/@@@@@@\@@@\
.@@@@. =@@@@ .@@@@. .@@@@. =@@@^ =@@@.`=@@@@@@@@@@@@@^ .]@@@@@@/\@@@.,@@@@@]
.@@@@. =@@@@ .@@@@. .@@@@. =@@@^ =@@@@@=@@@@@@@@@@@@@^ \@@@/` =@@@. ,@@@@@@
.[[[[. ,[[[[ .[[[[. .[[[[. ,[[[` =@@@@[=@@@ .@@@^ [. @@@@@@@@. [@/
.@/. =@@@ ,@@@@@@@. =@@@@@@`
"""
def send_request(self, url, method='GET', json_data=None):
"""
Expand Down
56 changes: 56 additions & 0 deletions utils/my_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,17 @@ def choose_song_handle(self, data):
return False


"""
]@@@@@ =@@ @@^ =@@@@@@]. .@@` ./@@@ ,@@@^ /@^
@@^ @@* =@@ @@^ =@@ ,@@\ =@@ @@^
\@@]. =@@@@@.=@@@@@` =@@@@@@@. @@^ ./@@@@\. =@@ .@@^.@@.@@@@@@@@@@@.@@ @@^ /@@@@^ @@^ ./@@@@@] @@/@@@@.
,\@@\ @@* .]]/@@ =@@. =@\ @@^ @@\]]/@^ =@@ @@^.@@. =@@ @@^ .@@ @@^ @@\` @@^ @@^ \@^ @@` \@^
@@^ @@* ,@@` =@@ =@@ =@/ @@^ @@` =@@ ./@/ .@@. =@@ @@^ .@@. @@^ ,\@@ @@^ @@^ /@^ @@* =@^
.@@@@@@/ \@@@.@@@@@@@ =@@@@@@/ @@^ .\@@@@@. =@@@@@@/` .@@. =@@ @@^ =@@@@@@^.@@@@@^ @@^ .\@@@@@` @@* =@^
"""

# 画图模式 SD 处理
def sd_handle(self, data):
"""画图模式 SD 处理
Expand Down Expand Up @@ -1018,6 +1029,30 @@ def tuning_handle(self, data_json):
else:
logging.warning(f"警告:{chat_type}无返回")


"""
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@@@@@@^ /@@@@@@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@@@@@@@ ,@@@@@@@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@@@@@@@^ /@@@@@@@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@@@@@@@@. ,@@@@@@@@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@@@@@@@@^ /@@@@@@@@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@=@@@@@@@. ,@@@@@@@^@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@.@@@@@@@^ @@@@@@@@.@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@ =@@@@@@@. =@@@@@@@^.@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@ .@@@@@@@^ @@@@@@@@ .@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@ =@@@@@@@=@@@@@@@^ .@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@ .@@@@@@@@@@@@@@@ .@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@ =@@@@@@@@@@@@@^ .@@@@@@@@@
.@@@@@@@@@@@ .@@@@@@@@@@@ .@@@@@@@@@ .@@@@@@@@@@@@/ .@@@@@@@@@
.@@@@@@@@@@@@@@@@@@@@@@@@@@@^ .@@@@@@@@@@@@@@@@@@@@@@@@@@@^ .@@@@@@@@@ =@@@@@@@@@@@` .@@@@@@@@@
.@@@@@@@@@@@@@@@@@@@@@@@@@@@^ .@@@@@@@@@@@@@@@@@@@@@@@@@@@^ .@@@@@@@@@ .@@@@@@@@@@/ .@@@@@@@@@
.@@@@@@@@@@@@@@@@@@@@@@@@@@@^ .@@@@@@@@@@@@@@@@@@@@@@@@@@@^ .@@@@@@@@@ =@@@@@@@@@` .@@@@@@@@@
.@@@@@@@@@@@@@@@@@@@@@@@@@@@^ .@@@@@@@@@@@@@@@@@@@@@@@@@@@^ .@@@@@@@@@ .@@@@@@@@/ .@@@@@@@@@
"""


# LLM处理
def llm_handle(self, chat_type, data):
"""LLM统一处理
Expand Down Expand Up @@ -1535,6 +1570,27 @@ def key_mapping_handle(self, type, data):
return flag


"""
,`
@@@@` =@@\` /@@/
,/@@] =@@@` @@@/ =@@\/@@@@@@@@@[
.\@@/[@@@@` ,@@@ =@/. ,[[[[.=@^ ,@@@@\`
*@@^,` .]]]@@@@@@\` ,@@@@@@[[[. =@@@@.
.]]]]/@@`\@@/ *@@^ =@@@/ ,@@@@@@@@/`@@@`
=@@* .@@@@@@@@/`@@@^ ,@@\]]/@@@@@.
=@@ =@@*.@@\]/@@^ ,\@@\ ,]]@@@@]
,/@@@@@@@^ \@/[@@^ .@@@@@@@@@[[[\@\.
,@/. .@@@ .@@\]/@@@@@@` ,@@@,@@@.,]@@@`
.@@/@@@@@/[@@/ /@@\]@@@@@@@@@@@@@]
=@@^ .@@^ ]@@@@@^ @@@ @@@ ,@@@@@@\].
,]]/@@@` .@@^ ./@/` .@@^.@@@/@@@/
\@@@` .@@^ .@@@ .[[
.@@` @@^
"""

# 弹幕处理
def comment_handle(self, data):
"""弹幕处理
Expand Down

0 comments on commit 084244f

Please sign in to comment.