File size: 6,689 Bytes
0bb4dfa
53edcb8
0bb4dfa
 
a808caa
0bb4dfa
958ebfa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0bb4dfa
 
a808caa
 
 
 
 
 
 
 
 
 
 
 
0bb4dfa
 
 
 
 
 
 
 
 
 
 
 
af5d1df
 
11bf9b7
 
0bb4dfa
a808caa
 
 
 
 
 
cdef1a0
 
e661e91
 
 
 
 
a808caa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0bb4dfa
 
 
 
 
 
 
 
 
 
6a3a7e1
0bb4dfa
 
 
 
 
 
 
 
 
 
af5d1df
 
0bb4dfa
958ebfa
 
 
 
 
 
 
 
 
 
 
 
 
 
a808caa
 
 
 
 
 
 
 
 
0bb4dfa
a808caa
 
 
 
 
 
 
cdef1a0
 
e661e91
 
 
 
 
a808caa
 
 
 
 
 
 
 
 
0bb4dfa
a808caa
 
 
 
 
0bb4dfa
d4017c8
0bb4dfa
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import React from 'react';
import { UserPlus, UserCheck, Table2 } from 'lucide-react';
import AuthBadge from './AuthBadge';
import ParticipantDropdown from './ParticipantDropdown';
import DownloadMenu from './DownloadMenu';
import DevMenu from './DevMenu';
import HeaderMoreMenu from './HeaderMoreMenu';

function HumanParticipantButton({ humanParticipant, onOpenHumanModal, className }) {
  return (
    <button
      type="button"
      className={
        'btn-sm btn-outline ccai-human-add-btn header-actions-desktop'
        + (className ? ` ${className}` : '')
        + (humanParticipant ? ' ccai-human-add-btn-active' : '')
      }
      onClick={onOpenHumanModal}
      title={humanParticipant
        ? `Edit ${humanParticipant.name}'s credential summary`
        : 'Add a human participant to the conversation'}
    >
      {humanParticipant ? (
        <>
          <UserCheck size={14} style={{ marginRight: 4 }} />
          {humanParticipant.name}
        </>
      ) : (
        <>
          <UserPlus size={14} style={{ marginRight: 4 }} />
          Add a Human Participant
        </>
      )}
    </button>
  );
}

function TableViewButton({ hasChat, onShowTableView, className }) {
  return (
    <button
      type="button"
      className={
        'btn-sm btn-outline ccai-table-view-btn header-actions-desktop'
        + (className ? ` ${className}` : '')
      }
      onClick={onShowTableView}
      disabled={!hasChat}
      title={hasChat
        ? 'Open the conversation summary table'
        : 'Start a chat to view the summary table'}
    >
      <Table2 size={14} style={{ marginRight: 4 }} />
      Table View
    </button>
  );
}

/**
 * Header bar: brand on the left; on the right, auth badge, participant
 * dropdown, downloads dropdown, settings (gear) dropdown.
 *
 * The standalone Sun/Moon theme toggle that used to live here has moved
 * inside the DevMenu (Theme is the top item in the settings panel).
 *
 * NOTE: every prop that goes to DevMenu is forwarded *explicitly* below
 * (no `...devProps` rest spread). The previous spread pattern hid the
 * `maxParticipants` value because Header destructured it for its own
 * use, which silently stripped it from the spread that fed DevMenu;
 * the Max Participants stepper then received `undefined` and produced
 * NaN on every click, which manifested as "the +/- buttons do nothing".
 */
export default function Header({
  theme,
  onToggleTheme,
  auth,

  catalog,
  expertPersonas,
  selectedIds,
  maxParticipants,
  onToggleParticipant,
  onOpenExpertModal,
  autoSelectMode,
  onToggleAutoSelectMode,
  humanParticipant,
  onOpenHumanModal,

  // Models / display
  allModels,
  orchestratorModel,
  onOrchestratorChange,
  summarizerModel,
  onSummarizerChange,
  speedPriority,
  onSpeedPriorityChange,
  conversationFormats,
  conversationStructureId,
  onConversationStructureChange,
  decisionMethodId,
  onDecisionMethodChange,
  showResponseTime,
  onShowResponseTimeChange,
  showChatStats,
  onShowChatStatsChange,
  onMaxParticipantsChange,

  participants,
  modelAssignments,
  onModelAssignmentChange,

  // Modals / transparency
  onShowTableView,
  onShowCredentials,
  hasCredentials,
  onShowPromptCatalog,
  onShowConversationLimits,
  conversationLimitsOverridden,

  // Downloads
  onDownloadChatTxt,
  onDownloadChatMd,
  onDownloadCsvTable,
  onDownloadApiLog,
  hasApiLog,
  hasChat,
}) {
  return (
    <header className="app-header">
      <div className="header-left">
        <a href="https://www.neon.ai/" target="_blank" rel="noopener noreferrer" className="header-brand-link">
          <img src="/neon-logo.png" alt="Neon.ai" className="app-logo" />
        </a>
        <h1 className="app-title">
          <a href="https://www.neon.ai/" target="_blank" rel="noopener noreferrer" className="app-title-link">
            Neon.ai
          </a> - Collaborative Conversational AI (CCAI) Demo
        </h1>
      </div>
      <div className="header-right">
        <ParticipantDropdown
          catalog={catalog}
          expertPersonas={expertPersonas}
          selectedIds={selectedIds}
          maxParticipants={maxParticipants}
          onToggleParticipant={onToggleParticipant}
          onOpenExpertModal={onOpenExpertModal}
          autoSelectMode={autoSelectMode}
          onToggleAutoSelectMode={onToggleAutoSelectMode}
        />
        <HumanParticipantButton
          humanParticipant={humanParticipant}
          onOpenHumanModal={onOpenHumanModal}
        />
        <TableViewButton
          hasChat={hasChat}
          onShowTableView={onShowTableView}
        />
        <HeaderMoreMenu
          humanParticipant={humanParticipant}
          onOpenHumanModal={onOpenHumanModal}
          hasChat={hasChat}
          onShowTableView={onShowTableView}
        />
        <DownloadMenu
          hasChat={hasChat}
          hasApiLog={hasApiLog}
          onShowTableView={onShowTableView}
          onDownloadChatTxt={onDownloadChatTxt}
          onDownloadChatMd={onDownloadChatMd}
          onDownloadCsvTable={onDownloadCsvTable}
          onDownloadApiLog={onDownloadApiLog}
        />
        <DevMenu
          theme={theme}
          onToggleTheme={onToggleTheme}
          allModels={allModels}
          orchestratorModel={orchestratorModel}
          onOrchestratorChange={onOrchestratorChange}
          summarizerModel={summarizerModel}
          onSummarizerChange={onSummarizerChange}
          speedPriority={speedPriority}
          onSpeedPriorityChange={onSpeedPriorityChange}
          conversationFormats={conversationFormats}
          conversationStructureId={conversationStructureId}
          onConversationStructureChange={onConversationStructureChange}
          decisionMethodId={decisionMethodId}
          onDecisionMethodChange={onDecisionMethodChange}
          showResponseTime={showResponseTime}
          onShowResponseTimeChange={onShowResponseTimeChange}
          showChatStats={showChatStats}
          onShowChatStatsChange={onShowChatStatsChange}
          maxParticipants={maxParticipants}
          onMaxParticipantsChange={onMaxParticipantsChange}
          participants={participants}
          modelAssignments={modelAssignments}
          onModelAssignmentChange={onModelAssignmentChange}
          onOpenExpertModal={onOpenExpertModal}
          onShowCredentials={onShowCredentials}
          hasCredentials={hasCredentials}
          onShowPromptCatalog={onShowPromptCatalog}
          onShowConversationLimits={onShowConversationLimits}
          conversationLimitsOverridden={conversationLimitsOverridden}
        />
        <AuthBadge auth={auth} />
      </div>
    </header>
  );
}