Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 59x 67x 3x 64x | import { Message } from "../chat/Message.js";
/**
* Maps system and developer roles based on provider capabilities.
* If supportsDeveloperRole is true, both "system" and "developer" messages are mapped to "developer".
* If supportsDeveloperRole is false, both "system" and "developer" messages are mapped to "system".
*/
export function mapSystemMessages(messages: Message[], supportsDeveloperRole: boolean): Message[] {
return messages.map((msg) => {
if (msg.role === "system" || (msg.role as string) === "developer") {
return {
...msg,
role: supportsDeveloperRole ? "developer" : "system"
} as Message;
}
return msg;
});
}
|