Merge 3ab621175a
into d7b31a9d84
This commit is contained in:
commit
d31a2d3153
2 changed files with 8 additions and 8 deletions
Binary file not shown.
|
@ -47,18 +47,18 @@ export default function ChatMessage({
|
||||||
let actualContent = '';
|
let actualContent = '';
|
||||||
let thought = '';
|
let thought = '';
|
||||||
let isThinking = false;
|
let isThinking = false;
|
||||||
let thinkSplit = msg.content.split('<think>', 2);
|
let [match, ...rest] = msg.content.split('<think>');
|
||||||
actualContent += thinkSplit[0];
|
actualContent += match;
|
||||||
while (thinkSplit[1] !== undefined) {
|
while (rest.length !== 0) {
|
||||||
// <think> tag found
|
// <think> tag found
|
||||||
thinkSplit = thinkSplit[1].split('</think>', 2);
|
[match, ...rest] = rest.join('<think>').split('</think>');
|
||||||
thought += thinkSplit[0];
|
thought += thought !== '' ? '\n***\n' + match : match;
|
||||||
isThinking = true;
|
isThinking = true;
|
||||||
if (thinkSplit[1] !== undefined) {
|
if (rest.length !== 0) {
|
||||||
// </think> closing tag found
|
// </think> closing tag found
|
||||||
isThinking = false;
|
isThinking = false;
|
||||||
thinkSplit = thinkSplit[1].split('<think>', 2);
|
[match, ...rest] = rest.join('</think>').split('<think>');
|
||||||
actualContent += thinkSplit[0];
|
actualContent += match;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { content: actualContent, thought, isThinking };
|
return { content: actualContent, thought, isThinking };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue