666ghj commited on
Commit
fc2a5d6
·
1 Parent(s): 55f08a7

Refactor Step2EnvSetup.vue for enhanced profile details and layout

Browse files

- Updated profile description to provide clearer context on entity initialization and behavior configuration.
- Removed the expand button for profile details, simplifying the interface.
- Adjusted the display logic to show all profiles directly, improving accessibility.
- Enhanced modal layout with additional fields for real name, username, and profession, enriching user engagement.
- Improved styling for better readability and visual consistency across profile sections.

frontend/src/components/Step2EnvSetup.vue CHANGED
@@ -58,7 +58,7 @@
58
  <div class="card-content">
59
  <p class="api-note">POST /api/simulation/prepare</p>
60
  <p class="description">
61
- 从知识图谱读取实体,使用 LLM 为每生成详细 Agent 人设与行为配置
62
  </p>
63
 
64
  <!-- Profiles Stats -->
@@ -81,13 +81,10 @@
81
  <div v-if="profiles.length > 0" class="profiles-preview">
82
  <div class="preview-header">
83
  <span class="preview-title">已生成的 Agent 人设</span>
84
- <button class="expand-btn" @click="showProfilesDetail = !showProfilesDetail">
85
- {{ showProfilesDetail ? '收起' : '展开全部' }}
86
- </button>
87
  </div>
88
- <div class="profiles-list" :class="{ expanded: showProfilesDetail }">
89
  <div
90
- v-for="(profile, idx) in displayProfiles"
91
  :key="idx"
92
  class="profile-card"
93
  @click="selectProfile(profile)"
@@ -102,12 +99,12 @@
102
  <p class="profile-bio">{{ profile.bio || '暂无简介' }}</p>
103
  <div v-if="profile.interested_topics?.length" class="profile-topics">
104
  <span
105
- v-for="topic in profile.interested_topics.slice(0, 4)"
106
  :key="topic"
107
  class="topic-tag"
108
  >{{ topic }}</span>
109
- <span v-if="profile.interested_topics.length > 4" class="topic-more">
110
- +{{ profile.interested_topics.length - 4 }}
111
  </span>
112
  </div>
113
  </div>
@@ -200,30 +197,81 @@
200
  <div v-if="selectedProfile" class="profile-modal-overlay" @click.self="selectedProfile = null">
201
  <div class="profile-modal">
202
  <div class="modal-header">
203
- <span class="modal-title">{{ selectedProfile.user_name || selectedProfile.username }}</span>
 
 
 
 
 
 
204
  <button class="close-btn" @click="selectedProfile = null">×</button>
205
  </div>
 
206
  <div class="modal-body">
207
- <div class="modal-section">
208
- <span class="section-label">实体类型</span>
209
- <span class="section-value">{{ selectedProfile.entity_type }}</span>
210
- </div>
211
- <div class="modal-section">
212
- <span class="section-label">来源实体</span>
213
- <span class="section-value">{{ selectedProfile.source_entity_name || '-' }}</span>
 
 
 
 
 
 
 
 
 
 
 
214
  </div>
 
 
215
  <div class="modal-section">
216
  <span class="section-label">人设简介</span>
217
- <p class="section-text">{{ selectedProfile.bio || selectedProfile.description || '暂无简介' }}</p>
218
  </div>
219
- <div class="modal-section" v-if="selectedProfile.personality">
220
- <span class="section-label">性格特点</span>
221
- <p class="section-text">{{ selectedProfile.personality }}</p>
 
 
 
 
 
 
 
 
222
  </div>
223
- <div class="modal-section" v-if="selectedProfile.interests?.length">
224
- <span class="section-label">兴趣标签</span>
225
- <div class="tags-row">
226
- <span v-for="tag in selectedProfile.interests" :key="tag" class="interest-tag">{{ tag }}</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  </div>
228
  </div>
229
  </div>
