๐คฏ LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
๐ fix(share): shared group topic not show avatar (#11894)
YuTengjing80fb49692e90
diff --git a/locales/ja-JP/error.json b/locales/ja-JP/error.jsonindex 1117e593e8d..451dafbbf76 100644--- a/locales/ja-JP/error.json+++ b/locales/ja-JP/error.json@@ -94,7 +94,7 @@"response.InvalidComfyUIArgs": "ComfyUI ่จญๅฎใๆญฃใใใใใพใใใ่จญๅฎใ็ขบ่ชใใฆใใๅ่ฉฆ่กใใฆใใ ใใ","response.InvalidGithubToken": "GitHub PAT ใ็ฉบใพใใฏๆญฃใใใใใพใใใ็ขบ่ชใใฆใใๅ่ฉฆ่กใใฆใใ ใใ","response.InvalidOllamaArgs": "Ollama ่จญๅฎใๆญฃใใใใใพใใใ่จญๅฎใ็ขบ่ชใใฆใใๅ่ฉฆ่กใใฆใใ ใใ",- "response.InvalidProviderAPIKey": "LobeHub API Key ใ็ฉบใพใใฏๆญฃใใใใใพใใใ็ขบ่ชใใฆใใๅ่ฉฆ่กใใฆใใ ใใ",+ "response.InvalidProviderAPIKey": "{{provider}} API Key ใ็ฉบใพใใฏๆญฃใใใใใพใใใ{{provider}} API Key ใ็ขบ่ชใใฆใใๅ่ฉฆ่กใใฆใใ ใใ","response.InvalidVertexCredentials": "Vertex ่ช่จผใซๅคฑๆใใพใใใ่ช่จผๆ ๅ ฑใ็ขบ่ชใใฆใใๅ่ฉฆ่กใใฆใใ ใใ","response.LocationNotSupportError": "็พๅจใฎๅฐๅใงใฏใใฎใขใใซใตใผใในใฏใตใใผใใใใฆใใพใใ๏ผๅฐๅๅถ้ใพใใฏใตใผใในๆชๅผ้๏ผใๅฉ็จๅฏ่ฝใชๅฐๅใซๅใๆฟใใใใๅฅใฎใขใใซใใญใใคใใผใซๅคๆดใใฆใใๅ่ฉฆ่กใใฆใใ ใใ","response.ModelNotFound": "ๅฉ็จๅฏ่ฝใชใขใใซใ่ฆใคใใใชใใใขใฏใปในๆจฉ้ใใใใพใใใAPI ใญใผใๅใๆฟใใใใๆจฉ้ใ่ชฟๆดใใฆใใๅ่ฉฆ่กใใฆใใ ใใ",diff --git a/locales/ko-KR/error.json b/locales/ko-KR/error.jsonindex 842e9cdd337..85a026d766a 100644--- a/locales/ko-KR/error.json+++ b/locales/ko-KR/error.json@@ -94,7 +94,7 @@"response.InvalidComfyUIArgs": "ComfyUI ์ค์ ์ด ์ฌ๋ฐ๋ฅด์ง ์์ต๋๋ค. ์ค์ ์ ํ์ธํ ํ ๋ค์ ์๋ํ์ธ์","response.InvalidGithubToken": "GitHub PAT๊ฐ ๋น์ด ์๊ฑฐ๋ ์ฌ๋ฐ๋ฅด์ง ์์ต๋๋ค. ํ์ธํ ํ ๋ค์ ์๋ํ์ธ์","response.InvalidOllamaArgs": "Ollama ์ค์ ์ด ์ฌ๋ฐ๋ฅด์ง ์์ต๋๋ค. ์ค์ ์ ํ์ธํ ํ ๋ค์ ์๋ํ์ธ์",- "response.InvalidProviderAPIKey": "LobeHub API Key๊ฐ ๋น์ด ์๊ฑฐ๋ ์ฌ๋ฐ๋ฅด์ง ์์ต๋๋ค. ํ์ธํ ํ ๋ค์ ์๋ํ์ธ์",+ "response.InvalidProviderAPIKey": "{{provider}} API Key๊ฐ ๋น์ด ์๊ฑฐ๋ ์ฌ๋ฐ๋ฅด์ง ์์ต๋๋ค. {{provider}} API Key๋ฅผ ํ์ธํ ํ ๋ค์ ์๋ํ์ธ์","response.InvalidVertexCredentials": "Vertex ์ธ์ฆ์ ์คํจํ์ต๋๋ค. ์ธ์ฆ ์ ๋ณด๋ฅผ ํ์ธํ ํ ๋ค์ ์๋ํ์ธ์","response.LocationNotSupportError": "ํ์ฌ ์ง์ญ์์๋ ์ด ๋ชจ๋ธ ์๋น์ค๊ฐ ์ง์๋์ง ์์ต๋๋ค(์ง์ญ ์ ํ ๋๋ ์๋น์ค ๋ฏธ๊ฐํต). ์ง์ ๊ฐ๋ฅํ ์ง์ญ์ผ๋ก ์ ํํ๊ฑฐ๋ ๋ค๋ฅธ ๋ชจ๋ธ ์ ๊ณต์๋ก ๋ณ๊ฒฝํ ํ ๋ค์ ์๋ํ์ธ์","response.ModelNotFound": "์ฌ์ฉ ๊ฐ๋ฅํ ๋ชจ๋ธ์ ์ฐพ์ ์ ์๊ฑฐ๋ ์ก์ธ์ค ๊ถํ์ด ์์ต๋๋ค. API ํค๋ฅผ ์ ํํ๊ฑฐ๋ ๊ถํ์ ์กฐ์ ํ ํ ๋ค์ ์๋ํ์ธ์",diff --git a/locales/zh-CN/error.json b/locales/zh-CN/error.jsonindex f1d09acbc2f..796e4b0a1b0 100644--- a/locales/zh-CN/error.json+++ b/locales/zh-CN/error.json@@ -94,7 +94,7 @@"response.InvalidComfyUIArgs": "ComfyUI ้ ็ฝฎไธๆญฃ็กฎใ่ฏทๆฃๆฅ้ ็ฝฎๅ้่ฏ","response.InvalidGithubToken": "GitHub PAT ไธบ็ฉบๆไธๆญฃ็กฎใ่ฏทๆฃๆฅๅ้่ฏ","response.InvalidOllamaArgs": "Ollama ้ ็ฝฎไธๆญฃ็กฎใ่ฏทๆฃๆฅ้ ็ฝฎๅ้่ฏ",- "response.InvalidProviderAPIKey": "LobeHub API Key ไธบ็ฉบๆไธๆญฃ็กฎใ่ฏทๆฃๆฅๅ้่ฏ",+ "response.InvalidProviderAPIKey": "{{provider}} API Key ไธบ็ฉบๆไธๆญฃ็กฎ๏ผ่ฏทๆฃๆฅ {{provider}} API Key ๅ้่ฏ","response.InvalidVertexCredentials": "Vertex ้ดๆๅคฑ่ดฅใ่ฏทๆฃๆฅๅญ่ฏๅ้่ฏ","response.LocationNotSupportError": "ๅฝๅๅฐๅบๆไธๆฏๆ่ฏฅๆจกๅๆๅก๏ผๅฏ่ฝๅๅบๅ้ๅถๆๆๅกๆชๅผ้๏ผใ่ฏทๅๆขๅฏ็จๅฐๅบๆๆดๆขๆจกๅๆๅกๅๅ้่ฏ","response.ModelNotFound": "ๆชๆพๅฐๅฏ็จๆจกๅๆๆ ่ฎฟ้ฎๆ้ใ่ฏทๆดๆข API Key ๆ่ฐๆดๆ้ๅ้่ฏ",diff --git a/packages/database/src/models/topicShare.ts b/packages/database/src/models/topicShare.tsindex 519a0701166..6bd7c937706 100644--- a/packages/database/src/models/topicShare.ts+++ b/packages/database/src/models/topicShare.ts@@ -106,8 +106,11 @@ export class TopicShareModel {agentTitle: agents.title,groupAvatar: chatGroups.avatar,groupBackgroundColor: chatGroups.backgroundColor,+ groupCreatedAt: chatGroups.createdAt,groupId: topics.groupId,groupTitle: chatGroups.title,+ groupUpdatedAt: chatGroups.updatedAt,+ groupUserId: chatGroups.userId,ownerId: topicShares.userId,shareId: topicShares.id,title: topics.title,@@ -126,12 +129,16 @@ export class TopicShareModel {const share = result[0];// Fetch group members if this is a group topic- let groupMembers: { avatar: string | null; backgroundColor: string | null }[] | undefined;+ let groupMembers:+ | { avatar: string | null; backgroundColor: string | null; id: string; title: string | null }[]+ | undefined;if (share.groupId) {const members = await db.select({avatar: agents.avatar,backgroundColor: agents.backgroundColor,+ id: agents.id,+ title: agents.title,}).from(chatGroupsAgents).innerJoin(agents, eq(chatGroupsAgents.agentId, agents.id))diff --git a/packages/types/src/agent/item.ts b/packages/types/src/agent/item.tsindex 0192f4d06fa..aed8cd014ef 100644--- a/packages/types/src/agent/item.ts+++ b/packages/types/src/agent/item.ts@@ -8,6 +8,7 @@ import { LobeAgentTTSConfig } from './tts';export interface LobeAgentConfig {avatar?: string;+ backgroundColor?: string;chatConfig: LobeAgentChatConfig;@@ -59,6 +60,11 @@ export interface LobeAgentConfig {*/systemRole: string;+ /**+ * Agent title/name+ */+ title?: string;+/*** Text-to-speech service*/diff --git a/packages/types/src/topic/topic.ts b/packages/types/src/topic/topic.tsindex 1efda5304a9..ad92bd4ecc6 100644--- a/packages/types/src/topic/topic.ts+++ b/packages/types/src/topic/topic.ts@@ -155,8 +155,11 @@ export interface SharedTopicData {groupMeta?: {avatar?: string | null;backgroundColor?: string | null;- members?: { avatar: string | null; backgroundColor: string | null }[];+ createdAt?: Date | null;+ members?: { avatar: string | null; backgroundColor: string | null; id: string; title: string | null }[];title?: string | null;+ updatedAt?: Date | null;+ userId?: string | null;};shareId: string;title: string | null;diff --git a/src/app/[variants]/share/t/[id]/_layout/Title.tsx b/src/app/[variants]/share/t/[id]/_layout/Title.tsxindex 3545994b842..122fb3934c2 100644--- a/src/app/[variants]/share/t/[id]/_layout/Title.tsx+++ b/src/app/[variants]/share/t/[id]/_layout/Title.tsx@@ -1,5 +1,6 @@'use client';+import type { AgentGroupDetail, AgentGroupMember } from '@lobechat/types';import { Text } from '@lobehub/ui';import { memo, useEffect } from 'react';import { useParams } from 'react-router-dom';@@ -8,6 +9,7 @@ import useSWR from 'swr';import PageTitle from '@/components/PageTitle';import { lambdaClient } from '@/libs/trpc/client';import { useAgentStore } from '@/store/agent';+import { useAgentGroupStore } from '@/store/agentGroup';const Title = memo(() => {const { id } = useParams<{ id: string }>();@@ -31,6 +33,53 @@ const Title = memo(() => {}}, [data?.agentId, data?.agentMeta, dispatchAgentMap]);+ // Set group meta to agentGroupStore for group avatar display+ useEffect(() => {+ if (data?.groupId && data.groupMeta) {+ const members = data.groupMeta.members || [];++ // Sync each member to agentStore for subagent avatar display+ for (const member of members) {+ dispatchAgentMap(member.id, {+ avatar: member.avatar ?? undefined,+ backgroundColor: member.backgroundColor ?? undefined,+ title: member.title ?? undefined,+ });+ }++ // Build AgentGroupDetail for groupMap+ const groupDetail: AgentGroupDetail = {+ agents: members.map((m) => ({+ avatar: m.avatar,+ backgroundColor: m.backgroundColor,+ id: m.id,+ isSupervisor: false,+ title: m.title,+ })) as AgentGroupMember[],+ avatar: data.groupMeta.avatar,+ backgroundColor: data.groupMeta.backgroundColor,+ createdAt: data.groupMeta.createdAt ? new Date(data.groupMeta.createdAt) : new Date(),+ id: data.groupId,+ title: data.groupMeta.title,+ updatedAt: data.groupMeta.updatedAt ? new Date(data.groupMeta.updatedAt) : new Date(),+ userId: data.groupMeta.userId || '',+ };++ // Set activeGroupId and update groupMap+ useAgentGroupStore.setState(+ (state) => ({+ activeGroupId: data.groupId!,+ groupMap: {+ ...state.groupMap,+ [data.groupId!]: groupDetail,+ },+ }),+ false,+ 'syncSharedGroupMeta',+ );+ }+ }, [data?.groupId, data?.groupMeta, dispatchAgentMap]);+return (data?.title && (<>diff --git a/src/server/routers/lambda/__tests__/share.test.ts b/src/server/routers/lambda/__tests__/share.test.tsindex 2a2834f6b62..1ebaa5fdf99 100644--- a/src/server/routers/lambda/__tests__/share.test.ts+++ b/src/server/routers/lambda/__tests__/share.test.ts@@ -26,9 +26,12 @@ describe('shareRouter', () => {agentTitle: 'Test Agent',groupAvatar: null,groupBackgroundColor: null,+ groupCreatedAt: null,groupId: null,groupMembers: undefined,groupTitle: null,+ groupUpdatedAt: null,+ groupUserId: null,ownerId: 'user-1',shareId: 'share-123',title: 'Test Topic',@@ -74,9 +77,12 @@ describe('shareRouter', () => {agentTitle: 'Test Agent Title',groupAvatar: null,groupBackgroundColor: null,+ groupCreatedAt: null,groupId: null,groupMembers: undefined,groupTitle: null,+ groupUpdatedAt: null,+ groupUserId: null,ownerId: 'user-1',shareId: 'share-123',title: 'Topic with Agent',@@ -114,12 +120,15 @@ describe('shareRouter', () => {agentTitle: null,groupAvatar: 'group-avatar.png',groupBackgroundColor: '#000000',+ groupCreatedAt: new Date('2024-01-01'),groupId: 'group-1',groupMembers: [- { avatar: 'member1.png', backgroundColor: '#111' },- { avatar: 'member2.png', backgroundColor: '#222' },+ { avatar: 'member1.png', backgroundColor: '#111', id: 'member-1', title: 'Member 1' },+ { avatar: 'member2.png', backgroundColor: '#222', id: 'member-2', title: 'Member 2' },],groupTitle: 'Test Group',+ groupUpdatedAt: new Date('2024-01-02'),+ groupUserId: 'user-1',ownerId: 'user-1',shareId: 'share-456',title: 'Group Topic',@@ -196,9 +205,12 @@ describe('shareRouter', () => {agentTitle: null,groupAvatar: null,groupBackgroundColor: null,+ groupCreatedAt: null,groupId: null,groupMembers: undefined,groupTitle: null,+ groupUpdatedAt: null,+ groupUserId: null,ownerId: 'owner-user',shareId: 'private-share',title: 'Private Topic',diff --git a/src/server/routers/lambda/share.ts b/src/server/routers/lambda/share.tsindex 751880436c9..03a656e706f 100644--- a/src/server/routers/lambda/share.ts+++ b/src/server/routers/lambda/share.ts@@ -40,8 +40,11 @@ export const shareRouter = router({? {avatar: share.groupAvatar,backgroundColor: share.groupBackgroundColor,+ createdAt: share.groupCreatedAt,members: share.groupMembers,title: share.groupTitle,+ updatedAt: share.groupUpdatedAt,+ userId: share.groupUserId,}: undefined,shareId: share.shareId,