fix(UI-Overhaul-Phase1): 7 Bugs behoben
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
1.1 Contacts refresh: useUnifiedContacts mutations already invalidate (verified)
1.2 Contacts drag-drop: ContactList items already draggable + ContactFolderTree onDrop (verified)
1.3 Contacts move dialog: Added move-to-folder dropdown in ContactDetail
1.4 Wiki save refresh: Added refreshKey prop to WikiBrowser, triggers reload after save/delete
1.5 Calendar dialog close: Window.tsx now injects windowId into componentProps
1.6 Communication AI chat: Added metadata support to ConversationCreate schema + service,
frontend passes conversation_type metadata for AI/system chats,
categorization checks metadata first
1.7 Wiki duplicate menu: Removed hardcoded /wiki from Sidebar.tsx (plugin provides it dynamically)
Backend: kommunikation schema/routes/services updated for metadata support
Frontend: tsc clean, build successful
This commit is contained in:
@@ -89,6 +89,10 @@ type ConversationCategory = 'system' | 'ai' | 'colleague';
|
||||
// ─── Helpers ───
|
||||
|
||||
function categorizeConversation(conv: Conversation): ConversationCategory {
|
||||
// Check metadata first (most reliable for AI/system chats)
|
||||
const convType = conv.metadata?.conversation_type;
|
||||
if (convType === 'system') return 'system';
|
||||
if (convType === 'ai') return 'ai';
|
||||
// System messages: created by system participant type
|
||||
if (conv.participants.some(p => p.participant_type === 'system')) return 'system';
|
||||
// AI conversations: have an AI participant
|
||||
@@ -136,12 +140,13 @@ async function sendMessage(convId: string, content: string, replyToId?: string):
|
||||
return r.data;
|
||||
}
|
||||
|
||||
async function createConversation(title: string | null, participantIds: string[], isDirect: boolean, initialMessage?: string): Promise<Conversation> {
|
||||
async function createConversation(title: string | null, participantIds: string[], isDirect: boolean, initialMessage?: string, metadata?: Record<string, unknown>): Promise<Conversation> {
|
||||
const r = await apiClient.post('/comm/conversations', {
|
||||
title,
|
||||
participant_ids: participantIds,
|
||||
is_direct: isDirect,
|
||||
initial_message: initialMessage,
|
||||
metadata: metadata || {},
|
||||
});
|
||||
return r.data;
|
||||
}
|
||||
@@ -781,7 +786,11 @@ export function CommunicationPage() {
|
||||
try {
|
||||
const category = showNewChat;
|
||||
const isDirect = category === 'colleague' && participantIds.length === 1;
|
||||
const conv = await createConversation(title || null, participantIds, isDirect);
|
||||
const metadata: Record<string, unknown> =
|
||||
category === 'ai' ? { conversation_type: 'ai' } :
|
||||
category === 'system' ? { conversation_type: 'system' } :
|
||||
{};
|
||||
const conv = await createConversation(title || null, participantIds, isDirect, undefined, metadata);
|
||||
setConversations(prev => [...prev, conv]);
|
||||
setActiveConvId(conv.id);
|
||||
setMobileView('chat');
|
||||
|
||||
Reference in New Issue
Block a user