Merge pull request #7720 from QianKuang8/qian/fix-incorrect-tool-call-content

fix: Prevent tool content with <think> tags from triggering incorrect tool calls
This commit is contained in:
Dallin Romney 2025-09-12 21:05:22 -06:00 • committed by GitHub
commit 9310b44614
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -545,7 +545,7 @@ export const sessionSlice = createSlice({
// OpenAI-compatible models in agent mode sometimes send
// all of their data in one message, so we handle that case early.
if (messageContent) {
if (messageContent && message.role !== "tool") {
const thinkMatches = messageContent.match(
/<think>([\s\S]*)<\/think>([\s\S]*)/,
);
@ -605,7 +605,7 @@ export const sessionSlice = createSlice({
// Add to the existing message
if (messageContent) {
if (messageContent.includes("<think>")) {
if (messageContent.includes("<think>") && message.role !== "tool") {
lastItem.reasoning = {
startAt: Date.now(),
active: true,