mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 09:45:24 -04:00
Revert Chat/Agent mode tag in message header
Per user report — the tag's mode metadata coincided with a 500 error on agent mode (especially on mobile). Removing the UI tag, the chat.js writes of metadata.mode, and the CSS pill so agent mode posts work cleanly again. Touches: - chat.js: drop _sendMode capture + meta.mode writes (user + assistant) - chatRenderer.js: roleTimestamp() back to a single (when) arg, drop the .role-mode-tag append; updated three call sites - style.css: dropped .role-mode-tag and .role-mode-agent rules
This commit is contained in:
+1
-18
@@ -628,18 +628,8 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
|
||||
}
|
||||
}
|
||||
let _userMsgEl = null;
|
||||
// Capture which mode the user picked at send time so the message
|
||||
// header can show "Chat" or "Agent" next to the timestamp.
|
||||
// toggleState is declared later in this function — load fresh here.
|
||||
let _sendMode = 'chat';
|
||||
try {
|
||||
const _ts = Storage.loadToggleState();
|
||||
if ((_ts.mode || 'chat') === 'agent') _sendMode = 'agent';
|
||||
} catch (_) {}
|
||||
if (!skipBubble) {
|
||||
const _userMeta = { mode: _sendMode };
|
||||
if (_pendingAttachInfo) _userMeta.attachments = _pendingAttachInfo;
|
||||
_userMsgEl = addMessage('user', userDisplay, null, _userMeta);
|
||||
_userMsgEl = addMessage('user', userDisplay, null, _pendingAttachInfo ? { attachments: _pendingAttachInfo } : null);
|
||||
}
|
||||
messageInput.value = '';
|
||||
messageInput.style.height = '';
|
||||
@@ -3433,13 +3423,6 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
|
||||
if (holder.parentNode) holder.remove();
|
||||
const model = meta && meta.model;
|
||||
const meta_ = metricsData ? Object.assign({ model }, metricsData) : { model };
|
||||
// Carry the send-time mode through so the assistant header gets
|
||||
// the same Chat/Agent tag next to its timestamp. toggleState
|
||||
// isn't in scope here — read fresh.
|
||||
try {
|
||||
const _ts = Storage.loadToggleState();
|
||||
meta_.mode = ((_ts.mode || 'chat') === 'agent') ? 'agent' : 'chat';
|
||||
} catch (_) {}
|
||||
chatRenderer.addMessage('assistant', roundText, model, meta_);
|
||||
uiModule.scrollHistory();
|
||||
return true;
|
||||
|
||||
@@ -832,10 +832,8 @@ export function updateSessionCostUI() {
|
||||
|
||||
/** Create a timestamp span for role labels.
|
||||
* Pass an ISO string / Date / epoch-ms to render the message's own time
|
||||
* (used when replaying history). Falls back to "now" when no value is given.
|
||||
* Optionally pass `mode` ('chat' | 'agent') to append a small badge so the
|
||||
* reader can tell at a glance which path the message went through. */
|
||||
export function roleTimestamp(when, mode) {
|
||||
* (used when replaying history). Falls back to "now" when no value is given. */
|
||||
export function roleTimestamp(when) {
|
||||
const ts = document.createElement('span');
|
||||
ts.className = 'role-timestamp';
|
||||
let d;
|
||||
@@ -846,12 +844,6 @@ export function roleTimestamp(when, mode) {
|
||||
if (isNaN(d.getTime())) d = new Date();
|
||||
ts.textContent = d.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
|
||||
ts.title = d.toLocaleString();
|
||||
if (mode === 'agent' || mode === 'chat') {
|
||||
const tag = document.createElement('span');
|
||||
tag.className = 'role-mode-tag role-mode-' + mode;
|
||||
tag.textContent = mode === 'agent' ? 'Agent' : 'Chat';
|
||||
ts.appendChild(tag);
|
||||
}
|
||||
return ts;
|
||||
}
|
||||
|
||||
@@ -2013,7 +2005,7 @@ export function addMessage(role, content, modelName, metadata) {
|
||||
roleEl.title = pair.requestedModel + ' -> ' + contModel;
|
||||
}
|
||||
applyModelColor(roleEl, contModel);
|
||||
if (r === 0) roleEl.appendChild(roleTimestamp(metadata?.timestamp, metadata?.mode));
|
||||
if (r === 0) roleEl.appendChild(roleTimestamp(metadata?.timestamp));
|
||||
wrap.appendChild(roleEl);
|
||||
const body = document.createElement('div');
|
||||
body.className = 'body';
|
||||
@@ -2173,7 +2165,7 @@ export function addMessage(role, content, modelName, metadata) {
|
||||
r.title = replyModels.requestedModel + ' -> ' + resolvedModel;
|
||||
}
|
||||
if (!isSlash && !isCompacted) applyModelColor(r, resolvedModel);
|
||||
r.appendChild(roleTimestamp(metadata?.timestamp, metadata?.mode));
|
||||
r.appendChild(roleTimestamp(metadata?.timestamp));
|
||||
}
|
||||
|
||||
const b = document.createElement('div');
|
||||
@@ -2418,7 +2410,7 @@ export function addMessage(role, content, modelName, metadata) {
|
||||
if (metadata) displayMetrics(wrap, metadata);
|
||||
} else {
|
||||
// Add timestamp to user header (like AI messages)
|
||||
r.appendChild(roleTimestamp(metadata?.timestamp, metadata?.mode));
|
||||
r.appendChild(roleTimestamp(metadata?.timestamp));
|
||||
|
||||
wrap.appendChild(createUserMsgFooter(wrap));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user