Skip to content

Commit 5e5cc7f

Browse files
authored
Merge pull request #624 from Ikaros-521/owner
恢复TikTok关闭的日志信息
2 parents aa0437b + d546e0b commit 5e5cc7f

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
`Luna AI` 是一款结合了最先进技术的虚拟AI主播。它的核心是一系列高效的人工智能模型,包括 `ChatterBot、GPT、Claude、langchain、chatglm、text-generation-webui、讯飞星火、智谱AI、谷歌Bard、文心一言、通义星尘、千帆大模型 和 Gemini`。这些模型既可以在本地运行,也可以通过云端服务提供支持。
1010

11-
`Luna AI` 的外观由 `Live2D、Vtube Studio、xuniren 和 UE5 结合 Audio2Face` 技术打造,为用户提供了一个生动、互动的虚拟形象。这使得 `Luna AI` 能够在各大直播平台,如 `Bilibili、抖音、快手、微信视频号、斗鱼、YouTube 和 Twitch`,进行实时互动直播。当然,它也可以在本地环境中与您进行个性化对话。
11+
`Luna AI` 的外观由 `Live2D、Vtube Studio、xuniren 和 UE5 结合 Audio2Face` 技术打造,为用户提供了一个生动、互动的虚拟形象。这使得 `Luna AI` 能够在各大直播平台,如 `Bilibili、抖音、快手、微信视频号、斗鱼、YouTube、TwitchTikTok`,进行实时互动直播。当然,它也可以在本地环境中与您进行个性化对话。
1212

1313
为了使交流更加自然,`Luna AI` 使用了先进的自然语言处理技术,结合文本转语音系统,如 `Edge-TTS、VITS-Fast、elevenlabs、bark-gui、VALL-E-X、睿声AI、genshinvoice.top、tts.ai-lab.top、OpenVoice 和 GPT_SoVITS`。这不仅让它能够生成流畅的回答,还可以通过 `so-vits-svc 和 DDSP-SVC` 实现声音的变化,以适应不同的场景和角色。
1414

docs/AI Vtuber.xmind

1.58 KB
Binary file not shown.

docs/xmind.png

-838 Bytes
Loading

tiktok.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def send():
9999
try:
100100
try:
101101
data_json = request.get_json()
102-
logging.debug(f"API收到数据:{data_json}")
102+
logging.info(f"API收到数据:{data_json}")
103103

104104
if data_json["type"] == "reread":
105105
my_handle.reread_handle(data_json)
@@ -151,7 +151,7 @@ def record_audio():
151151
input=True,
152152
frames_per_buffer=CHUNK)
153153
frames = []
154-
logging.debug("Recording...")
154+
logging.info("Recording...")
155155
flag = 0
156156
while 1:
157157
while keyboard.is_pressed('RIGHT_SHIFT'):
@@ -161,7 +161,7 @@ def record_audio():
161161
pressdown_num = pressdown_num + 1
162162
if flag:
163163
break
164-
logging.debug("Stopped recording.")
164+
logging.info("Stopped recording.")
165165
stream.stop_stream()
166166
stream.close()
167167
p.terminate()
@@ -174,7 +174,7 @@ def record_audio():
174174
if pressdown_num >= 5: # 粗糙的处理手段
175175
return 1
176176
else:
177-
logging.debug("杂鱼杂鱼,好短好短(录音时间过短,按右shift重新录制)")
177+
logging.info("杂鱼杂鱼,好短好短(录音时间过短,按右shift重新录制)")
178178
return 0
179179

180180

@@ -208,7 +208,7 @@ def audio_listen(volume_threshold=800.0, silence_threshold=15):
208208
data = stream.read(CHUNK)
209209
audio_data = np.frombuffer(data, dtype=np.short)
210210
max_dB = np.max(audio_data)
211-
# logging.debug(max_dB)
211+
# logging.info(max_dB)
212212
if max_dB > volume_threshold:
213213
is_speaking = True
214214
silent_count = 0
@@ -218,13 +218,13 @@ def audio_listen(volume_threshold=800.0, silence_threshold=15):
218218
if is_speaking is True:
219219
frames.append(data)
220220
if speaking_flag is False:
221-
logging.debug("[录入中……]")
221+
logging.info("[录入中……]")
222222
speaking_flag = True
223223

224224
if silent_count >= silence_threshold:
225225
break
226226

227-
logging.debug("[语音录入完成]")
227+
logging.info("[语音录入完成]")
228228

