incognitolm commited on
Commit
a2df94b
ยท
1 Parent(s): ad573c0

Message versions

Browse files
Files changed (1) hide show
  1. public/js/chat.js +7 -4
public/js/chat.js CHANGED
@@ -120,13 +120,15 @@ function appendUserMsg(box, msg, index) {
120
  });
121
 
122
  wrap.appendChild(bubble);
123
- if (msg.versions?.length > 1) wrap.appendChild(buildVersionNav(msg, index));
124
 
125
  // User actions appear on the RIGHT side
126
  wrap.appendChild(buildActions([
127
  { icon: '๐Ÿ“‹', title: 'Copy', fn: () => copyText(text) },
128
  { icon: 'โœ๏ธ', title: 'Edit', fn: () => startUserEdit(wrap, index, msg, text) },
129
  ], 'right'));
 
 
 
130
  box.appendChild(wrap);
131
  }
132
 
@@ -146,13 +148,15 @@ function appendAssistantMsg(box, msg, index) {
146
  }
147
 
148
  wrap.appendChild(bubble);
149
- if (msg.versions?.length > 1) wrap.appendChild(buildVersionNav(msg, index));
150
 
151
  // Assistant actions appear on the LEFT side
152
  wrap.appendChild(buildActions([
153
  { icon: '๐Ÿ“‹', title: 'Copy', fn: () => copyText(msg.content || '') },
154
  { icon: 'โœ๏ธ', title: 'Edit', fn: () => startAssistantEdit(wrap, index, msg) },
155
  ], 'left'));
 
 
 
156
  box.appendChild(wrap);
157
  }
158
 
@@ -285,8 +289,7 @@ function startUserEdit(wrap, index, msg, originalText) {
285
  const handler = (editMsg) => {
286
  if (editMsg.sessionId !== activeSessionId || editMsg.messageIndex !== index) return;
287
  off('chat:messageEdited', handler);
288
- send({ type: 'chat:send', sessionId: activeSessionId,
289
- content: newContent, tools: getActiveTools() });
290
  };
291
  on('chat:messageEdited', handler);
292
  });
 
120
  });
121
 
122
  wrap.appendChild(bubble);
 
123
 
124
  // User actions appear on the RIGHT side
125
  wrap.appendChild(buildActions([
126
  { icon: '๐Ÿ“‹', title: 'Copy', fn: () => copyText(text) },
127
  { icon: 'โœ๏ธ', title: 'Edit', fn: () => startUserEdit(wrap, index, msg, text) },
128
  ], 'right'));
129
+
130
+ if (msg.versions?.length > 1) wrap.appendChild(buildVersionNav(msg, index));
131
+
132
  box.appendChild(wrap);
133
  }
134
 
 
148
  }
149
 
150
  wrap.appendChild(bubble);
 
151
 
152
  // Assistant actions appear on the LEFT side
153
  wrap.appendChild(buildActions([
154
  { icon: '๐Ÿ“‹', title: 'Copy', fn: () => copyText(msg.content || '') },
155
  { icon: 'โœ๏ธ', title: 'Edit', fn: () => startAssistantEdit(wrap, index, msg) },
156
  ], 'left'));
157
+
158
+ if (msg.versions?.length > 1) wrap.appendChild(buildVersionNav(msg, index));
159
+
160
  box.appendChild(wrap);
161
  }
162
 
 
289
  const handler = (editMsg) => {
290
  if (editMsg.sessionId !== activeSessionId || editMsg.messageIndex !== index) return;
291
  off('chat:messageEdited', handler);
292
+ send({ type: 'chat:send', sessionId: activeSessionId, tools: getActiveTools() });
 
293
  };
294
  on('chat:messageEdited', handler);
295
  });