-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessage.html
More file actions
2041 lines (1842 loc) · 112 KB
/
message.html
File metadata and controls
2041 lines (1842 loc) · 112 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<title>💬 消息</title>
<link rel="stylesheet" href="message.css">
<script src="viewport-fix.js"></script>
<script src="couple-space.js"></script>
</head>
<body>
<!-- 主容器:左侧导航 + 右侧内容 -->
<div class="main-container">
<!-- 左侧导航栏 -->
<div class="left-sidebar">
<div class="sidebar-nav-item active" onclick="switchMainTab('me')" data-tab="me">
<span>我</span>
</div>
<div class="sidebar-nav-item" onclick="switchMainTab('contacts')" data-tab="contacts">
<span>联系人</span>
</div>
<div class="sidebar-nav-item" onclick="switchMainTab('npc')" data-tab="npc">
<span>NPC</span>
</div>
<div class="sidebar-nav-item" onclick="openTravelCard()" data-tab="travel-card">
<span>行程卡</span>
</div>
</div>
<!-- 右侧内容区 -->
<div class="main-content">
<!-- 我的页面 -->
<div class="content-panel active" id="panel-me">
<!-- 返回桌面按钮 -->
<a href="index.html" class="back-to-desktop-btn">
<span>←</span>
<span>返回桌面</span>
</a>
<!-- 顶部头像圆圈 -->
<div class="top-avatar-circle">
<div class="avatar-circle-container">
<div class="avatar-glow"></div>
<img id="mainAvatar" src="" alt="我" class="circle-avatar">
</div>
<div class="avatar-label" id="currentProfileName">未设置</div>
</div>
<!-- 内容区域 -->
<div class="me-content">
<div class="me-section">
<h3>我的信息</h3>
<div class="me-info-box">
<p><strong>真实姓名:</strong><span id="displayRealName">未设置</span></p>
<button onclick="openPage('page-info')">编辑我的信息</button>
</div>
</div>
<div class="me-section">
<h3>我的头像库</h3>
<div class="me-info-box">
<button onclick="openPage('page-avatars')">管理头像库</button>
</div>
</div>
<div class="me-section">
<h3>主题样式</h3>
<div class="me-info-box">
<button onclick="openCSSThemeManager()">查看/编辑CSS主题</button>
<p style="font-size: 12px; color: #000000; margin-top: 8px;">
自定义消息app的全局样式
</p>
</div>
</div>
<div class="me-section">
<h3>🤖 AI提示词管理</h3>
<div class="me-info-box">
<button onclick="openPromptManager()">管理AI提示词</button>
<p style="font-size: 12px; color: #000000; margin-top: 8px;">
统一管理所有AI提示词,支持多方案切换
</p>
</div>
</div>
html
<div class="me-section">
<h3>账号管理</h3>
<div class="me-info-box">
<button onclick="openProfileSelector()">切换账号</button>
<p style="font-size: 12px; color: #000000; margin-top: 8px;">
切换当前使用的人设方案
</p>
</div>
</div>
<!-- 页面背景图设置 -->
<div class="me-section">
<h3>🖼️ 页面背景图</h3>
<div class="me-info-box">
<p style="font-size: 12px; color: #000000; margin-bottom: 12px;">设置各个页面的背景图</p>
<div style="margin-bottom: 12px;">
<label style="display: block; margin-bottom: 4px; font-weight: bold;">选择页面:</label>
<select id="bgTypeSelect" onchange="updateBackgroundType()" style="width: 100%; padding: 8px; border: 2px solid #000; font-family: inherit;">
<option value="myBg">我背景</option>
<option value="contactBg">联系人背景</option>
<option value="npcBg">NPC页面背景</option>
</select>
</div>
<div style="margin-bottom: 8px;">
<input type="text" id="bgImageUrl" placeholder="输入图片URL" style="width: 100%; padding: 8px; border: 2px solid #000; font-family: inherit; box-sizing: border-box;">
</div>
<div style="display: flex; gap: 8px; margin-bottom: 12px;">
<button onclick="applyBackgroundUrl()">应用URL</button>
<button onclick="uploadBackgroundImage()">上传图片</button>
</div>
<input type="file" id="bgImageFile" accept="image/*" style="display: none;" onchange="handleBackgroundUpload(event)">
<div id="bgPreview" style="min-height: 80px; border: 2px dashed #ccc; border-radius: 8px; background-size: cover; background-position: center; background-repeat: repeat; display: flex; align-items: center; justify-content: center; color: #999; font-size: 12px; margin-bottom: 8px;">背景图预览</div>
<button onclick="clearBackgroundImage()" style="width: 100%;">清除背景图</button>
<p style="font-size: 12px; color: #000000; margin-top: 8px;">为不同页面设置背景图,图片会自动平铺</p>
</div>
</div>
</div>
</div>
<!-- 联系人页面 -->
<div class="content-panel" id="panel-contacts">
<div class="panel-header">
<div class="panel-title-area">
<span class="panel-note">点击进入即可聊天 | 同一分组内的CHAR处于同一世界观</span>
</div>
<div class="panel-actions">
<button class="action-icon-btn" onclick="openCreateGroup()" title="创建分组">📁</button>
<button class="action-icon-btn" onclick="openAddContact()" title="添加联系人">➕</button>
</div>
</div>
<div class="contacts-groups-container" id="contactsGroupsContainer">
<!-- 分组将动态生成 -->
</div>
</div>
<!-- NPC页面 -->
<div class="content-panel" id="panel-npc">
<div class="panel-header">
<div class="panel-title-area">
<span class="panel-note">点击添加NPC,这些NPC会作为CHAR的NPC,或者CHAR1的NPC</span>
</div>
<div class="panel-actions">
<button class="action-icon-btn" onclick="openAddNPC()" title="添加NPC">➕</button>
</div>
</div>
<div class="npc-info-box">
<p>选择一个CHAR,为其创建NPC角色,设置头像、人设和关系</p>
<p>关系可选:🟢 CHAR可知 / 🔴 CHAR不知</p>
<p>点击"关系图"查看和编辑NPC之间、NPC与同分组CHAR之间的关系网络</p>
</div>
<div class="npc-list" id="npcList">
<!-- NPC列表将动态生成 -->
</div>
</div>
</div>
</div>
<!-- NPC 创建/编辑页 -->
<div class="page" id="page-add-contact">
<div class="page-header">
<button class="back-btn" onclick="closePageToMain('page-add-contact')">‹ 返回</button>
<h3 id="contactFormTitle">添加联系人</h3>
<button class="save-btn" onclick="saveContact()">保存</button>
</div>
<div class="page-content">
<input type="hidden" id="editingContactId">
<!-- 头像选择 -->
<div class="avatar-select-section">
<img id="contactAvatar" src="" alt="头像" class="contact-avatar-preview">
<button class="select-avatar-btn" onclick="openAvatarSelector()">
从头像库选择
</button>
</div>
<!-- 封图选择 -->
<div class="form-section">
<div class="form-group">
<label>封图(联系人卡片背景图)</label>
<div class="cover-image-preview" id="coverImagePreview">
<img id="contactCoverImage" src="" alt="封图预览" style="display: none;">
<div class="cover-placeholder">暂无封图</div>
</div>
<div style="display: flex; gap: 8px; margin-top: 8px;">
<input type="text" id="contactCoverUrl" placeholder="输入封图 URL" style="flex: 1;">
<button class="btn-small" onclick="applyCoverUrl()">应用</button>
</div>
<input type="file" id="contactCoverUpload" accept="image/*" onchange="uploadCoverImage(event)" style="margin-top: 8px; font-size: 12px;">
<button class="btn-small" onclick="clearCoverImage()" style="margin-top: 8px;">
清除封图
</button>
<p style="font-size: 12px; color: #000000; margin-top: 8px;">
封图将显示在联系人卡片的上方区域
</p>
</div>
</div>
<!-- 表单 -->
<div class="form-section">
<div class="form-group">
<label>姓名(真实姓名)*</label>
<input type="text" id="contactName" placeholder="输入CHAR的真实姓名" required>
<p style="font-size: 12px; color: #000000; margin-top: 4px;">
这是CHAR的真实姓名,AI会知道这个名字
</p>
</div>
<div class="form-group">
<label>备注(显示名称)</label>
<input type="text" id="contactNickname" placeholder="输入你对TA的备注(可选)">
<p style="font-size: 12px; color: #000000; margin-top: 4px;">
备注仅你可见,CHAR不知道你给TA的备注。如不填写,将显示真实姓名
</p>
</div>
<div class="form-group">
<label>分组</label>
<select id="contactGroup">
<option value="">选择分组</option>
<!-- 分组选项将动态生成 -->
</select>
</div>
<div class="form-group">
<label>性别</label>
<select id="contactGender">
<option value="">不设置</option>
<option value="male">男</option>
<option value="female">女</option>
<option value="other">其他</option>
</select>
</div>
<div class="form-group">
<label>气泡颜色方案</label>
<select id="contactBubbleScheme" onchange="previewBubbleScheme()">
<option value="default">默认蓝色</option>
</select>
<button class="btn-small" onclick="openBubbleCustomizer()" style="margin-top: 10px;">
自定义气泡样式
</button>
</div>
<div class="form-group">
<label>通话记录气泡样式</label>
<select id="contactCallBubbleScheme" onchange="previewCallBubbleScheme()">
<option value="default">默认样式(跟随聊天气泡)</option>
</select>
<button class="btn-small" onclick="openCallBubbleCustomizer()" style="margin-top: 10px;">
自定义通话记录气泡
</button>
<p style="font-size: 12px; color: #000000; margin-top: 4px;">
自定义语音/视频通话结束后的气泡样式
</p>
</div>
<div class="form-group">
<label>用户人设</label>
<select id="contactUserPersona" onchange="updateUserPersonaPreview()">
<option value="">不使用用户人设</option>
<!-- 用户人设选项将动态生成 -->
</select>
<div id="userPersonaPreview" style="margin-top: 8px; padding: 8px; background: rgba(255, 182, 193, 0.1); border: 1px solid #FFB6C1; border-radius: 4px; font-size: 12px; color: #000000; display: none;">
<div style="font-weight: bold; margin-bottom: 4px;">人设预览:</div>
<div id="userPersonaContent"></div>
</div>
<p style="font-size: 12px; color: #000000; margin-top: 4px;">
从"我-账号管理"中选择用户人设,CHAR 在回复时会参考这个信息
</p>
</div>
<div class="form-group">
<label>CHAR人设</label>
<textarea id="contactPersonality" rows="4" placeholder="描述CHAR的性格、背景、说话方式等..."></textarea>
<p style="font-size: 12px; color: #000000; margin-top: 4px;">
设置CHAR的基础人设,这将影响TA的回复风格和行为表现
</p>
</div>
<div class="form-group">
<label>关联世界书(备忘录)</label>
<div id="contactWorldBookList" style="display: flex; flex-direction: column; gap: 6px;">
</div>
<p style="font-size: 12px; color: #000000; margin-top: 4px;">
可以为该联系人选择一个或多个世界书,用于在聊天提示词中注入世界观设定。
</p>
</div>
<div class="form-group">
<label>📖 共读书籍挂载</label>
<div id="contactMountedBookList" style="display: flex; flex-direction: column; gap: 6px;">
</div>
<p style="font-size: 12px; color: #000000; margin-top: 4px;">
挂载共读书籍后,TA会感知你的阅读进度,在聊天中召回书中记忆。
</p>
</div>
<div class="form-group">
<label>初次见面语</label>
<input type="text" id="contactGreeting" placeholder="第一次见面时 TA 会说什么?">
</div>
<div class="form-group">
<label>自动回复(按状态)</label>
<p style="font-size: 12px; color: #000000; margin-bottom: 6px;">
当AI状态处于下列状态时,将把对应的自动回复策略加入提示词中。
</p>
<textarea id="autoReplyRulesInput" rows="4" placeholder="例如: 睡觉中 => 我在睡觉,明天再聊吧~ 工作中 => 我现在在工作,可能回复较慢~"></textarea>
<p style="font-size: 12px; color: #7f8c8d; margin-top: 4px;">
每行一条规则,格式为:状态文本 => 自动回复内容。
</p>
</div>
<div class="form-group">
<label>API 方案</label>
<select id="contactApiScheme" onchange="loadApiSchemeForContact()">
<option value="">使用默认配置</option>
</select>
</div>
<div class="form-group">
<label>AI 模型</label>
<select id="contactModel">
<option value="">使用默认模型</option>
</select>
</div>
<div class="form-group">
<label>消息提示音 URL</label>
<input type="text" id="contactNotificationSound" placeholder="https://example.com/sound.mp3">
</div>
<div class="form-group">
<label>来电铃声 URL</label>
<input type="text" id="contactRingtone" placeholder="https://example.com/ringtone.mp3">
</div>
<div class="form-group">
<label>聊天背景</label>
<input type="text" id="contactChatBgUrl" placeholder="背景图片 URL">
<input type="file" accept="image/*" onchange="uploadChatBackground(event)" style="margin-top: 10px;">
<button class="btn-small" onclick="clearChatBackground()" style="margin-top: 10px;">
清除背景
</button>
</div>
<div class="form-group">
<label>实时感知功能</label>
<div style="margin-bottom: 10px;">
<label style="display: flex; align-items: center; gap: 8px; font-weight: normal;">
<input type="radio" name="timeMode" value="same" checked onchange="toggleTimeMode()">
<span>同地时间(同一时区)</span>
</label>
<label style="display: flex; align-items: center; gap: 8px; font-weight: normal; margin-top: 8px;">
<input type="radio" name="timeMode" value="different" onchange="toggleTimeMode()">
<span>异地时间(不同时区)</span>
</label>
</div>
<div id="sameTimeZoneSettings" style="margin-top: 10px;">
<label>共同时区</label>
<select id="sharedTimezone">
<option value="Asia/Shanghai">中国标准时间 (UTC+8)</option>
<option value="America/New_York">美国东部时间 (UTC-5/-4)</option>
<option value="America/Los_Angeles">美国西部时间 (UTC-8/-7)</option>
<option value="Europe/London">英国时间 (UTC+0/+1)</option>
<option value="Europe/Paris">欧洲中部时间 (UTC+1/+2)</option>
<option value="Asia/Tokyo">日本标准时间 (UTC+9)</option>
<option value="Asia/Seoul">韩国标准时间 (UTC+9)</option>
<option value="Australia/Sydney">澳大利亚东部时间 (UTC+10/+11)</option>
</select>
</div>
<div id="differentTimeZoneSettings" style="display: none; margin-top: 10px;">
<label>用户所处时区</label>
<select id="userTimezone" style="margin-bottom: 10px;">
<option value="Asia/Shanghai">中国标准时间 (UTC+8)</option>
<option value="America/New_York">美国东部时间 (UTC-5/-4)</option>
<option value="America/Los_Angeles">美国西部时间 (UTC-8/-7)</option>
<option value="Europe/London">英国时间 (UTC+0/+1)</option>
<option value="Europe/Paris">欧洲中部时间 (UTC+1/+2)</option>
<option value="Asia/Tokyo">日本标准时间 (UTC+9)</option>
<option value="Asia/Seoul">韩国标准时间 (UTC+9)</option>
<option value="Australia/Sydney">澳大利亚东部时间 (UTC+10/+11)</option>
</select>
<label>AI 角色所处时区</label>
<select id="aiTimezone">
<option value="Asia/Shanghai">中国标准时间 (UTC+8)</option>
<option value="America/New_York">美国东部时间 (UTC-5/-4)</option>
<option value="America/Los_Angeles">美国西部时间 (UTC-8/-7)</option>
<option value="Europe/London">英国时间 (UTC+0/+1)</option>
<option value="Europe/Paris">欧洲中部时间 (UTC+1/+2)</option>
<option value="Asia/Tokyo">日本标准时间 (UTC+9)</option>
<option value="Asia/Seoul">韩国标准时间 (UTC+9)</option>
<option value="Australia/Sydney">澳大利亚东部时间 (UTC+10/+11)</option>
</select>
</div>
</div>
<div class="form-group">
<label style="display: flex; align-items: center; gap: 8px;">
<input type="checkbox" id="bilingualEnabled" onchange="toggleBilingualSettings()">
<span>双语显示</span>
</label>
<div id="bilingualSettings" style="display: none; margin-top: 10px;">
<label>语言组合</label>
<select id="bilingualMode">
<option value="zh-en">中英双语</option>
<option value="zh-ja">中日双语</option>
<option value="zh-ko">中韩双语</option>
<option value="zh-de">中德双语</option>
</select>
<div style="margin-top: 8px; font-size: 12px; color: #7f8c8d;">
💡 AI 会用外语回复,点击气泡可查看中文翻译
</div>
</div>
</div>
<div class="form-group">
<label style="display: flex; align-items: center; gap: 8px;">
<input type="checkbox" id="ttsEnabled" onchange="toggleTtsSettings()">
<span>启用语音合成 (TTS)</span>
</label>
<div style="margin-top: 8px; font-size: 12px; color: #7f8c8d;">
💡 需要先在设置中配置 MiniMax 并启用
</div>
<div id="ttsSettings" style="display: none; margin-top: 10px;">
<label>语音 ID (音色)</label>
<input type="text" id="ttsVoiceId" placeholder="例如:male-qn-qingse" style="margin-bottom: 10px;">
<small style="display: block; color: #7f8c8d; margin-bottom: 10px;">
常用音色:male-qn-qingse (青涩青年音), female-shaonv (少女音), male-qn-jingying (精英青年音)
</small>
<label>语音语言</label>
<select id="ttsLanguage" style="margin-bottom: 10px;">
<option value="zh">中文</option>
<option value="en">英文</option>
<option value="ja">日语</option>
<option value="ko">韩语</option>
</select>
<label>语音速度</label>
<input type="number" id="ttsSpeed" value="1.0" min="0.5" max="2.0" step="0.1" style="margin-bottom: 5px;">
<small style="display: block; color: #7f8c8d;">
范围:0.5 - 2.0,默认 1.0
</small>
</div>
</div>
<div class="bubble-preview" id="bubblePreview">
<div class="preview-label">气泡预览:</div>
<div class="chat-preview">
<div class="message-bubble received">你好!</div>
<div class="message-bubble sent">嗨,很高兴认识你</div>
</div>
</div>
</div>
</div>
</div>
<!-- 聊天页面 -->
<div class="page" id="page-chat">
<div class="chat-header" style="padding: 10px 16px;">
<button class="back-btn" onclick="closePageToMain('page-chat')">‹</button>
<!-- 中间头像和信息 -->
<div class="chat-header-center" style="gap: 4px;">
<img id="chatAvatar" src="" alt="头像" class="chat-header-avatar" style="width: 48px !important; height: 48px !important;">
<div id="chatName" class="chat-header-name">联系人</div>
<div id="chatStatus" class="chat-header-status">在线</div>
<div class="typing-indicator" id="typingIndicator">
<div class="typing-dot"></div>
<div class="typing-dot"></div>
<div class="typing-dot"></div>
</div>
</div>
<button class="chat-menu-btn" onclick="showChatMenu()">⋯</button>
</div>
<!-- 6个功能图标横向一排,独立容器 -->
<div style="display: flex; justify-content: center; align-items: center; gap: 8px; padding: 6px 0; background: var(--chat-header-bg); border-bottom: 2px solid var(--chat-header-border);">
<button class="chat-icon-btn" onclick="openTokenAnalysis()" title="Token 分析" style="width: 32px !important; height: 32px !important;">
<img src="https://files.catbox.moe/vm8m1n.jpg" alt="分析" style="width: 18px !important; height: 18px !important;">
</button>
<button class="chat-icon-btn" onclick="openMemoryBank()" title="记忆库" style="width: 32px !important; height: 32px !important;">
<img src="https://files.catbox.moe/9136hf.jpg" alt="记忆" style="width: 18px !important; height: 18px !important;">
</button>
<button class="chat-icon-btn" onclick="showRegenerateMenu()" title="重新生成回复" style="width: 32px !important; height: 32px !important;">
<img id="regenerateIcon" src="https://files.catbox.moe/cbatt5.jpg" alt="重新生成" style="width: 18px !important; height: 18px !important;">
</button>
<button class="chat-icon-btn" onclick="openMessageFormatSettings()" title="消息格式设置" style="width: 32px !important; height: 32px !important;">
<img src="https://i.ibb.co/YFhP77Sz/format-icon.jpg" alt="格式设置" style="width: 18px !important; height: 18px !important;">
</button>
<button class="chat-icon-btn" onclick="toggleMessageEditMode()" title="消息编辑" style="width: 32px !important; height: 32px !important;">
<img id="messageEditIcon" src="https://i.ibb.co/YFhP77Sz/format-icon.jpg" alt="编辑" style="width: 18px !important; height: 18px !important;">
</button>
<button class="chat-icon-btn" onclick="openFavorites()" title="收藏消息" style="width: 32px !important; height: 32px !important;">
<img id="favoritesIcon" src="https://i.ibb.co/YFhP77Sz/format-icon.jpg" alt="收藏" style="width: 18px !important; height: 18px !important;">
</button>
</div>
<!-- 聊天菜单 -->
<div class="chat-menu" id="chatMenu">
<div class="chat-menu-item" onclick="editCurrentContact()">
<span>✏️</span>
<span>编辑联系人</span>
</div>
<div class="chat-menu-item" onclick="deleteCurrentContact()">
<span>🗑️</span>
<span>删除联系人</span>
</div>
<div class="chat-menu-item" onclick="clearChatHistory()">
<span>🧹</span>
<span>清空聊天记录</span>
</div>
</div>
<!-- 重新生成菜单 -->
<div class="chat-menu" id="regenerateMenu">
<div class="chat-menu-item" onclick="openRegenerateIconSettings()">
<span>🎨</span>
<span>自定义图标</span>
</div>
<div class="chat-menu-item" onclick="regenerateLastReply()">
<span>🔄</span>
<span>重新生成回复</span>
</div>
</div>
<div class="chat-messages" id="chatMessages">
<!-- 消息将动态生成 -->
</div>
<div class="chat-input-container">
<button class="chat-action-btn" onclick="showInputMenu()">+</button>
<button class="chat-action-btn" onclick="showStickerMenu()">😊</button>
<button class="chat-action-btn" onclick="showMessageTypeMenu()" title="语音消息">
<img id="voiceFunctionIcon" src="https://i.ibb.co/yFDN2pB/image.png" alt="语音功能" style="width: 20px; height: 20px; object-fit: cover;">
</button>
<input type="text" id="chatInput" placeholder="输入消息..." onkeypress="handleChatKeyPress(event)">
<button class="chat-send-btn" onclick="sendMessage()">发送</button>
<button class="chat-merge-send-btn" onclick="mergeSendMessages()" title="合并发送所有消息">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 2L11 13"></path>
<path d="M22 2L15 22L11 13L2 9L22 2Z"></path>
</svg>
</button>
</div>
<!-- 消息类型菜单 -->
<div class="message-type-menu" id="messageTypeMenu">
<div class="message-type-item" onclick="openMockVoiceDialog()">
<span>🎤</span>
<span>文字语音</span>
</div>
<div class="message-type-item" onclick="startVoiceRecognition()">
<span>🎙️</span>
<span>语音识别 (TTS)</span>
</div>
</div>
<!-- 表情包菜单 -->
<div class="sticker-menu" id="stickerMenu">
<div class="sticker-menu-header">
<div class="sticker-categories" id="stickerCategories"></div>
<button class="sticker-manage-btn" onclick="openStickerManager()">⚙️</button>
</div>
<div class="sticker-grid" id="stickerGrid"></div>
</div>
<!-- + 按钮底部面板 -->
<div class="bottom-sheet-overlay" id="bottomSheetOverlay" onclick="closeBottomSheet()"></div>
<div class="bottom-sheet" id="bottomSheet">
<div class="bottom-sheet-content">
<div class="bottom-sheet-grid">
<div class="bottom-sheet-item" onclick="handleBottomSheetAction('video')">
<div class="bottom-sheet-icon">📹</div>
<div class="bottom-sheet-label">视频</div>
</div>
<div class="bottom-sheet-item" onclick="handleBottomSheetAction('call')">
<div class="bottom-sheet-icon">📞</div>
<div class="bottom-sheet-label">语音电话</div>
</div>
<div class="bottom-sheet-item" onclick="handleBottomSheetAction('image')">
<div class="bottom-sheet-icon">🖼️</div>
<div class="bottom-sheet-label">图片</div>
</div>
<div class="bottom-sheet-item" onclick="handleBottomSheetAction('location')">
<div class="bottom-sheet-icon">📍</div>
<div class="bottom-sheet-label">定位</div>
</div>
<div class="bottom-sheet-item" onclick="handleBottomSheetAction('manage')">
<div class="bottom-sheet-icon">⚙️</div>
<div class="bottom-sheet-label">管理</div>
</div>
</div>
</div>
</div>
</div>
<!-- 视频通话页面 -->
<div class="page" id="page-video-call">
<div class="video-call-header">
<button class="video-call-back-btn" onclick="endVideoCall()">‹</button>
<div class="video-call-duration" id="videoCallDuration">00:00</div>
<button class="video-call-regenerate-btn" onclick="regenerateLastVideoCallMessage()" title="重新生成最新回复">🔄</button>
<button class="video-call-settings-btn" onclick="openVideoCallSettings()">⚙️</button>
<button class="video-call-hangup-btn" onclick="confirmEndVideoCall()">📞</button>
</div>
<div class="video-call-content">
<div class="video-call-character">
<img id="videoCallCharacterImage" src="" alt="CHAR">
<!-- 正在输入中指示器(在 CHAR 图片上方) -->
<div class="video-call-typing-indicator" id="videoCallTypingIndicator">
<div class="typing-bubble">
<div class="typing-dots">
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
</div>
<div class="video-call-messages" id="videoCallMessages">
<!-- 视频通话消息将动态生成 -->
</div>
</div>
<div class="video-call-input-container">
<input type="text" id="videoCallInput" placeholder="输入消息..." onkeypress="handleVideoCallKeyPress(event)">
<button class="video-call-send-btn" onclick="sendVideoCallMessage()">发送</button>
</div>
</div>
<!-- 语音通话页面 -->
<div class="page" id="page-voice-call">
<div class="voice-call-header">
<button class="voice-call-settings-btn" onclick="openVoiceCallSettingsNew()" title="通话设置">⚙️</button>
<div class="voice-call-contact-info">
<img id="voiceCallAvatar" src="" alt="头像" class="voice-call-avatar">
<div class="voice-call-name" id="voiceCallName">联系人</div>
<div class="voice-call-duration" id="voiceCallDuration">00:00</div>
</div>
<button class="voice-call-appearance-btn" onclick="openVoiceCallAppearanceNew()" title="外观设置">🎨</button>
<button class="voice-call-regenerate-btn" onclick="regenerateLastVoiceReply()" title="重新生成">🔄</button>
</div>
<!-- 声波可视化容器 -->
<div class="voice-call-visualizer">
<canvas id="voiceCallWaveform" width="800" height="200"></canvas>
<div class="voice-call-status" id="voiceCallStatus">等待中...</div>
</div>
<!-- 通话消息区域 -->
<div class="voice-call-messages" id="voiceCallMessages">
<!-- 消息气泡将动态生成 -->
</div>
<!-- 底部控制栏 -->
<div class="voice-call-controls">
<button class="voice-call-hangup-btn" onclick="endVoiceCall()" title="挂断">
<svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 9c-1.6 0-3.15.25-4.6.72v3.1c0 .39-.23.74-.56.9-.98.49-1.87 1.12-2.66 1.85-.18.18-.43.28-.7.28-.28 0-.53-.11-.71-.29L.29 13.08c-.18-.17-.29-.42-.29-.7 0-.28.11-.53.29-.71C3.34 8.78 7.46 7 12 7s8.66 1.78 11.71 4.67c.18.18.29.43.29.71 0 .28-.11.53-.29.71l-2.48 2.48c-.18.18-.43.29-.71.29-.27 0-.52-.11-.7-.28-.79-.74-1.68-1.36-2.66-1.85-.33-.16-.56-.5-.56-.9v-3.1C15.15 9.25 13.6 9 12 9z"/>
</svg>
</button>
<input type="text" id="voiceCallInput" placeholder="输入消息..." onkeypress="handleVoiceCallKeyPress(event)">
<button class="voice-call-mic-btn" onclick="startVoiceInput()" title="点击开始语音识别">
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/>
<path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/>
</svg>
</button>
</div>
<!-- 语音识别状态提示 -->
<div class="voice-recognition-indicator" id="voiceRecognitionIndicator">
<div class="recognition-pulse"></div>
<span>识别中...</span>
</div>
</div>
<!-- 语音通话设置弹窗 -->
<div class="voice-call-settings-modal" id="voiceCallSettingsModal">
<div class="voice-call-settings-content pixel-container">
<div class="voice-call-settings-header pixel-header">
<h3 class="pixel-title">通话设置</h3>
<button class="pixel-btn-icon" onclick="closeVoiceCallSettings()">×</button>
</div>
<div class="voice-call-settings-body pixel-body">
<div class="pixel-item">
<label class="pixel-label">通话背景</label>
<input type="text" id="voiceCallBackground" class="pixel-input" placeholder="输入图片URL">
<button class="pixel-btn-small" onclick="uploadVoiceCallBackground()" style="margin-top: 8px;">上传图片</button>
<input type="file" id="voiceCallBackgroundFile" accept="image/*" style="display: none;" onchange="handleVoiceCallBackgroundUpload(event)">
</div>
<div class="pixel-item" style="background: #f8f9fa; padding: 10px; border-radius: 5px; margin-bottom: 15px;">
<p style="margin: 0; font-size: 13px; color: #666;">
💡 语音通话提示词管理已迁移到统一管理系统。<br>
请前往"我"页面 → "AI提示词管理" → "语音通话提示词"进行设置。
</p>
</div>
<div class="pixel-item">
<label class="pixel-label" style="display: flex; align-items: center; gap: 10px;">
<input type="checkbox" id="voiceCallEnableMinimax" class="pixel-checkbox" checked>
<span>启用 MiniMax 语音合成</span>
</label>
<small class="pixel-hint">关闭后将无法使用语音功能</small>
</div>
<div class="pixel-item">
<label class="pixel-label" style="display: flex; align-items: center; gap: 10px;">
<input type="checkbox" id="voiceCallContinuousRead" class="pixel-checkbox">
<span>启用连读功能</span>
</label>
<small class="pixel-hint">开启后AI回复会自动朗读,无需点击气泡</small>
</div>
<div class="pixel-item">
<label class="pixel-label">读取聊天记录条数</label>
<input type="number" id="voiceCallHistoryCount" class="pixel-input" value="10" min="0" max="50">
<small class="pixel-hint">让AI知道通话前的聊天内容</small>
</div>
<div class="pixel-item">
<label class="pixel-label">主动消息间隔(秒)</label>
<input type="number" id="voiceCallActiveInterval" class="pixel-input" value="30" min="10" max="300">
<small class="pixel-hint">用户多久不说话时AI主动发起话题</small>
</div>
<button class="pixel-btn" onclick="saveVoiceCallSettingsNew()">保存设置</button>
</div>
</div>
</div>
<!-- 语音通话外观设置弹窗 -->
<div class="voice-call-appearance-modal" id="voiceCallAppearanceModal">
<div class="voice-call-appearance-content pixel-container">
<div class="voice-call-appearance-header pixel-header">
<h3 class="pixel-title">外观设置</h3>
<button class="pixel-btn-icon" onclick="closeVoiceCallAppearance()">×</button>
</div>
<div class="voice-call-appearance-body pixel-body">
<!-- 图标设置 -->
<div class="pixel-section">
<h4 class="pixel-section-title">图标设置</h4>
<div class="pixel-item">
<label class="pixel-label">返回按钮图标</label>
<div class="icon-preview-row">
<div class="icon-preview" id="currentVoiceBackIcon">←</div>
<input type="text" id="voiceBackIconText" class="pixel-input" placeholder="输入文字或Emoji">
<button class="pixel-btn-small" onclick="setVoiceBackIconText()">设置文字</button>
</div>
<div style="margin-top: 8px;">
<input type="text" id="voiceHangupIconUrl" class="pixel-input" placeholder="或输入图片URL">
<button class="pixel-btn-small" onclick="setVoiceHangupIconUrl()" style="margin-top: 4px;">设置图片</button>
<button class="pixel-btn-small" onclick="uploadVoiceHangupIcon()" style="margin-top: 4px;">上传图片</button>
<input type="file" id="voiceHangupIconFile" accept="image/*" style="display: none;" onchange="handleVoiceHangupIconUpload(event)">
</div>
</div>
</div>
<!-- CSS设置 -->
<div class="pixel-section">
<h4 class="pixel-section-title">自定义 CSS</h4>
<div class="pixel-item">
<textarea id="voiceCallCustomCSS" class="pixel-textarea" rows="20" placeholder="输入自定义CSS样式..."></textarea>
<small class="pixel-hint">实时更新,修改后立即生效</small>
</div>
<div class="voice-call-appearance-preview">
<div class="pixel-label">当前默认样式参考:</div>
<pre id="voiceCallDefaultCSS" class="pixel-code-preview"></pre>
</div>
</div>
<button class="pixel-btn" onclick="saveVoiceCallAppearanceNew()">保存外观</button>
</div>
</div>
</div>
<!-- 头像选择器弹窗 -->
<div class="avatar-selector-modal" id="avatarSelectorModal">
<div class="avatar-selector-content">
<div class="avatar-selector-header">
<h3>选择头像</h3>
<button class="close-modal-btn" onclick="closeAvatarSelector()">×</button>
</div>
<div class="avatars-grid-selector" id="avatarsSelectorGrid"></div>
</div>
</div>
<!-- 气泡样式自定义弹窗 -->
<div class="bubble-customizer-modal" id="bubbleCustomizerModal">
<div class="bubble-customizer-content">
<div class="bubble-customizer-header">
<h3>自定义气泡样式</h3>
<button class="close-modal-btn" onclick="closeBubbleCustomizer()">×</button>
</div>
<div class="bubble-customizer-body">
<div class="form-group">
<label>方案名称</label>
<input type="text" id="bubbleSchemeName" placeholder="输入方案名称">
</div>
<div class="form-group">
<label>自定义 CSS</label>
<textarea id="bubbleCustomCSS" rows="15" class="pixel-textarea code-editor"></textarea>
</div>
<div class="bubble-customizer-preview">
<div class="preview-label">实时预览:</div>
<div class="chat-preview" id="bubbleCustomPreview">
<div class="message-bubble received">这是对方的消息</div>
<div class="message-bubble sent">这是我的消息</div>
</div>
</div>
<div style="display: flex; gap: 8px;">
<button class="btn-primary" onclick="saveBubbleScheme()">保存方案</button>
</div>
<div class="form-group" style="margin-top: 20px; padding-top: 20px; border-top: 1px solid #ddd;">
<label>删除已有方案</label>
<div style="display: flex; gap: 8px;">
<select id="bubbleSchemeToDelete" style="flex: 1;">
<option value="">选择要删除的方案</option>
</select>
<button class="btn-cancel" onclick="deleteBubbleScheme()">删除</button>
</div>
</div>
</div>
</div>
</div>
<!-- 通话记录气泡样式自定义弹窗 -->
<div class="bubble-customizer-modal" id="callBubbleCustomizerModal">
<div class="bubble-customizer-content">
<div class="bubble-customizer-header">
<h3>自定义通话记录气泡样式</h3>
<button class="close-modal-btn" onclick="closeCallBubbleCustomizer()">×</button>
</div>
<div class="bubble-customizer-body">
<div class="form-group">
<label>方案名称</label>
<input type="text" id="callBubbleSchemeName" placeholder="输入方案名称,如:粉色通话气泡">
</div>
<div class="form-group">
<label>自定义 CSS</label>
<textarea id="callBubbleCustomCSS" rows="20" class="pixel-textarea code-editor" placeholder="输入CSS代码..."></textarea>
<p style="font-size: 12px; color: #7f8c8d; margin-top: 8px;">
💡 提示:可以自定义 .video-call-record-bubble 和 .voice-call-record-bubble 的样式
</p>
</div>
<div class="bubble-customizer-preview">
<div class="preview-label">实时预览:</div>
<div class="chat-preview" id="callBubbleCustomPreview">
<div class="message-bubble video-call-record-bubble received">
<div class="video-call-record-header">📹 视频通话</div>
<div class="video-call-record-duration">通话结束 04:32</div>
</div>
<div class="message-bubble voice-call-record-bubble received" style="margin-top: 12px;">
<div class="voice-call-record-header">🎤 语音通话</div>
<div class="voice-call-record-duration">通话结束 02:15</div>
</div>
</div>
</div>
<div style="display: flex; gap: 8px;">
<button class="btn-primary" onclick="saveCallBubbleScheme()">保存方案</button>
</div>
<div class="form-group" style="margin-top: 20px; padding-top: 20px; border-top: 1px solid #ddd;">
<label>删除已有方案</label>
<div style="display: flex; gap: 8px;">
<select id="callBubbleSchemeToDelete" style="flex: 1;">
<option value="">选择要删除的方案</option>
</select>
<button class="btn-cancel" onclick="deleteCallBubbleScheme()">删除</button>
</div>
</div>
</div>
</div>
</div>
<!-- iOS 风格通知横幅 -->
<div class="notification-banner" id="notificationBanner">
<img class="notification-avatar" id="notificationAvatar" src="" alt="">
<div class="notification-content">
<div class="notification-title" id="notificationTitle">联系人</div>
<div class="notification-message" id="notificationMessage">新消息</div>
</div>
</div>
<!-- P2 我的信息 -->
<div class="page" id="page-info">
<div class="page-header">
<button class="back-btn" onclick="closePageToMain('page-info')">‹ 返回</button>
<h3>我的信息</h3>
<button class="save-btn" onclick="saveUserInfo()">保存</button>
</div>
<div class="page-content">
<!-- 当前方案名称 -->
<div class="current-scheme-info">
<span class="scheme-label">当前方案:</span>
<span class="scheme-name" id="currentSchemeName">初始人设</span>
</div>
<!-- 头像预览 -->
<div class="avatar-preview-section">
<img id="previewAvatar" src="" alt="头像预览" class="preview-avatar">
<button class="select-avatar-btn" onclick="openPage('page-avatars')">
点击从头像库选择
</button>
</div>
<!-- 表单 -->
<div class="form-section">
<div class="form-group">
<label>姓名(真实)</label>
<input type="text" id="realName" placeholder="输入你的真实姓名">
</div>
<div class="form-group">
<label>网名</label>
<input type="text" id="nickname" placeholder="输入你的网名">
</div>
<div class="form-group">
<label>人设</label>
<textarea id="bio" rows="3" class="pixel-textarea" placeholder="简短描述一下自己..."></textarea>
</div>
<div class="form-group">
<label>人设标签</label>
<div class="tags-container" id="tagsContainer"></div>
<div class="tag-input-group">
<input type="text" id="tagInput" placeholder="添加标签...">
<button class="add-tag-btn" onclick="addTag()">+</button>
</div>
</div>
<!-- 背景图设置 -->
<div class="form-group">
<label>🖼️ 背景图设置</label>
<div class="background-settings">
<div class="bg-type-selector">
<label>
<input type="radio" name="bgType" value="myBg" checked onchange="updateBackgroundType()">
我背景图
</label>
<label>
<input type="radio" name="bgType" value="contactBg" onchange="updateBackgroundType()">
联系人背景图
</label>
<label>
<input type="radio" name="bgType" value="npcBg" onchange="updateBackgroundType()">
NPC背景图
</label>
</div>
<div class="bg-upload-section" style="margin-top: 10px;">
<input type="text" id="bgImageUrl" placeholder="输入图片URL" style="width: 100%; padding: 8px; margin-bottom: 8px;">
<div style="display: flex; gap: 8px;">
<button class="btn-small" onclick="applyBackgroundUrl()" style="flex: 1;">应用URL</button>
<button class="btn-small" onclick="uploadBackgroundImage()" style="flex: 1;">上传图片</button>
</div>
<input type="file" id="bgImageFile" accept="image/*" style="display: none;" onchange="handleBackgroundUpload(event)">
<div class="bg-preview" id="bgPreview" style="margin-top: 10px; min-height: 100px; border: 2px dashed #ccc; border-radius: 8px; background-size: cover; background-position: center; background-repeat: repeat; display: flex; align-items: center; justify-content: center; color: #999;">
背景图预览
</div>
<button class="btn-small" onclick="clearBackgroundImage()" style="width: 100%; margin-top: 8px;">清除背景图</button>
</div>
</div>
</div>
</div>
<!-- 保存按钮组 -->
<div class="save-buttons-group">
<button class="save-scheme-btn" onclick="saveCurrentProfile()">
💾 保存当前方案
</button>