@d34dman/flowdrop 0.0.34 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -240,11 +240,6 @@
|
|
|
240
240
|
onkeydown={handleKeydown}
|
|
241
241
|
oninput={handleInput}
|
|
242
242
|
></textarea>
|
|
243
|
-
|
|
244
|
-
<!-- Attachment button placeholder -->
|
|
245
|
-
<button type="button" class="chat-panel__attachment-btn" title="Attach file" disabled>
|
|
246
|
-
<Icon icon="mdi:image-outline" />
|
|
247
|
-
</button>
|
|
248
243
|
</div>
|
|
249
244
|
|
|
250
245
|
{#if $sessionStatus === 'running' || $isExecuting}
|
|
@@ -277,12 +272,14 @@
|
|
|
277
272
|
display: flex;
|
|
278
273
|
flex-direction: column;
|
|
279
274
|
height: 100%;
|
|
275
|
+
min-height: 0; /* Critical: allows flexbox to shrink properly */
|
|
280
276
|
background-color: #ffffff;
|
|
281
277
|
}
|
|
282
278
|
|
|
283
|
-
/* Messages Container */
|
|
279
|
+
/* Messages Container - Scrollable area that takes remaining space */
|
|
284
280
|
.chat-panel__messages {
|
|
285
281
|
flex: 1;
|
|
282
|
+
min-height: 0; /* Critical: allows overflow to work in flex container */
|
|
286
283
|
overflow-y: auto;
|
|
287
284
|
padding: 1.5rem;
|
|
288
285
|
scroll-behavior: smooth;
|
|
@@ -380,10 +377,12 @@
|
|
|
380
377
|
color: #6b7280;
|
|
381
378
|
}
|
|
382
379
|
|
|
383
|
-
/* Input Area */
|
|
380
|
+
/* Input Area - Always stays at bottom, never shrinks */
|
|
384
381
|
.chat-panel__input-area {
|
|
382
|
+
flex-shrink: 0;
|
|
385
383
|
padding: 1rem 1.5rem 1.5rem;
|
|
386
384
|
background-color: #ffffff;
|
|
385
|
+
border-top: 1px solid #f3f4f6;
|
|
387
386
|
}
|
|
388
387
|
|
|
389
388
|
.chat-panel__input-container {
|
|
@@ -434,31 +433,6 @@
|
|
|
434
433
|
opacity: 0.6;
|
|
435
434
|
}
|
|
436
435
|
|
|
437
|
-
.chat-panel__attachment-btn {
|
|
438
|
-
display: flex;
|
|
439
|
-
align-items: center;
|
|
440
|
-
justify-content: center;
|
|
441
|
-
width: 2rem;
|
|
442
|
-
height: 2rem;
|
|
443
|
-
border: none;
|
|
444
|
-
border-radius: 0.375rem;
|
|
445
|
-
background: transparent;
|
|
446
|
-
color: #9ca3af;
|
|
447
|
-
cursor: pointer;
|
|
448
|
-
transition: all 0.15s ease;
|
|
449
|
-
flex-shrink: 0;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
.chat-panel__attachment-btn:hover:not(:disabled) {
|
|
453
|
-
color: #6b7280;
|
|
454
|
-
background-color: #f3f4f6;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
.chat-panel__attachment-btn:disabled {
|
|
458
|
-
opacity: 0.5;
|
|
459
|
-
cursor: not-allowed;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
436
|
.chat-panel__send-btn {
|
|
463
437
|
display: flex;
|
|
464
438
|
align-items: center;
|
|
@@ -533,6 +533,7 @@
|
|
|
533
533
|
display: flex;
|
|
534
534
|
flex-direction: column;
|
|
535
535
|
height: 100%;
|
|
536
|
+
overflow: hidden; /* Prevent playground-level scrolling */
|
|
536
537
|
background-color: #f8fafc;
|
|
537
538
|
font-family:
|
|
538
539
|
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
@@ -744,6 +745,8 @@
|
|
|
744
745
|
display: flex;
|
|
745
746
|
flex-direction: column;
|
|
746
747
|
min-width: 0;
|
|
748
|
+
min-height: 0; /* Allow proper flex shrinking */
|
|
749
|
+
overflow: hidden; /* Prevent scrolling - ChatPanel handles it */
|
|
747
750
|
background-color: #ffffff;
|
|
748
751
|
}
|
|
749
752
|
|
|
@@ -117,18 +117,21 @@ export declare const playgroundActions: {
|
|
|
117
117
|
removeSession: (sessionId: string) => void;
|
|
118
118
|
/**
|
|
119
119
|
* Set messages for the current session
|
|
120
|
+
* Messages are automatically sorted chronologically
|
|
120
121
|
*
|
|
121
122
|
* @param messageList - Array of messages
|
|
122
123
|
*/
|
|
123
124
|
setMessages: (messageList: PlaygroundMessage[]) => void;
|
|
124
125
|
/**
|
|
125
126
|
* Add a message to the current session
|
|
127
|
+
* Messages are automatically sorted chronologically after adding
|
|
126
128
|
*
|
|
127
129
|
* @param message - The message to add
|
|
128
130
|
*/
|
|
129
131
|
addMessage: (message: PlaygroundMessage) => void;
|
|
130
132
|
/**
|
|
131
133
|
* Add multiple messages to the current session
|
|
134
|
+
* Messages are deduplicated and automatically sorted chronologically
|
|
132
135
|
*
|
|
133
136
|
* @param newMessages - Array of messages to add
|
|
134
137
|
*/
|
|
@@ -138,6 +138,40 @@ export const hasChatInput = derived(inputFields, ($fields) => $fields.some((fiel
|
|
|
138
138
|
*/
|
|
139
139
|
export const sessionCount = derived(sessions, ($sessions) => $sessions.length);
|
|
140
140
|
// =========================================================================
|
|
141
|
+
// Helper Functions
|
|
142
|
+
// =========================================================================
|
|
143
|
+
/**
|
|
144
|
+
* Sort messages chronologically by sequenceNumber
|
|
145
|
+
*
|
|
146
|
+
* All messages (user, assistant, log) have incrementing sequenceNumbers (1, 2, 3, ...).
|
|
147
|
+
* This provides a simple, reliable sort order for displaying messages.
|
|
148
|
+
*
|
|
149
|
+
* Sort order:
|
|
150
|
+
* 1. Primary: sequenceNumber (incrementing for all messages)
|
|
151
|
+
* 2. Secondary: timestamp (fallback for messages without sequenceNumber)
|
|
152
|
+
* 3. Tertiary: id as final tiebreaker
|
|
153
|
+
*
|
|
154
|
+
* @param messageList - Array of messages to sort
|
|
155
|
+
* @returns Sorted array of messages
|
|
156
|
+
*/
|
|
157
|
+
function sortMessagesChronologically(messageList) {
|
|
158
|
+
return [...messageList].sort((a, b) => {
|
|
159
|
+
// Primary: Sort by sequenceNumber
|
|
160
|
+
const seqA = a.sequenceNumber ?? 0;
|
|
161
|
+
const seqB = b.sequenceNumber ?? 0;
|
|
162
|
+
if (seqA !== seqB) {
|
|
163
|
+
return seqA - seqB;
|
|
164
|
+
}
|
|
165
|
+
// Secondary: Sort by timestamp for messages without sequenceNumber
|
|
166
|
+
const timestampCompare = a.timestamp.localeCompare(b.timestamp);
|
|
167
|
+
if (timestampCompare !== 0) {
|
|
168
|
+
return timestampCompare;
|
|
169
|
+
}
|
|
170
|
+
// Tertiary: Sort by ID as final tiebreaker
|
|
171
|
+
return a.id.localeCompare(b.id);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
// =========================================================================
|
|
141
175
|
// Actions
|
|
142
176
|
// =========================================================================
|
|
143
177
|
/**
|
|
@@ -213,22 +247,25 @@ export const playgroundActions = {
|
|
|
213
247
|
},
|
|
214
248
|
/**
|
|
215
249
|
* Set messages for the current session
|
|
250
|
+
* Messages are automatically sorted chronologically
|
|
216
251
|
*
|
|
217
252
|
* @param messageList - Array of messages
|
|
218
253
|
*/
|
|
219
254
|
setMessages: (messageList) => {
|
|
220
|
-
messages.set(messageList);
|
|
255
|
+
messages.set(sortMessagesChronologically(messageList));
|
|
221
256
|
},
|
|
222
257
|
/**
|
|
223
258
|
* Add a message to the current session
|
|
259
|
+
* Messages are automatically sorted chronologically after adding
|
|
224
260
|
*
|
|
225
261
|
* @param message - The message to add
|
|
226
262
|
*/
|
|
227
263
|
addMessage: (message) => {
|
|
228
|
-
messages.update(($messages) => [...$messages, message]);
|
|
264
|
+
messages.update(($messages) => sortMessagesChronologically([...$messages, message]));
|
|
229
265
|
},
|
|
230
266
|
/**
|
|
231
267
|
* Add multiple messages to the current session
|
|
268
|
+
* Messages are deduplicated and automatically sorted chronologically
|
|
232
269
|
*
|
|
233
270
|
* @param newMessages - Array of messages to add
|
|
234
271
|
*/
|
|
@@ -239,7 +276,8 @@ export const playgroundActions = {
|
|
|
239
276
|
// Deduplicate by message ID
|
|
240
277
|
const existingIds = new Set($messages.map((m) => m.id));
|
|
241
278
|
const uniqueNewMessages = newMessages.filter((m) => !existingIds.has(m.id));
|
|
242
|
-
|
|
279
|
+
// Sort the combined messages chronologically
|
|
280
|
+
return sortMessagesChronologically([...$messages, ...uniqueNewMessages]);
|
|
243
281
|
});
|
|
244
282
|
},
|
|
245
283
|
/**
|
|
@@ -24,6 +24,10 @@ export type PlaygroundMessageRole = 'user' | 'assistant' | 'system' | 'log';
|
|
|
24
24
|
* Log level for log-type messages
|
|
25
25
|
*/
|
|
26
26
|
export type PlaygroundMessageLevel = 'info' | 'warning' | 'error' | 'debug';
|
|
27
|
+
/**
|
|
28
|
+
* Status of a playground message
|
|
29
|
+
*/
|
|
30
|
+
export type PlaygroundMessageStatus = 'pending' | 'processing' | 'completed' | 'failed';
|
|
27
31
|
/**
|
|
28
32
|
* Playground session representing a test conversation
|
|
29
33
|
*
|
|
@@ -104,8 +108,18 @@ export interface PlaygroundMessage {
|
|
|
104
108
|
content: string;
|
|
105
109
|
/** Message timestamp (ISO 8601) */
|
|
106
110
|
timestamp: string;
|
|
107
|
-
/**
|
|
108
|
-
|
|
111
|
+
/** Message status */
|
|
112
|
+
status?: PlaygroundMessageStatus;
|
|
113
|
+
/**
|
|
114
|
+
* Sequence number for ordering messages
|
|
115
|
+
* - User messages: incrementing numbers (1, 2, 3, ...)
|
|
116
|
+
* - Assistant/system responses: 0 (sorted after parent via parentMessageId)
|
|
117
|
+
*/
|
|
118
|
+
sequenceNumber?: number;
|
|
119
|
+
/** Parent message ID (for assistant responses linked to user messages) */
|
|
120
|
+
parentMessageId?: string;
|
|
121
|
+
/** Associated node ID (for log/assistant messages) */
|
|
122
|
+
nodeId?: string | null;
|
|
109
123
|
/** Additional message metadata */
|
|
110
124
|
metadata?: PlaygroundMessageMetadata;
|
|
111
125
|
}
|