mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-31 10:12:21 +01:00
fix(group): preserve peer identity when reloading history
This commit is contained in:
+4
-2
@@ -801,7 +801,8 @@ async function _sendRoundRobin(msg, box) {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ messages: [{
|
||||
role: 'user',
|
||||
content: `[${m._groupName || m.display}]: ${response}`
|
||||
content: `[${m._groupName || m.display}]: ${response}`,
|
||||
metadata: { group_peer: true, group_model: m._groupName || m.display, model: m.mid }
|
||||
}]}),
|
||||
});
|
||||
} catch (e) { console.warn('[group] sync failed:', e); }
|
||||
@@ -828,7 +829,8 @@ async function _syncAllResponses(holders) {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ messages: [{
|
||||
role: 'user',
|
||||
content: `[${model._groupName || model.display}]: ${response}`
|
||||
content: `[${model._groupName || model.display}]: ${response}`,
|
||||
metadata: { group_peer: true, group_model: model._groupName || model.display, model: model.mid }
|
||||
}]}),
|
||||
});
|
||||
} catch (e) { /* silent */ }
|
||||
|
||||
+13
-2
@@ -216,7 +216,18 @@ function _renderHistoryMessage(msg, modelName) {
|
||||
} else {
|
||||
displayContent = '';
|
||||
}
|
||||
if (msg.role === 'user') {
|
||||
let displayRole = msg.role;
|
||||
// Peer turns remain user-role context for the model, but are agent replies
|
||||
// in history. Only explicit identity plus its exact prefix can opt in.
|
||||
if (displayRole === 'user' && meta?.group_peer === true
|
||||
&& typeof meta.group_model === 'string' && meta.group_model) {
|
||||
const prefix = `[${meta.group_model}]: `;
|
||||
if (displayContent.startsWith(prefix)) {
|
||||
displayRole = 'assistant';
|
||||
displayContent = displayContent.slice(prefix.length);
|
||||
}
|
||||
}
|
||||
if (displayRole === 'user') {
|
||||
displayContent = _stripUserVisionBlocks(displayContent);
|
||||
const trimmed = displayContent.trim();
|
||||
if (
|
||||
@@ -233,7 +244,7 @@ function _renderHistoryMessage(msg, modelName) {
|
||||
displayContent = `[Doc edit: ${docEditMatch[1]}] ${docEditMatch[3]}`;
|
||||
}
|
||||
}
|
||||
return _addHistoryMessageWithFullRenderer(msg.role, displayContent, modelName, meta);
|
||||
return _addHistoryMessageWithFullRenderer(displayRole, displayContent, modelName, meta);
|
||||
}
|
||||
|
||||
function _clearHistoryPager() {
|
||||
|
||||
Reference in New Issue
Block a user