229229
# 将音频保存为WAV文件
230230
'''with wave.open(WAVE_OUTPUT_FILENAME, 'wb') as wf:
@@ -249,7 +249,7 @@ def do_listen_and_comment(status=True):
249249
try:
250250
# 检查是否收到停止事件
251251
if stop_do_listen_and_comment_thread_event.is_set():
252-
logging.debug(f'停止录音~')
252+
logging.info(f'停止录音~')
253253
break
254254

255255
config = Config(config_path)
@@ -294,7 +294,7 @@ def do_listen_and_comment(status=True):
294294
content = res['result'][0]
295295

296296
# 输出识别结果
297-
logging.debug("识别结果:" + content)
297+
logging.info("识别结果:" + content)
298298
user_name = config.get("talk", "username")
299299

300300
data = {
@@ -313,16 +313,16 @@ def do_listen_and_comment(status=True):
313313
try:
314314
# 打开麦克风进行录音
315315
with sr.Microphone() as source:
316-
logging.debug(f'录音中...')
316+
logging.info(f'录音中...')
317317
# 从麦克风获取音频数据
318318
audio = r.listen(source)
319-
logging.debug("成功录制")
319+
logging.info("成功录制")
320320

321321
# 进行谷歌实时语音识别 en-US zh-CN ja-JP
322322
content = r.recognize_google(audio, language=config.get("talk", "google", "tgt_lang"))
323323

324324
# 输出识别结果
325-
# logging.debug("识别结果:" + content)
325+
# logging.info("识别结果:" + content)
326326
user_name = config.get("talk", "username")
327327

328328
data = {
@@ -374,14 +374,14 @@ def do_listen_and_comment(status=True):
374374

375375
content = ""
376376
for segment in segments:
377-
logging.debug("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
377+
logging.info("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
378378
content += segment.text + "。"
379379

380380
if content == "":
381381
return
382382

383383
# 输出识别结果
384-
logging.debug("识别结果:" + content)
384+
logging.info("识别结果:" + content)
385385
user_name = config.get("talk", "username")
386386

387387
data = {
@@ -406,7 +406,7 @@ def on_key_press(event):
406406
return
407407

408408
# if event.name in ['z', 'Z', 'c', 'C'] and keyboard.is_pressed('ctrl'):
409-
# logging.debug("退出程序")
409+
# logging.info("退出程序")
410410

411411
# os._exit(0)
412412

@@ -432,18 +432,18 @@ def on_key_press(event):
432432

433433
if trigger_key_lower:
434434
if event.name == trigger_key or event.name == trigger_key_lower:
435-
logging.debug(f'检测到单击键盘 {event.name},即将开始录音~')
435+
logging.info(f'检测到单击键盘 {event.name},即将开始录音~')
436436
elif event.name == stop_trigger_key or event.name == stop_trigger_key_lower:
437-
logging.debug(f'检测到单击键盘 {event.name},即将停止录音~')
437+
logging.info(f'检测到单击键盘 {event.name},即将停止录音~')
438438
stop_do_listen_and_comment_thread_event.set()
439439
return
440440
else:
441441
return
442442
else:
443443
if event.name == trigger_key:
444-
logging.debug(f'检测到单击键盘 {event.name},即将开始录音~')
444+
logging.info(f'检测到单击键盘 {event.name},即将开始录音~')
445445
elif event.name == stop_trigger_key:
446-
logging.debug(f'检测到单击键盘 {event.name},即将停止录音~')
446+
logging.info(f'检测到单击键盘 {event.name},即将停止录音~')
447447
stop_do_listen_and_comment_thread_event.set()
448448
return
449449
else:
@@ -477,7 +477,7 @@ def key_listener():
477477
stop_trigger_key = config.get("talk", "stop_trigger_key")
478478

479479
if config.get("talk", "key_listener_enable"):
480-
logging.debug(f'单击键盘 {trigger_key} 按键进行录音喵~ 由于其他任务还要启动,如果按键没有反应,请等待一段时间')
480+
logging.info(f'单击键盘 {trigger_key} 按键进行录音喵~ 由于其他任务还要启动,如果按键没有反应,请等待一段时间')
481481

482482
# 创建并启动按键监听线程
483483
thread = threading.Thread(target=key_listener)
@@ -529,7 +529,7 @@ def schedule_task(index):
529529
"content": content
530530
}
531531

532-
logging.debug(f"定时任务:{content}")
532+
logging.info(f"定时任务:{content}")
533533

534534
my_handle.process_data(data, "schedule")
535535

@@ -539,7 +539,7 @@ def run_schedule():
539539
try:
540540
for index, task in enumerate(config.get("schedule")):
541541
if task["enable"]:
542-
# logging.debug(task)
542+
# logging.info(task)
543543
# 设置定时任务,每隔n秒执行一次
544544
schedule.every(task["time"]).seconds.do(partial(schedule_task, index))
545545
except Exception as e:
@@ -563,7 +563,7 @@ async def run_trends_copywriting():
563563
if False == config.get("trends_copywriting", "enable"):
564564
return
565565

566-
logging.debug(f"动态文案任务线程运行中...")
566+
logging.info(f"动态文案任务线程运行中...")
567567

568568
while True:
569569
# 文案文件路径列表
@@ -620,7 +620,7 @@ async def idle_time_task():
620620
if False == config.get("idle_time_task", "enable"):
621621
return
622622

623-
logging.debug(f"闲时任务线程运行中...")
623+
logging.info(f"闲时任务线程运行中...")
624624

625625
# 记录上一次触发的任务类型
626626
last_mode = 0
@@ -632,7 +632,7 @@ async def idle_time_task():
632632
if config.get("idle_time_task", "random_time"):
633633
overflow_time = random.randint(0, overflow_time)
634634

635-
logging.debug(f"闲时时间={overflow_time}秒")
635+
logging.info(f"闲时时间={overflow_time}秒")
636636

637637
def load_data_list(type):
638638
if type == "comment":
@@ -698,7 +698,7 @@ def load_data_list(type):
698698
# 是否开启了随机闲时时间
699699
if config.get("idle_time_task", "random_time"):
700700
overflow_time = random.randint(0, overflow_time)
701-
logging.debug(f"闲时时间={overflow_time}秒")
701+
logging.info(f"闲时时间={overflow_time}秒")
702702

703703
continue
704704

@@ -742,7 +742,7 @@ def load_data_list(type):
742742
# 是否开启了随机闲时时间
743743
if config.get("idle_time_task", "random_time"):
744744
overflow_time = random.randint(0, overflow_time)
745-
logging.debug(f"闲时时间={overflow_time}秒")
745+
logging.info(f"闲时时间={overflow_time}秒")
746746

747747
continue
748748

@@ -766,18 +766,18 @@ def load_data_list(type):
766766
# Define how you want to handle specific events via decorator
767767
@client.on("connect")
768768
async def on_connect(_: ConnectEvent):
769-
logging.debug("连接到 房间ID:", client.room_id)
769+
logging.info("连接到 房间ID:", client.room_id)
770770

771771
@client.on("disconnect")
772772
async def on_disconnect(event: DisconnectEvent):
773-
logging.debug("断开连接")
773+
logging.info("断开连接")
774774

775775
@client.on("join")
776776
async def on_join(event: JoinEvent):
777777
user_name = event.user.nickname
778778
unique_id = event.user.unique_id
779779

780-
logging.debug(f'[🚹🚺直播间成员加入消息] 欢迎 {user_name} 进入直播间')
780+
logging.info(f'[🚹🚺直播间成员加入消息] 欢迎 {user_name} 进入直播间')
781781

782782
data = {
783783
"platform": "tiktok",
@@ -799,7 +799,7 @@ async def on_comment(event: CommentEvent):
799799
user_name = event.user.nickname
800800
content = event.comment
801801

802-
logging.debug(f'[📧直播间弹幕消息] [{user_name}]:{content}')
802+
logging.info(f'[📧直播间弹幕消息] [{user_name}]:{content}')
803803

804804
data = {
805805
"platform": "tiktok",
@@ -817,7 +817,7 @@ async def on_gift(event: GiftEvent):
817817
Important Note:
818818
819819
Gifts of type 1 can have streaks, so we need to check that the streak has ended
820-
If the gift type isn't 1, it can't repeat. Therefore, we can go straight to logging.debuging
820+
If the gift type isn't 1, it can't repeat. Therefore, we can go straight to logging.infoing
821821
822822
"""
823823

@@ -860,7 +860,7 @@ async def on_gift(event: GiftEvent):
860860
# 总金额
861861
combo_total_coin = repeat_count * discount_price
862862

863-
logging.debug(f'[🎁直播间礼物消息] 用户:{user_name} 赠送 {num}{gift_name},单价 {discount_price}抖币,总计 {combo_total_coin}抖币')
863+
logging.info(f'[🎁直播间礼物消息] 用户:{user_name} 赠送 {num}{gift_name},单价 {discount_price}抖币,总计 {combo_total_coin}抖币')
864864

865865
data = {
866866
"platform": "tiktok",
@@ -877,7 +877,7 @@ async def on_gift(event: GiftEvent):
877877
async def on_follow(event: FollowEvent):
878878
user_name = event.user.nickname
879879

880-
logging.debug(f'[➕直播间关注消息] 感谢 {user_name} 的关注')
880+
logging.info(f'[➕直播间关注消息] 感谢 {user_name} 的关注')
881881

882882
data = {
883883
"platform": "tiktok",
@@ -890,11 +890,11 @@ async def on_follow(event: FollowEvent):
890890
client.run()
891891

892892
except LiveNotFound:
893-
logging.debug(f"用户ID: `@{client.unique_id}` 好像不在线捏, 1分钟后重试...")
893+
logging.info(f"用户ID: `@{client.unique_id}` 好像不在线捏, 1分钟后重试...")
894894

895895
# 退出程序
896896
def exit_handler(signum, frame):
897-
logging.debug("Received signal:", signum)
897+
logging.info("Received signal:", signum)
898898
os._exit(0)
899899

900900
if __name__ == '__main__':

0 commit comments

Comments
 (0)