Merge pull request #4789 from usamanasar38/4708-fix-thinking-not-terminated-for-reasoning-model
fix: terminate thinking animation for reasoning model on request completion
This commit is contained in:
commit
d570f54330
2 changed files with 8 additions and 2 deletions
|
|
@ -111,6 +111,12 @@ export const sessionSlice = createSlice({
|
|||
lastMessage.promptLogs = lastMessage.promptLogs
|
||||
? lastMessage.promptLogs.concat(payload)
|
||||
: payload;
|
||||
|
||||
// Inactive thinking for reasoning models when '</think>' tag is not received on request completion
|
||||
if (lastMessage.reasoning?.active) {
|
||||
lastMessage.reasoning.active = false;
|
||||
lastMessage.reasoning.endAt = Date.now();
|
||||
}
|
||||
},
|
||||
setActive: (state) => {
|
||||
state.isStreaming = true;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
addPromptCompletionPair,
|
||||
selectUseTools,
|
||||
setToolGenerated,
|
||||
streamUpdate,
|
||||
streamUpdate
|
||||
} from "../slices/sessionSlice";
|
||||
import { ThunkApiType } from "../store";
|
||||
import { callTool } from "./callTool";
|
||||
|
|
@ -70,7 +70,7 @@ export const streamNormalInput = createAsyncThunk<
|
|||
next = await gen.next();
|
||||
}
|
||||
|
||||
// Attach prompt log
|
||||
// Attach prompt log and end thinking for reasoning models
|
||||
if (next.done && next.value) {
|
||||
dispatch(addPromptCompletionPair([next.value]));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue