Enhance Step2EnvSetup.vue with agent username display and styling improvements

- Added a new method to retrieve agent usernames based on their IDs, improving clarity in the timeline display.
- Updated the layout to include both agent ID and username, enhancing user engagement.
- Adjusted CSS for better alignment and visual consistency of agent information in the timeline.
This commit is contained in:
666ghj 2025-12-11 19:40:58 +08:00
parent c44cb13d23
commit 39824c88e2

View file

@ -206,7 +206,10 @@
<div class="timeline-content"> <div class="timeline-content">
<div class="post-header"> <div class="post-header">
<span class="post-role">{{ post.poster_type }}</span> <span class="post-role">{{ post.poster_type }}</span>
<span class="post-agent-info">
<span class="post-id">Agent {{ post.poster_agent_id }}</span> <span class="post-id">Agent {{ post.poster_agent_id }}</span>
<span class="post-username">@{{ getAgentUsername(post.poster_agent_id) }}</span>
</span>
</div> </div>
<p class="post-text">{{ post.content }}</p> <p class="post-text">{{ post.content }}</p>
</div> </div>
@ -412,6 +415,15 @@ const displayProfiles = computed(() => {
return profiles.value.slice(0, 6) return profiles.value.slice(0, 6)
}) })
// agent_idusername
const getAgentUsername = (agentId) => {
if (profiles.value && profiles.value.length > agentId && agentId >= 0) {
const profile = profiles.value[agentId]
return profile?.username || `agent_${agentId}`
}
return `agent_${agentId}`
}
// //
const totalTopicsCount = computed(() => { const totalTopicsCount = computed(() => {
return profiles.value.reduce((sum, p) => { return profiles.value.reduce((sum, p) => {
@ -1478,10 +1490,23 @@ onUnmounted(() => {
text-transform: uppercase; text-transform: uppercase;
} }
.post-id { .post-agent-info {
display: flex;
align-items: center;
gap: 6px;
}
.post-id,
.post-username {
font-family: 'JetBrains Mono', monospace; font-family: 'JetBrains Mono', monospace;
font-size: 10px; font-size: 10px;
color: #999; color: #666;
line-height: 1;
vertical-align: baseline;
}
.post-username {
margin-right: 6px;
} }
.post-text { .post-text {