refac: omit reasoning content in payload

This commit is contained in:
Timothy Jaeryang Baek 2025-01-22 09:29:26 -08:00
parent 9feed97f22
commit a1e4e7c007

View File

@ -1473,6 +1473,10 @@
params?.stream_response ?? params?.stream_response ??
true; true;
const removeDetailsWithReasoning = (content) => {
return content.replace(/<details\s+type="reasoning"[^>]*>.*?<\/details>/gis, '').trim();
};
const messages = [ const messages = [
params?.system || $settings.system || (responseMessage?.userContext ?? null) params?.system || $settings.system || (responseMessage?.userContext ?? null)
? { ? {
@ -1490,7 +1494,10 @@
}` }`
} }
: undefined, : undefined,
...createMessagesList(responseMessageId) ...createMessagesList(responseMessageId).map((message) => ({
...message,
content: removeDetailsWithReasoning(message.content)
}))
] ]
.filter((message) => message?.content?.trim()) .filter((message) => message?.content?.trim())
.map((message, idx, arr) => ({ .map((message, idx, arr) => ({