Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build-client.spec
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ hiddenimports += [
'rich',
'rich.console',
'rich.markdown',
'rich._unicode_data',
'rich._unicode_data.unicode17-0-0',
'keyboard',
'pyclip',
'numpy',
Expand Down
2 changes: 2 additions & 0 deletions build.spec
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ hiddenimports += [
'rich',
'rich.console',
'rich.markdown',
'rich._unicode_data',
'rich._unicode_data.unicode17-0-0',
'keyboard',
'pyclip',
'numpy',
Expand Down
24 changes: 24 additions & 0 deletions config_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,30 @@ class ClientConfig:
},
]

# LLM 清除历史指令关键词(完全匹配)
# 支持一个或多个关键词:clear_history_keywords = ['清除历史', '清除记忆', '清除上下文'] ,留空则关闭此功能:clear_history_keywords = []
clear_history_keywords = ['清除历史', '清除记忆', '清除上下文']

# LLM 撤回上一轮对话的关键词(完全匹配)
# 支持一个或多个关键词:revoke_last_turn_keywords = ['撤回', '撤销', '回退'] ,留空则关闭此功能:revoke_last_turn_keywords = []
revoke_last_turn_keywords = ['撤回最近对话', '撤销最近对话', '回退最近对话']

# LLM 显示上一轮对话的关键词(完全匹配)
# 支持一个或多个关键词:show_last_turn_keywords = ['显示', '查看', '最近'] ,留空则关闭此功能:show_last_turn_keywords = []
show_last_turn_keywords = ['显示最近对话', '查看最近对话']

# LLM 复制全部上下文的关键词(完全匹配)
# 支持一个或多个关键词:copy_all_context_keywords = ['复制', '拷贝'] ,留空则关闭此功能:copy_all_context_keywords = []
copy_all_context_keywords = ['复制全部上下文', '拷贝全部上下文']

# LLM 复制当前角色上下文的关键词(完全匹配)
# 支持一个或多个关键词:copy_current_role_context_keywords = ['复制当前角色上下文', '拷贝当前角色上下文'] ,留空则关闭此功能:copy_current_role_context_keywords = []
copy_current_role_context_keywords = ['复制当前角色上下文', '拷贝当前角色上下文']

# LLM 复制结果的关键词(完全匹配)
# 支持一个或多个关键词:copy_result_keywords = ['复制结果', '复制输出'] ,留空则关闭此功能:copy_result_keywords = []
copy_result_keywords = ['复制最近结果', '复制输出']

threshold = 0.3 # 快捷键触发阈值(秒)

paste = False # 是否以写入剪切板然后模拟 Ctrl-V 粘贴的方式输出结果
Expand Down
5 changes: 4 additions & 1 deletion requirements-server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ pystray
Pillow

markdown
tkhtmlview
tkhtmlview

# 补充缺失报错
tbb
45 changes: 45 additions & 0 deletions util/client/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,42 @@ def clear_memory():
from util.client.ui import toast
toast("清除成功:已清除所有角色的对话历史记录", duration=3000, bg="#075077")

def revoke_last_turn():
from util.llm.llm_handler import revoke_last_turn
from util.client.ui import toast
success, message = revoke_last_turn()
if success:
toast(message, duration=3000, bg="#075077")
else:
toast(message, duration=3000, bg="#d9534f")

def show_last_turn():
from util.llm.llm_handler import show_last_turn
from util.client.ui import toast
success, message = show_last_turn()
if success:
toast(message, duration=5000, bg="#075077")
else:
toast(message, duration=3000, bg="#d9534f")

def copy_all_context():
from util.llm.llm_handler import copy_all_context
from util.client.ui import toast
success, message = copy_all_context()
if success:
toast(message, duration=3000, bg="#075077")
else:
toast(message, duration=3000, bg="#d9534f")

def copy_current_role_context():
from util.llm.llm_handler import copy_current_role_context
from util.client.ui import toast
success, message = copy_current_role_context()
if success:
toast(message, duration=3000, bg="#075077")
else:
toast(message, duration=3000, bg="#d9534f")

def add_hotword():
try:
from util.client.ui import on_add_hotword
Expand All @@ -63,6 +99,11 @@ def copy_last_result():
if text:
from util.llm.llm_clipboard import copy_to_clipboard
copy_to_clipboard(text)
from util.client.ui import toast
toast("复制成功:已复制结果到剪贴板", duration=3000, bg="#075077")
else:
from util.client.ui import toast
toast("复制失败:没有可复制的内容", duration=3000, bg="#d9534f")

import os
icon_path = os.path.join(base_dir, 'assets', 'icon.ico')
Expand All @@ -76,6 +117,10 @@ def copy_last_result():
('✨ 添加热词', add_hotword),
('🛠️ 添加纠错', add_rectify),
('🧹 清除记忆', clear_memory),
('↩️ 撤回上一轮', revoke_last_turn),
('💬 显示最近对话', show_last_turn),
('📄 复制所有上下文', copy_all_context),
('📑 复制当前角色上下文', copy_current_role_context),
('🔄 重启音频', restart_audio),
]
)
Expand Down
Loading