Session Details implemented
This commit is contained in:
@@ -9,6 +9,7 @@ router.post('/sessions', (req, res) => {
|
||||
sessions.set(sessionId, {
|
||||
state: SessionState.SETUP,
|
||||
topic: null,
|
||||
description: null,
|
||||
expectedResponses: 0,
|
||||
submittedCount: 0,
|
||||
responses: new Map(),
|
||||
|
||||
@@ -34,15 +34,15 @@ export class LLMService {
|
||||
Each participant's desire set includes 'wants', 'accepts', 'noGoes', and an 'afraidToAsk' field. The 'afraidToAsk' field contains a sensitive idea that the participant is hesitant to express publicly.
|
||||
|
||||
Here are the rules for categorization and synthesis, with special handling for 'afraidToAsk' ideas:
|
||||
- "goTo": Synthesize a text describing what ALL participants want without contradictions. This should include 'afraidToAsk' ideas that semantically match all other participant's 'wants' or 'afraidToAsk'. If an 'afraidToAsk' idea matches, it should be treated as a 'want' for the submitting participant.
|
||||
- "alsoGood": Synthesize a text describing what at least one participant wants (including matched 'afraidToAsk' ideas), not everyone wants but all other participants at least accept, and is not a "noGoes" for anyone. This should reflect a generally agreeable outcome.
|
||||
- "considerable": Synthesize a text describing what is wanted or accepted by some, but not all, participants (including matched 'afraidToAsk' ideas), and is not a "noGoes" for anyone. This should highlight areas of partial agreement or options that could be explored.
|
||||
- "noGoes": Synthesize a text describing what at least ONE participant does not want. This should clearly state the collective exclusions.
|
||||
- "goTo": Synthesize a text describing what ALL participants want without contradictions. This should include 'afraidToAsk' ideas that semantically match all other participant's 'wants' or 'afraidToAsk'. If an 'afraidToAsk' idea matches, it should be treated as a 'want' for the submitting participant. Use the more specific opinions and leave all the specific options if they do not contradict each other drastically.
|
||||
- "alsoGood": Synthesize a text describing what at least one participant wants (including matched 'afraidToAsk' ideas), not everyone wants but all other participants at least accept, and is not a "noGoes" for anyone. This should reflect a generally agreeable outcome. Use the more specific opinions and leave all the specific options if they do not contradict each other drastically.
|
||||
- "considerable": Synthesize a text describing what is wanted or accepted by some, but not all, participants (including matched 'afraidToAsk' ideas), and is not a "noGoes" for anyone. This should highlight areas of partial agreement or options that could be explored. Use the more specific opinions and leave all the specific options if they do not contradict each other drastically.
|
||||
- "noGoes": Synthesize a text describing what at least ONE participant does not want. This should clearly state the collective exclusions. Use the more broad opinions summarizing all the specific options if they do not contradict each other drastically.
|
||||
- "needsDiscussion": Synthesize a text describing where there is a direct conflict (e.g., one participant wants it, another does not want it). This should highlight areas requiring further negotiation. Do not include 'afraidToAsk' in this category.
|
||||
|
||||
'AfraidToAsk' ideas that do NOT semantically match any other participant's 'wants' or 'accepts' should remain private and NOT be included in any of the synthesized categories.
|
||||
|
||||
Prioritize more specific desires over more broad ones for positive categories ("goTo", "alsoGood", "considerable"). For negative categories ("noGoes", "needsDiscussion"), prioritize more broad ideas over more specific ones. Formulate common ideas from the point of 'us', e.g. "We are going to...", or "We want to...", or "We think..."
|
||||
Formulate common ideas from the point of 'us', e.g. "We are going to...", or "We want to...", or "We think...", or "We do not...".
|
||||
|
||||
The input will be a JSON object containing a list of desire sets. Each desire set has a participantId (implicitly handled by the array index) and four arrays/strings: "wants", "accepts", "noGoes", and "afraidToAsk".
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ interface EncryptedResponseData {
|
||||
interface SessionData {
|
||||
state: SessionState; // Current phase of the session
|
||||
topic: string | null; // The topic of the session
|
||||
description: string | null; // The description of the session
|
||||
expectedResponses: number; // The number set by the first user in State A.
|
||||
submittedCount: number; // The current count of submitted responses.
|
||||
responses: Map<string, EncryptedResponseData>; // Stores the submitted desire objects. Map<ClientID, EncryptedResponseData>
|
||||
@@ -117,6 +118,7 @@ export const createWebSocketServer = (server: any) => {
|
||||
sessions.set(sessionId, {
|
||||
state: SessionState.SETUP,
|
||||
topic: null,
|
||||
description: null,
|
||||
expectedResponses: 0,
|
||||
submittedCount: 0,
|
||||
responses: new Map<string, any>(),
|
||||
@@ -204,13 +206,14 @@ export const handleWebSocketMessage = async (ws: WebSocket, sessionId: string, p
|
||||
|
||||
case 'SETUP_SESSION':
|
||||
if (sessionData.state === SessionState.SETUP) {
|
||||
const { expectedResponses, topic } = payload;
|
||||
const { expectedResponses, topic, description } = payload;
|
||||
if (typeof expectedResponses !== 'number' || expectedResponses <= 0) {
|
||||
ws.send(JSON.stringify({ type: 'ERROR', payload: { message: 'Invalid expectedResponses' } }));
|
||||
return;
|
||||
}
|
||||
sessionData.expectedResponses = expectedResponses;
|
||||
sessionData.topic = topic || 'Untitled Session';
|
||||
sessionData.description = description || null;
|
||||
sessionData.state = SessionState.GATHERING;
|
||||
broadcastToSession(sessionId, { type: 'STATE_UPDATE', payload: {} });
|
||||
console.log(`Session ${sessionId} moved to GATHERING with topic "${sessionData.topic}" and ${expectedResponses} expected responses.`);
|
||||
|
||||
Reference in New Issue
Block a user