fixed bug related to moderator position status in discussion guide

This commit is contained in:
michael 2025-08-11 16:39:59 -05:00
parent 1c6e2e62e8
commit d5dc0bc3af
6 changed files with 70 additions and 55 deletions

BIN
.DS_Store vendored

Binary file not shown.

View file

@ -660,15 +660,8 @@ def set_moderator_position(focus_group_id):
if "error" in result:
return jsonify(result), 404 if "not found" in result["error"] else 400
# Emit WebSocket event for moderator position change
from app.models.focus_group import emit_websocket_event
emit_websocket_event('moderator_status_update', focus_group_id, {
'current_section_id': result.get('current_section_id'),
'current_item_id': result.get('current_item_id'),
'current_section': result.get('current_section'),
'current_item': result.get('current_item'),
'progress': result.get('progress')
})
# WebSocket event is already emitted by AIModeratorService.set_moderator_position()
# No need to emit duplicate event here
return jsonify(result), 200

View file

@ -26,7 +26,10 @@ thoughtful response that reflects your persona's characteristics, values, and co
10. For short responses, focus on authentic reactions, agreements, disagreements, or brief insights.
11. For medium responses, provide your perspective with some reasoning or a brief example.
12. For long responses, elaborate with personal experiences, detailed thoughts, or multiple perspectives.
13. **VISUAL CONTEXT**: If you are responding to or referencing visual content (images, creative assets, etc.) in your response, follow these guidelines:
13. **INDEPENDENT THINKING**: Draw from your unique background, experiences, and perspective. Even when you agree with others, add your own personal context, reasoning, or examples that reflect your individual viewpoint. Avoid simply restating what others have said.
14. **AUTHENTIC AGREEMENT**: If you genuinely agree with a previous response based on your persona's characteristics, it's okay to express agreement - but always explain WHY you agree from your personal perspective and add something new to the conversation (your own experience, a different angle, or additional insight).
15. **DIVERSE PERSPECTIVES**: Before responding, consider how your persona's unique traits, background, and experiences might lead to a perspective that's distinct from what's already been shared. Your response should feel authentically yours, not like an echo of previous messages.
16. **VISUAL CONTEXT**: If you are responding to or referencing visual content (images, creative assets, etc.) in your response, follow these guidelines:
a. **Priority**: Focus on the image that is most directly relevant to the current question or most recently mentioned by the moderator.
b. **Identification**: Describe specific visual or textual features of the image you're discussing to clearly identify it. Since there may be multiple creative review images in the conversation context, include details like colors, text, objects, layout, brand names, or other distinctive visual elements.
c. **Examples**: "Looking at the red Coca-Cola advertisement with the polar bear..." or "In the Colgate toothpaste ad with the blue and white packaging..." or "The Nike shoe advertisement showing the black high-top sneakers..."

File diff suppressed because one or more lines are too long

2
dist/index.html vendored
View file

@ -7,7 +7,7 @@
<meta name="description" content="Lovable Generated Project" />
<meta name="author" content="Lovable" />
<meta property="og:image" content="/og-image.png" />
<script type="module" crossorigin src="/semblance/assets/index-C2iKqYFP.js"></script>
<script type="module" crossorigin src="/semblance/assets/index-C4rrBVCh.js"></script>
<link rel="stylesheet" crossorigin href="/semblance/assets/index-BttT7ZR2.css">
</head>

View file

@ -2198,6 +2198,12 @@ const FocusGroupSession = () => {
};
// Send to API first with visual asset information
console.log('📤 Sending moderator message to API:', {
text: enhancedMessageText,
attachedAssets,
activatesVisualContext
});
try {
const msgResponse = await focusGroupsApi.sendMessage(id, {
senderId: 'moderator',
@ -2209,18 +2215,31 @@ const FocusGroupSession = () => {
if (msgResponse?.data?.message_id) {
moderatorMessage.id = msgResponse.data.message_id;
console.log('✅ Message API call successful, assigned ID:', moderatorMessage.id);
} else {
console.warn('⚠️ Message API call succeeded but no message_id returned:', msgResponse?.data);
}
} catch (msgError) {
console.warn("Failed to save message to API, showing locally:", msgError);
console.error('❌ Failed to save message to API:', msgError);
toastService.warning('Message display only', {
description: 'The moderator message is shown locally but may not be saved to the server.'
});
}
// Add the message to the UI
console.log('📨 Adding moderator message to UI:', {
messageId: moderatorMessage.id,
text: moderatorMessage.text,
hasAssets: attachedAssets.length > 0
});
handleNewMessage(moderatorMessage);
// Close dialog first for immediate feedback
setSetPositionDialog({ isOpen: false });
// Note: Moderator status will be updated automatically via WebSocket event
// Don't fetch moderator status immediately to avoid race condition
// The status will update via WebSocket or next polling cycle
console.log('✅ Set position complete, moderator message added to UI');
toastService.success('Moderator position set', {
description: `Position set to "${setPositionDialog.itemTitle}" in "${setPositionDialog.sectionTitle}"`