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

Refactor Step2EnvSetup.vue for improved profile display and statistics

Browse files

- Removed the progress bar section to streamline the interface.
- Updated labels for agent statistics to enhance clarity and localization.
- Introduced a computed property to calculate the total number of associated topics across profiles.
- Enhanced profile display with additional fields for real name, username, and profession, improving user engagement.
- Adjusted styling for better layout and readability of profile information.

frontend/src/components/Step2EnvSetup.vue CHANGED
@@ -60,31 +60,20 @@
60
  <p class="description">
61
  从知识图谱读取实体,使用 LLM 为每个实体生成详细的 Agent 人设与行为配置
62
  </p>
63
-
64
- <!-- Progress Bar -->
65
- <div v-if="phase >= 1" class="progress-section">
66
- <div class="progress-bar">
67
- <div class="progress-fill" :style="{ width: prepareProgress + '%' }"></div>
68
- </div>
69
- <div class="progress-info">
70
- <span class="progress-stage">{{ currentStage }}</span>
71
- <span class="progress-detail">{{ progressMessage }}</span>
72
- </div>
73
- </div>
74
 
75
  <!-- Profiles Stats -->
76
  <div v-if="profiles.length > 0" class="stats-grid">
77
  <div class="stat-card">
78
  <span class="stat-value">{{ profiles.length }}</span>
79
- <span class="stat-label">Agent 人设</span>
80
  </div>
81
  <div class="stat-card">
82
- <span class="stat-value">{{ entityTypes.length }}</span>
83
- <span class="stat-label">实体类型</span>
84
  </div>
85
  <div class="stat-card">
86
- <span class="stat-value">{{ expectedTotal || '-' }}</span>
87
- <span class="stat-label">预期总数</span>
88
  </div>
89
  </div>
90
 
@@ -104,10 +93,23 @@
104
  @click="selectProfile(profile)"
105
  >
106
  <div class="profile-header">
107
- <span class="profile-name">{{ profile.user_name || profile.username || `Agent ${idx}` }}</span>
108
- <span class="profile-type">{{ profile.entity_type || 'Unknown' }}</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  </div>
110
- <p class="profile-bio">{{ truncateBio(profile.bio || profile.description || '暂无简介') }}</p>
111
  </div>
112
  </div>
113
  </div>
@@ -298,6 +300,13 @@ const displayProfiles = computed(() => {
298
  return profiles.value.slice(0, 6)
299
  })
300
 
 
 
 
 
 
 
 
301
  // Methods
