Include all chat messages (#1354)
This commit is contained in:
parent
e21dbed8c8
commit
8c6545bf9d
|
@ -727,6 +727,7 @@ Add any other context about the problem here.
|
||||||
model: MessageType.GEMINI,
|
model: MessageType.GEMINI,
|
||||||
};
|
};
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
let hasSystemPrompt = false;
|
||||||
for (const item of conversation) {
|
for (const item of conversation) {
|
||||||
i += 1;
|
i += 1;
|
||||||
const text =
|
const text =
|
||||||
|
@ -734,14 +735,15 @@ Add any other context about the problem here.
|
||||||
?.filter((m) => !!m.text)
|
?.filter((m) => !!m.text)
|
||||||
.map((m) => m.text)
|
.map((m) => m.text)
|
||||||
.join('') || '';
|
.join('') || '';
|
||||||
if (i <= 2) {
|
|
||||||
// Skip system prompt back and forth.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!text) {
|
if (!text) {
|
||||||
// Parsing Part[] back to various non-text output not yet implemented.
|
// Parsing Part[] back to various non-text output not yet implemented.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
chat.addHistory(item);
|
||||||
|
if (i === 1 && text.match(/context for our chat/)) {
|
||||||
|
hasSystemPrompt = true;
|
||||||
|
}
|
||||||
|
if (i > 2 || !hasSystemPrompt) {
|
||||||
addItem(
|
addItem(
|
||||||
{
|
{
|
||||||
type: (item.role && rolemap[item.role]) || MessageType.GEMINI,
|
type: (item.role && rolemap[item.role]) || MessageType.GEMINI,
|
||||||
|
@ -749,7 +751,7 @@ Add any other context about the problem here.
|
||||||
} as HistoryItemWithoutId,
|
} as HistoryItemWithoutId,
|
||||||
i,
|
i,
|
||||||
);
|
);
|
||||||
chat.addHistory(item);
|
}
|
||||||
}
|
}
|
||||||
console.clear();
|
console.clear();
|
||||||
refreshStatic();
|
refreshStatic();
|
||||||
|
|
Loading…
Reference in New Issue