@@ -733,25 +781,26 @@ onUnmounted(() => {
733
  letter-spacing: 0.5px;
734
  }
735
 
736
- .expand-btn {
737
- font-size: 12px;
738
- color: #FF5722;
739
- background: none;
740
- border: none;
741
- cursor: pointer;
742
- }
743
-
744
  .profiles-list {
745
- display: flex;
746
- flex-direction: column;
747
  gap: 12px;
748
- max-height: 400px;
749
  overflow-y: auto;
750
- transition: max-height 0.3s ease;
751
  }
752
 
753
- .profiles-list.expanded {
754
- max-height: none;
 
 
 
 
 
 
 
 
 
755
  }
756
 
757
  .profile-card {
@@ -902,61 +951,134 @@ onUnmounted(() => {
902
  left: 0;
903
  right: 0;
904
  bottom: 0;
905
- background: rgba(0, 0, 0, 0.5);
906
  display: flex;
907
  align-items: center;
908
  justify-content: center;
909
  z-index: 1000;
 
910
  }
911
 
912
  .profile-modal {
913
  background: #FFF;
914
- border-radius: 12px;
915
  width: 90%;
916
- max-width: 500px;
917
- max-height: 80vh;
918
  overflow: hidden;
919
  display: flex;
920
  flex-direction: column;
 
921
  }
922
 
923
  .modal-header {
924
  display: flex;
925
  justify-content: space-between;
926
- align-items: center;
927
- padding: 20px 24px;
928
- border-bottom: 1px solid #E5E5E5;
 
929
  }
930
 
931
- .modal-title {
932
- font-size: 18px;
 
 
 
 
 
 
 
 
 
 
 
933
  font-weight: 700;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
934
  }
935
 
936
  .close-btn {
937
  width: 32px;
938
  height: 32px;
939
  border: none;
940
- background: #F5F5F5;
 
941
  border-radius: 50%;
942
- font-size: 18px;
943
  cursor: pointer;
944
  display: flex;
945
  align-items: center;
946
  justify-content: center;
 
 
 
947
  }
948
 
949
  .close-btn:hover {
950
- background: #E5E5E5;
951
  }
952
 
953
  .modal-body {
954
  padding: 24px;
955
  overflow-y: auto;
 
 
 
 
 
 
 
 
 
 
 
 
956
  }
957
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
958
  .modal-section {
959
- margin-bottom: 20px;
960
  }
961
 
962
  .section-label {
@@ -966,33 +1088,102 @@ onUnmounted(() => {
966
  color: #999;
967
  text-transform: uppercase;
968
  letter-spacing: 0.5px;
969
- margin-bottom: 6px;
970
  }
971
 
972
- .section-value {
973
  font-size: 14px;
974
  color: #333;
975
- }
976
-
977
- .section-text {
978
- font-size: 13px;
979
- color: #666;
980
  line-height: 1.6;
981
  margin: 0;
 
 
 
 
982
  }
983
 
984
- .tags-row {
 
985
  display: flex;
986
  flex-wrap: wrap;
987
- gap: 6px;
988
  }
989
 
990
- .interest-tag {
991
  font-size: 11px;
992
- background: #F5F5F5;
993
- color: #666;
994
  padding: 4px 10px;
995
  border-radius: 12px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
996
  }
997
 
998
  /* System Logs */
 
58
  <div class="card-content">
59
  <p class="api-note">POST /api/simulation/prepare</p>
60
  <p class="description">
61
+ 结合上下文,自动调用工具从知识图谱梳理实体与关系初始化模拟个体,并基于现实种子赋予他们独特的行为与记忆
62
  </p>
63
 
64
  <!-- Profiles Stats -->
 
81
  <div v-if="profiles.length > 0" class="profiles-preview">
82
  <div class="preview-header">
83
  <span class="preview-title">已生成的 Agent 人设</span>
 
 
 
84
  </div>
85
+ <div class="profiles-list">
86
  <div
87
+ v-for="(profile, idx) in profiles"
88
  :key="idx"
89
  class="profile-card"
90
  @click="selectProfile(profile)"
 
99
  <p class="profile-bio">{{ profile.bio || '暂无简介' }}</p>
100
  <div v-if="profile.interested_topics?.length" class="profile-topics">
101
  <span
102
+ v-for="topic in profile.interested_topics.slice(0, 3)"
103
  :key="topic"
104
  class="topic-tag"
105
  >{{ topic }}</span>
106
+ <span v-if="profile.interested_topics.length > 3" class="topic-more">
107
+ +{{ profile.interested_topics.length - 3 }}
108
  </span>
109
  </div>
110
  </div>
 
197
  <div v-if="selectedProfile" class="profile-modal-overlay" @click.self="selectedProfile = null">
198
  <div class="profile-modal">
199
  <div class="modal-header">
200
+ <div class="modal-header-info">
201
+ <div class="modal-name-row">
202
+ <span class="modal-realname">{{ selectedProfile.realname }}</span>
203
+ <span class="modal-username">@{{ selectedProfile.username }}</span>
204
+ </div>
205
+ <span class="modal-profession">{{ selectedProfile.profession }}</span>
206
+ </div>
207
  <button class="close-btn" @click="selectedProfile = null">×</button>
208
  </div>
209
+
210
  <div class="modal-body">
211
+ <!-- 基本信息 -->
212
+ <div class="modal-info-grid">
213
+ <div class="info-item">
214
+ <span class="info-label">事件外显年龄</span>
215
+ <span class="info-value">{{ selectedProfile.age || '-' }} 岁</span>
216
+ </div>
217
+ <div class="info-item">
218
+ <span class="info-label">事件外显性别</span>
219
+ <span class="info-value">{{ { male: '男', female: '女', other: '其他' }[selectedProfile.gender] || selectedProfile.gender }}</span>
220
+ </div>
221
+ <div class="info-item">
222
+ <span class="info-label">国家/地区</span>
223
+ <span class="info-value">{{ selectedProfile.country || '-' }}</span>
224
+ </div>
225
+ <div class="info-item">
226
+ <span class="info-label">事件外显MBTI</span>
227
+ <span class="info-value mbti">{{ selectedProfile.mbti || '-' }}</span>
228
+ </div>
229
  </div>
230
+
231
+ <!-- 简介 -->
232
  <div class="modal-section">
233
  <span class="section-label">人设简介</span>
234
+ <p class="section-bio">{{ selectedProfile.bio || '暂无简介' }}</p>
235
  </div>
236
+
237
+ <!-- 关注话题 -->
238
+ <div class="modal-section" v-if="selectedProfile.interested_topics?.length">
239
+ <span class="section-label">现实种子关联话题</span>
240
+ <div class="topics-grid">
241
+ <span
242
+ v-for="topic in selectedProfile.interested_topics"
243
+ :key="topic"
244
+ class="topic-item"
245
+ >{{ topic }}</span>
246
+ </div>
247
  </div>
248
+
249
+ <!-- 详细人设 -->
250
+ <div class="modal-section" v-if="selectedProfile.persona">
251
+ <span class="section-label">详细人设背景</span>
252
+
253
+ <!-- 人设维度概览 -->
254
+ <div class="persona-dimensions">
255
+ <div class="dimension-card">
256
+ <span class="dim-title">事件全景经历</span>
257
+ <span class="dim-desc">在此事件中的完整行为轨迹</span>
258
+ </div>
259
+ <div class="dimension-card">
260
+ <span class="dim-title">行为模式侧写</span>
261
+ <span class="dim-desc">经验总结与行事风格偏好</span>
262
+ </div>
263
+ <div class="dimension-card">
264
+ <span class="dim-title">独特记忆印记</span>
265
+ <span class="dim-desc">基于现实种子形成的记忆</span>
266
+ </div>
267
+ <div class="dimension-card">
268
+ <span class="dim-title">社会关系网络</span>
269
+ <span class="dim-desc">个体链接与交互图谱</span>
270
+ </div>
271
+ </div>
272
+
273
+ <div class="persona-content">
274
+ <p class="section-persona">{{ selectedProfile.persona }}</p>
275
  </div>
276
  </div>
277
  </div>
 
781
  letter-spacing: 0.5px;
782
  }
783
 
 
 
 
 
 
 
 
 
784
  .profiles-list {
785
+ display: grid;
786
+ grid-template-columns: repeat(2, 1fr);
787
  gap: 12px;
788
+ max-height: 320px;
789
  overflow-y: auto;
790
+ padding-right: 4px;
791
  }
792
 
793
+ .profiles-list::-webkit-scrollbar {
794
+ width: 4px;
795
+ }
796
+
797
+ .profiles-list::-webkit-scrollbar-thumb {
798
+ background: #DDD;
799
+ border-radius: 2px;
800
+ }
801
+
802
+ .profiles-list::-webkit-scrollbar-thumb:hover {
803
+ background: #CCC;
804
  }
805
 
806
  .profile-card {
 
951
  left: 0;
952
  right: 0;
953
  bottom: 0;
954
+ background: rgba(0, 0, 0, 0.6);
955
  display: flex;
956
  align-items: center;
957
  justify-content: center;
958
  z-index: 1000;
959
+ backdrop-filter: blur(4px);
960
  }
961
 
962
  .profile-modal {
963
  background: #FFF;
964
+ border-radius: 16px;
965
  width: 90%;
966
+ max-width: 600px;
967
+ max-height: 85vh;
968
  overflow: hidden;
969
  display: flex;
970
  flex-direction: column;
971
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
972
  }
973
 
974
  .modal-header {
975
  display: flex;
976
  justify-content: space-between;
977
+ align-items: flex-start;
978
+ padding: 24px;
979
+ background: #FFF;
980
+ border-bottom: 1px solid #F0F0F0;
981
  }
982
 
983
+ .modal-header-info {
984
+ flex: 1;
985
+ }
986
+
987
+ .modal-name-row {
988
+ display: flex;
989
+ align-items: baseline;
990
+ gap: 10px;
991
+ margin-bottom: 8px;
992
+ }
993
+
994
+ .modal-realname {
995
+ font-size: 20px;
996
  font-weight: 700;
997
+ color: #000;
998
+ }
999
+
1000
+ .modal-username {
1001
+ font-family: 'JetBrains Mono', monospace;
1002
+ font-size: 13px;
1003
+ color: #999;
1004
+ }
1005
+
1006
+ .modal-profession {
1007
+ font-size: 12px;
1008
+ color: #666;
1009
+ background: #F5F5F5;
1010
+ padding: 4px 10px;
1011
+ border-radius: 4px;
1012
+ display: inline-block;
1013
+ font-weight: 500;
1014
  }
1015
 
1016
  .close-btn {
1017
  width: 32px;
1018
  height: 32px;
1019
  border: none;
1020
+ background: none;
1021
+ color: #999;
1022
  border-radius: 50%;
1023
+ font-size: 24px;
1024
  cursor: pointer;
1025
  display: flex;
1026
  align-items: center;
1027
  justify-content: center;
1028
+ line-height: 1;
1029
+ transition: color 0.2s;
1030
+ padding: 0;
1031
  }
1032
 
1033
  .close-btn:hover {
1034
+ color: #333;
1035
  }
1036
 
1037
  .modal-body {
1038
  padding: 24px;
1039
  overflow-y: auto;
1040
+ flex: 1;
1041
+ }
1042
+
1043
+ /* 基本信息网格 */
1044
+ .modal-info-grid {
1045
+ display: grid;
1046
+ grid-template-columns: repeat(2, 1fr);
1047
+ gap: 24px 16px;
1048
+ margin-bottom: 32px;
1049
+ padding: 0;
1050
+ background: transparent;
1051
+ border-radius: 0;
1052
  }
1053
 
1054
+ .info-item {
1055
+ display: flex;
1056
+ flex-direction: column;
1057
+ gap: 4px;
1058
+ }
1059
+
1060
+ .info-label {
1061
+ font-size: 11px;
1062
+ color: #999;
1063
+ text-transform: uppercase;
1064
+ letter-spacing: 0.5px;
1065
+ font-weight: 600;
1066
+ }
1067
+
1068
+ .info-value {
1069
+ font-size: 15px;
1070
+ font-weight: 600;
1071
+ color: #333;
1072
+ }
1073
+
1074
+ .info-value.mbti {
1075
+ font-family: 'JetBrains Mono', monospace;
1076
+ color: #FF5722;
1077
+ }
1078
+
1079
+ /* 模块区域 */
1080
  .modal-section {
1081
+ margin-bottom: 28px;
1082
  }
1083
 
1084
  .section-label {
 
1088
  color: #999;
1089
  text-transform: uppercase;
1090
  letter-spacing: 0.5px;
1091
+ margin-bottom: 12px;
1092
  }
1093
 
1094
+ .section-bio {
1095
  font-size: 14px;
1096
  color: #333;
 
 
 
 
 
1097
  line-height: 1.6;
1098
  margin: 0;
1099
+ padding: 16px;
1100
+ background: #F9F9F9;
1101
+ border-radius: 6px;
1102
+ border-left: 3px solid #E0E0E0;
1103
  }
1104
 
1105
+ /* 话题标签 */
1106
+ .topics-grid {
1107
  display: flex;
1108
  flex-wrap: wrap;
1109
+ gap: 8px;
1110
  }
1111
 
1112
+ .topic-item {
1113
  font-size: 11px;
1114
+ color: #1565C0;
1115
+ background: #E3F2FD;
1116
  padding: 4px 10px;
1117
  border-radius: 12px;
1118
+ transition: all 0.2s;
1119
+ border: none;
1120
+ }
1121
+
1122
+ .topic-item:hover {
1123
+ background: #BBDEFB;
1124
+ color: #0D47A1;
1125
+ }
1126
+
1127
+ /* 详细人设 */
1128
+ .persona-dimensions {
1129
+ display: grid;
1130
+ grid-template-columns: repeat(2, 1fr);
1131
+ gap: 12px;
1132
+ margin-bottom: 16px;
1133
+ }
1134
+
1135
+ .dimension-card {
1136
+ background: #F8F9FA;
1137
+ padding: 12px;
1138
+ border-radius: 6px;
1139
+ border-left: 3px solid #DDD;
1140
+ transition: all 0.2s;
1141
+ }
1142
+
1143
+ .dimension-card:hover {
1144
+ background: #F0F0F0;
1145
+ border-left-color: #999;
1146
+ }
1147
+
1148
+ .dim-title {
1149
+ display: block;
1150
+ font-size: 12px;
1151
+ font-weight: 700;
1152
+ color: #333;
1153
+ margin-bottom: 4px;
1154
+ }
1155
+
1156
+ .dim-desc {
1157
+ display: block;
1158
+ font-size: 10px;
1159
+ color: #888;
1160
+ line-height: 1.4;
1161
+ }
1162
+
1163
+ .persona-content {
1164
+ max-height: none;
1165
+ overflow: visible;
1166
+ padding: 0;
1167
+ background: transparent;
1168
+ border: none;
1169
+ border-radius: 0;
1170
+ }
1171
+
1172
+ .persona-content::-webkit-scrollbar {
1173
+ width: 4px;
1174
+ }
1175
+
1176
+ .persona-content::-webkit-scrollbar-thumb {
1177
+ background: #DDD;
1178
+ border-radius: 2px;
1179
+ }
1180
+
1181
+ .section-persona {
1182
+ font-size: 13px;
1183
+ color: #555;
1184
+ line-height: 1.8;
1185
+ margin: 0;
1186
+ text-align: justify;
1187
  }
1188
 
1189
  /* System Logs */