[verified] Fix group chat agent member sync (#877)
This commit is contained in:
@@ -186,7 +186,7 @@ export async function listAgents(roomId: string): Promise<{ agents: RoomAgent[]
|
||||
return request(`/api/hermes/group-chat/rooms/${roomId}/agents`)
|
||||
}
|
||||
|
||||
export async function removeAgent(roomId: string, agentId: string): Promise<void> {
|
||||
export async function removeAgent(roomId: string, agentId: string): Promise<{ success: boolean; agents: RoomAgent[]; members: MemberInfo[] }> {
|
||||
return request(`/api/hermes/group-chat/rooms/${roomId}/agents/${agentId}`, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
|
||||
@@ -618,8 +618,9 @@ export const useGroupChatStore = defineStore('groupChat', () => {
|
||||
|
||||
async function removeAgentFromRoom(roomId: string, agentId: string) {
|
||||
try {
|
||||
await removeAgent(roomId, agentId)
|
||||
agents.value = agents.value.filter(a => a.id !== agentId)
|
||||
const res = await removeAgent(roomId, agentId)
|
||||
agents.value = res.agents ?? agents.value.filter(a => a.id !== agentId && a.agentId !== agentId)
|
||||
if (res.members) members.value = res.members
|
||||
} catch (err: any) {
|
||||
error.value = err.message
|
||||
throw err
|
||||
|
||||
Reference in New Issue
Block a user