jostlebot commited on
Commit
f6bfe81
·
1 Parent(s): 6164981

Move setup to main area, keep ARI tools in sidebar, add reset button

Browse files
Files changed (1) hide show
  1. static/index.html +251 -44
static/index.html CHANGED
@@ -514,6 +514,120 @@
514
  box-shadow: 0 8px 30px var(--accent-glow);
515
  }
516
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
517
  /* Input Area */
518
  .input-area {
519
  padding: 20px 24px;
@@ -632,28 +746,6 @@
632
  <p>Assistive Relational Intelligence</p>
633
  </div>
634
 
635
- <!-- Settings -->
636
- <div class="settings-section">
637
- <h3>Conversation Partner</h3>
638
- <div class="setting-row">
639
- <label>Attachment Style</label>
640
- <select id="attachment-style">
641
- <option value="anxious">Anxious - Seeks reassurance</option>
642
- <option value="avoidant">Avoidant - Needs space when stressed</option>
643
- <option value="disorganized">Disorganized - Mixed signals</option>
644
- <option value="secure">Secure - Open communication</option>
645
- </select>
646
- </div>
647
- <div class="setting-row">
648
- <label>Conversation Difficulty</label>
649
- <select id="difficulty">
650
- <option value="gentle">Gentle - Minor tension</option>
651
- <option value="moderate">Moderate - Recurring issue</option>
652
- <option value="intense">Intense - Significant conflict</option>
653
- <option value="crisis">Crisis - Crossroads</option>
654
- </select>
655
- </div>
656
- </div>
657
 
658
  <!-- PRIMARY TEND TOOL -->
659
  <div class="tend-section">
@@ -738,7 +830,58 @@
738
 
739
  <!-- MAIN CONTENT -->
740
  <main class="main-content">
741
- <div class="content-header">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
742
  <div class="partner-info">
743
  <div class="partner-avatar" id="partner-avatar">P</div>
744
  <div class="partner-details">
@@ -746,26 +889,15 @@
746
  <span id="partner-style">Anxious attachment</span>
747
  </div>
748
  </div>
749
- <div id="active-tool-display">
750
- <span class="active-tool-badge tend">TEND Ready</span>
 
 
 
751
  </div>
752
  </div>
753
 
754
- <div class="conversation-area" id="conversation">
755
- <div class="welcome-message">
756
- <h2>Welcome to Tend & Send</h2>
757
- <p>
758
- This prototype demonstrates ARI (Assistive Relational Intelligence) - tools designed
759
- to support your real relationships, not replace them.
760
- </p>
761
- <p>
762
- Use <strong>TEND</strong> to transform your messages with NVC clarity and warmth.
763
- The toolkit offers additional support for receiving difficult messages,
764
- checking your intention, and finding observations beneath judgments.
765
- </p>
766
- <button class="start-btn" onclick="startConversation()">Start Conversation</button>
767
- </div>
768
- </div>
769
 
770
  <div class="input-area">
771
  <div class="input-row">
@@ -1103,18 +1235,93 @@
1103
  // ============================================================================
1104
  // CONVERSATION
1105
  // ============================================================================
 
 
 
1106
  async function startConversation() {
1107
  const style = document.getElementById('attachment-style').value;
1108
  const difficulty = document.getElementById('difficulty').value;
 
 
 
1109
 
 
 
 
1110
  document.getElementById('conversation').innerHTML = '';
1111
  conversationHistory = [];
1112
  conversationStarted = true;
1113
 
1114
- const openingMessage = OPENING_MESSAGES[style][difficulty];
1115
- addMessage('partner', openingMessage);
1116
- lastPartnerMessage = openingMessage;
1117
- conversationHistory.push({ role: 'assistant', content: openingMessage });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1118
  }
1119
 
1120
  async function sendMessage() {
 
514
  box-shadow: 0 8px 30px var(--accent-glow);
515
  }
516
 
517
+ /* Setup Panel - Top of Main Area */
518
+ .setup-panel {
519
+ background: var(--bg-card);
520
+ border-bottom: 1px solid var(--border);
521
+ padding: 20px 24px;
522
+ }
523
+
524
+ .setup-header h2 {
525
+ font-size: 1.2rem;
526
+ margin-bottom: 16px;
527
+ color: var(--text-primary);
528
+ }
529
+
530
+ .setup-grid {
531
+ display: grid;
532
+ grid-template-columns: 1fr 1fr;
533
+ gap: 12px 20px;
534
+ align-items: end;
535
+ }
536
+
537
+ .setup-col {
538
+ display: flex;
539
+ flex-direction: column;
540
+ }
541
+
542
+ .setup-col.full-width {
543
+ grid-column: 1 / -1;
544
+ }
545
+
546
+ .setup-col label {
547
+ font-size: 0.8rem;
548
+ color: var(--text-secondary);
549
+ margin-bottom: 6px;
550
+ }
551
+
552
+ .setup-col select,
553
+ .setup-col textarea {
554
+ padding: 10px 12px;
555
+ background: var(--bg-input);
556
+ border: 1px solid var(--border);
557
+ border-radius: 6px;
558
+ color: var(--text-primary);
559
+ font-size: 0.9rem;
560
+ font-family: inherit;
561
+ }
562
+
563
+ .setup-col textarea {
564
+ resize: none;
565
+ }
566
+
567
+ .setup-col select:focus,
568
+ .setup-col textarea:focus {
569
+ outline: none;
570
+ border-color: var(--accent);
571
+ }
572
+
573
+ .setup-options {
574
+ display: flex;
575
+ gap: 16px;
576
+ padding-top: 6px;
577
+ }
578
+
579
+ .setup-option {
580
+ display: flex;
581
+ align-items: center;
582
+ gap: 6px;
583
+ }
584
+
585
+ .setup-option input[type="radio"] {
586
+ accent-color: var(--accent);
587
+ }
588
+
589
+ .setup-option label {
590
+ font-size: 0.85rem;
591
+ color: var(--text-secondary);
592
+ cursor: pointer;
593
+ }
594
+
595
+ .setup-col .start-btn {
596
+ width: 100%;
597
+ padding: 12px 20px;
598
+ }
599
+
600
+ .header-right {
601
+ display: flex;
602
+ align-items: center;
603
+ gap: 12px;
604
+ }
605
+
606
+ .reset-btn {
607
+ padding: 8px 14px;
608
+ background: transparent;
609
+ border: 1px solid var(--border);
610
+ color: var(--text-secondary);
611
+ border-radius: 6px;
612
+ font-size: 0.8rem;
613
+ cursor: pointer;
614
+ transition: all 0.2s;
615
+ }
616
+
617
+ .reset-btn:hover {
618
+ border-color: var(--accent);
619
+ color: var(--accent-light);
620
+ }
621
+
622
+ @media (max-width: 700px) {
623
+ .setup-grid {
624
+ grid-template-columns: 1fr;
625
+ }
626
+ .setup-col.full-width {
627
+ grid-column: 1;
628
+ }
629
+ }
630
+
631
  /* Input Area */
632
  .input-area {
633
  padding: 20px 24px;
 
746
  <p>Assistive Relational Intelligence</p>
747
  </div>
748
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
749
 
750
  <!-- PRIMARY TEND TOOL -->
751
  <div class="tend-section">
 
830
 
831
  <!-- MAIN CONTENT -->
832
  <main class="main-content">
833
+ <!-- SETUP PANEL (top of main area) -->
834
+ <div class="setup-panel" id="setup-panel">
835
+ <div class="setup-header">
836
+ <h2>Set Up Your Practice Conversation</h2>
837
+ </div>
838
+ <div class="setup-grid">
839
+ <div class="setup-col">
840
+ <label for="attachment-style">Partner's Attachment Style</label>
841
+ <select id="attachment-style">
842
+ <option value="anxious">Anxious - Seeks reassurance, fears abandonment</option>
843
+ <option value="avoidant">Avoidant - Needs space when stressed, pulls away</option>
844
+ <option value="disorganized">Disorganized - Mixed signals, push-pull</option>
845
+ <option value="secure">Secure - Open, direct communication</option>
846
+ </select>
847
+ </div>
848
+ <div class="setup-col">
849
+ <label for="difficulty">Conversation Difficulty</label>
850
+ <select id="difficulty">
851
+ <option value="gentle">Gentle - Minor misunderstanding</option>
852
+ <option value="moderate">Moderate - Recurring tension</option>
853
+ <option value="intense">Intense - Significant conflict</option>
854
+ <option value="crisis">Crisis - Relationship crossroads</option>
855
+ </select>
856
+ </div>
857
+ <div class="setup-col full-width">
858
+ <label for="conversation-context">What's the situation? (optional)</label>
859
+ <textarea id="conversation-context" rows="2" placeholder="Example: We had a fight about how much time I spend at work..."></textarea>
860
+ </div>
861
+ <div class="setup-col full-width">
862
+ <label for="user-goal">What do you want to practice? (optional)</label>
863
+ <textarea id="user-goal" rows="1" placeholder="Example: Staying calm and hearing their perspective..."></textarea>
864
+ </div>
865
+ <div class="setup-col">
866
+ <div class="setup-options">
867
+ <div class="setup-option">
868
+ <input type="radio" name="who-starts" id="partner-starts" value="partner" checked>
869
+ <label for="partner-starts">Partner starts</label>
870
+ </div>
871
+ <div class="setup-option">
872
+ <input type="radio" name="who-starts" id="user-starts" value="user">
873
+ <label for="user-starts">I start</label>
874
+ </div>
875
+ </div>
876
+ </div>
877
+ <div class="setup-col">
878
+ <button class="start-btn" onclick="startConversation()">Start Conversation</button>
879
+ </div>
880
+ </div>
881
+ </div>
882
+
883
+ <!-- CONVERSATION HEADER (shows after start) -->
884
+ <div class="content-header" id="content-header" style="display: none;">
885
  <div class="partner-info">
886
  <div class="partner-avatar" id="partner-avatar">P</div>
887
  <div class="partner-details">
 
889
  <span id="partner-style">Anxious attachment</span>
890
  </div>
891
  </div>
892
+ <div class="header-right">
893
+ <div id="active-tool-display">
894
+ <span class="active-tool-badge tend">TEND Ready</span>
895
+ </div>
896
+ <button class="reset-btn" onclick="resetConversation()">New Conversation</button>
897
  </div>
898
  </div>
899
 
900
+ <div class="conversation-area" id="conversation"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
901
 
902
  <div class="input-area">
903
  <div class="input-row">
 
1235
  // ============================================================================
1236
  // CONVERSATION
1237
  // ============================================================================
1238
+ let conversationContext = '';
1239
+ let userGoal = '';
1240
+
1241
  async function startConversation() {
1242
  const style = document.getElementById('attachment-style').value;
1243
  const difficulty = document.getElementById('difficulty').value;
1244
+ conversationContext = document.getElementById('conversation-context')?.value?.trim() || '';
1245
+ userGoal = document.getElementById('user-goal')?.value?.trim() || '';
1246
+ const whoStarts = document.querySelector('input[name="who-starts"]:checked')?.value || 'partner';
1247
 
1248
+ // Hide setup, show conversation
1249
+ document.getElementById('setup-panel').style.display = 'none';
1250
+ document.getElementById('content-header').style.display = 'flex';
1251
  document.getElementById('conversation').innerHTML = '';
1252
  conversationHistory = [];
1253
  conversationStarted = true;
1254
 
1255
+ // Update partner info display
1256
+ const styleLabels = {
1257
+ anxious: 'Anxious attachment',
1258
+ avoidant: 'Avoidant attachment',
1259
+ disorganized: 'Disorganized attachment',
1260
+ secure: 'Secure attachment'
1261
+ };
1262
+ document.getElementById('partner-style').textContent = styleLabels[style];
1263
+ document.getElementById('partner-avatar').textContent = style[0].toUpperCase();
1264
+
1265
+ // If user starts, just wait for their input
1266
+ if (whoStarts === 'user') {
1267
+ addMessage('ari', `Ready to practice. Your partner has ${styleLabels[style].toLowerCase()} tendencies. ${userGoal ? 'Your goal: ' + userGoal : ''} Type your opening message.`, 'Setup', false);
1268
+ return;
1269
+ }
1270
+
1271
+ // Partner starts - generate contextual opening based on user input
1272
+ if (conversationContext) {
1273
+ addLoading();
1274
+ try {
1275
+ const contextPrompt = `${PARTNER_PROMPTS[style][difficulty]}
1276
+
1277
+ CONTEXT: ${conversationContext}
1278
+ ${userGoal ? 'The other person wants to practice: ' + userGoal : ''}
1279
+
1280
+ Based on this context, send an opening message that fits your attachment style and the described situation. 1-3 sentences. Be realistic and stay in character.`;
1281
+
1282
+ const response = await fetch('/api/chat', {
1283
+ method: 'POST',
1284
+ headers: { 'Content-Type': 'application/json' },
1285
+ body: JSON.stringify({
1286
+ messages: [{ role: 'user', content: 'Start the conversation based on the context provided.' }],
1287
+ system: contextPrompt,
1288
+ max_tokens: 200
1289
+ })
1290
+ });
1291
+
1292
+ const data = await response.json();
1293
+ removeLoading();
1294
+
1295
+ if (data.content && data.content[0]) {
1296
+ const openingMessage = data.content[0].text;
1297
+ addMessage('partner', openingMessage);
1298
+ lastPartnerMessage = openingMessage;
1299
+ conversationHistory.push({ role: 'assistant', content: openingMessage });
1300
+ }
1301
+ } catch (error) {
1302
+ removeLoading();
1303
+ const openingMessage = OPENING_MESSAGES[style][difficulty];
1304
+ addMessage('partner', openingMessage);
1305
+ lastPartnerMessage = openingMessage;
1306
+ conversationHistory.push({ role: 'assistant', content: openingMessage });
1307
+ }
1308
+ } else {
1309
+ const openingMessage = OPENING_MESSAGES[style][difficulty];
1310
+ addMessage('partner', openingMessage);
1311
+ lastPartnerMessage = openingMessage;
1312
+ conversationHistory.push({ role: 'assistant', content: openingMessage });
1313
+ }
1314
+ }
1315
+
1316
+ function resetConversation() {
1317
+ // Show setup, hide conversation header
1318
+ document.getElementById('setup-panel').style.display = 'block';
1319
+ document.getElementById('content-header').style.display = 'none';
1320
+ document.getElementById('conversation').innerHTML = '';
1321
+ conversationHistory = [];
1322
+ conversationStarted = false;
1323
+ lastPartnerMessage = '';
1324
+ exitWorkspaceMode();
1325
  }
1326
 
1327
  async function sendMessage() {