302
  const addLog = (msg) => {
303
  emit('add-log', msg)
@@ -672,82 +681,34 @@ onUnmounted(() => {
672
  font-size: 12px;
673
  }
674
 
675
- /* Progress Section */
676
- .progress-section {
677
- margin: 16px 0;
678
- }
679
-
680
- .progress-bar {
681
- height: 6px;
682
- background: #E5E5E5;
683
- border-radius: 3px;
684
- overflow: hidden;
685
- margin-bottom: 12px;
686
- }
687
-
688
- .progress-fill {
689
- height: 100%;
690
- background: linear-gradient(90deg, #FF5722, #FF9800);
691
- border-radius: 3px;
692
- transition: width 0.3s ease;
693
- }
694
-
695
- .progress-info {
696
- display: flex;
697
- justify-content: space-between;
698
- align-items: center;
699
- }
700
-
701
- .progress-stage {
702
- font-family: 'JetBrains Mono', monospace;
703
- font-size: 11px;
704
- font-weight: 600;
705
- color: #FF5722;
706
- text-transform: uppercase;
707
- }
708
-
709
- .progress-detail {
710
- font-size: 12px;
711
- color: #666;
712
- max-width: 60%;
713
- text-align: right;
714
- white-space: nowrap;
715
- overflow: hidden;
716
- text-overflow: ellipsis;
717
- }
718
-
719
  /* Stats Grid */
720
  .stats-grid {
721
  display: grid;
722
- grid-template-columns: repeat(3, 1fr);
723
- gap: 8px;
724
- margin-top: 16px;
 
 
725
  }
726
 
727
  .stat-card {
728
- background: #FAFAFA;
729
- border: 1px solid #E5E5E5;
730
- border-radius: 6px;
731
- padding: 12px 8px;
732
  text-align: center;
733
- min-width: 0;
734
  }
735
 
736
  .stat-value {
737
  display: block;
738
- font-family: 'JetBrains Mono', monospace;
739
- font-size: 18px;
740
  font-weight: 700;
741
- color: #333;
742
- overflow: hidden;
743
- text-overflow: ellipsis;
744
  }
745
 
746
  .stat-label {
747
- display: block;
748
- font-size: 11px;
749
  color: #999;
 
750
  margin-top: 4px;
 
751
  }
752
 
753
  /* Profiles Preview */
@@ -781,11 +742,11 @@ onUnmounted(() => {
781
  }
782
 
783
  .profiles-list {
784
- display: grid;
785
- grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
786
  gap: 12px;
787
- max-height: 240px;
788
- overflow: hidden;
789
  transition: max-height 0.3s ease;
790
  }
791
 
@@ -797,7 +758,7 @@ onUnmounted(() => {
797
  background: #FAFAFA;
798
  border: 1px solid #E5E5E5;
799
  border-radius: 6px;
800
- padding: 12px;
801
  cursor: pointer;
802
  transition: all 0.2s ease;
803
  }
@@ -809,31 +770,64 @@ onUnmounted(() => {
809
 
810
  .profile-header {
811
  display: flex;
812
- justify-content: space-between;
813
- align-items: center;
814
- margin-bottom: 8px;
815
  }
816
 
817
- .profile-name {
818
- font-size: 13px;
819
- font-weight: 600;
820
- color: #333;
821
  }
822
 
823
- .profile-type {
824
  font-family: 'JetBrains Mono', monospace;
825
- font-size: 10px;
826
- background: #E3F2FD;
827
- color: #1565C0;
828
- padding: 2px 6px;
 
 
 
 
 
 
 
 
 
829
  border-radius: 3px;
830
  }
831
 
832
  .profile-bio {
833
  font-size: 12px;
834
- color: #666;
835
- line-height: 1.5;
836
- margin: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
  }
838
 
839
  /* Config Preview */
 
60
  <p class="description">
61
  从知识图谱读取实体,使用 LLM 为每个实体生成详细的 Agent 人设与行为配置
62
  </p>
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  <!-- Profiles Stats -->
65
  <div v-if="profiles.length > 0" class="stats-grid">
66
  <div class="stat-card">
67
  <span class="stat-value">{{ profiles.length }}</span>
68
+ <span class="stat-label">当前Agent</span>
69
  </div>
70
  <div class="stat-card">
71
+ <span class="stat-value">{{ expectedTotal || '-' }}</span>
72
+ <span class="stat-label">预期Agent总数</span>
73
  </div>
74
  <div class="stat-card">
75
+ <span class="stat-value">{{ totalTopicsCount }}</span>
76
+ <span class="stat-label">现实种子当前关联话题数</span>
77
  </div>
78
  </div>
79
 
 
93
  @click="selectProfile(profile)"
94
  >
95
  <div class="profile-header">
96
+ <span class="profile-realname">{{ profile.realname || 'Unknown' }}</span>
97
+ <span class="profile-username">@{{ profile.username || `agent_${idx}` }}</span>
98
+ </div>
99
+ <div class="profile-meta">
100
+ <span class="profile-profession">{{ profile.profession || '未知职业' }}</span>
101
+ </div>
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>
114
  </div>
115
  </div>
 
300
  return profiles.value.slice(0, 6)
301
  })
302
 
303
+ // 计算所有人设的关联话题总数
304
+ const totalTopicsCount = computed(() => {
305
+ return profiles.value.reduce((sum, p) => {
306
+ return sum + (p.interested_topics?.length || 0)
307
+ }, 0)
308
+ })
309
+
310
  // Methods
311
  const addLog = (msg) => {
312
  emit('add-log', msg)
 
681
  font-size: 12px;
682
  }
683
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684
  /* Stats Grid */
685
  .stats-grid {
686
  display: grid;
687
+ grid-template-columns: 1fr 1fr 1fr;
688
+ gap: 12px;
689
+ background: #F9F9F9;
690
+ padding: 16px;
691
+ border-radius: 6px;
692
  }
693
 
694
  .stat-card {
 
 
 
 
695
  text-align: center;
 
696
  }
697
 
698
  .stat-value {
699
  display: block;
700
+ font-size: 20px;
 
701
  font-weight: 700;
702
+ color: #000;
703
+ font-family: 'JetBrains Mono', monospace;
 
704
  }
705
 
706
  .stat-label {
707
+ font-size: 9px;
 
708
  color: #999;
709
+ text-transform: uppercase;
710
  margin-top: 4px;
711
+ display: block;
712
  }
713
 
714
  /* Profiles Preview */
 
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
 
 
758
  background: #FAFAFA;
759
  border: 1px solid #E5E5E5;
760
  border-radius: 6px;
761
+ padding: 14px;
762
  cursor: pointer;
763
  transition: all 0.2s ease;
764
  }
 
770
 
771
  .profile-header {
772
  display: flex;
773
+ align-items: baseline;
774
+ gap: 8px;
775
+ margin-bottom: 6px;
776
  }
777
 
778
+ .profile-realname {
779
+ font-size: 14px;
780
+ font-weight: 700;
781
+ color: #000;
782
  }
783
 
784
+ .profile-username {
785
  font-family: 'JetBrains Mono', monospace;
786
+ font-size: 11px;
787
+ color: #999;
788
+ }
789
+
790
+ .profile-meta {
791
+ margin-bottom: 8px;
792
+ }
793
+
794
+ .profile-profession {
795
+ font-size: 11px;
796
+ color: #666;
797
+ background: #F0F0F0;
798
+ padding: 2px 8px;
799
  border-radius: 3px;
800
  }
801
 
802
  .profile-bio {
803
  font-size: 12px;
804
+ color: #444;
805
+ line-height: 1.6;
806
+ margin: 0 0 10px 0;
807
+ display: -webkit-box;
808
+ -webkit-line-clamp: 3;
809
+ -webkit-box-orient: vertical;
810
+ overflow: hidden;
811
+ }
812
+
813
+ .profile-topics {
814
+ display: flex;
815
+ flex-wrap: wrap;
816
+ gap: 6px;
817
+ }
818
+
819
+ .topic-tag {
820
+ font-size: 10px;
821
+ color: #1565C0;
822
+ background: #E3F2FD;
823
+ padding: 2px 8px;
824
+ border-radius: 10px;
825
+ }
826
+
827
+ .topic-more {
828
+ font-size: 10px;
829
+ color: #999;
830
+ padding: 2px 6px;
831
  }
832
 
833
  /* Config Preview */